• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15set -e
16
17PASRC_PATH=$1
18PASRC_OUT_PATH=$2
19
20function clean_pa_src() {
21    echo "Clean local generated files"
22    rm -rf ABOUT-NLS Makefile Makefile.in PulseAudioConfig.cmake PulseAudioConfigVersion.cmake aclocal.m4
23    rm -rf autom4te.cache/ build-aux/ config.h config.h.in config.h.in~ config.log config.status configure
24    rm -rf libpulse-mainloop-glib.pc libpulse-simple.pc libpulse.pc libtool stamp-h1
25}
26
27clean_pa_src
28
29sed -i 's/\.\/git-version-gen .tarball-version//g' configure.ac
30sed -i 's/\[m4_esyscmd()\],//g' configure.ac
31sed -i 's/src doxygen man po/src doxygen man #po/g' Makefile.am
32
33PA_CONFIG_OPTIONS="
34    --without-caps
35    --disable-alsa
36    --disable-x11
37    --disable-oss-output
38    --disable-coreaudio-output
39    --disable-alsa
40    --disable-esound
41    --disable-gsettings
42    --disable-dbus
43    --disable-udev
44    --disable-ipv6
45    --disable-openssl
46    --disable-avahi
47    --disable-jack
48"
49# We check for this here, because if pkg-config is not found in the
50# system, it's likely that the pkg.m4 macro file is also not present,
51# which will make PKG_PROG_PKG_CONFIG be undefined and the generated
52# configure file faulty.
53if ! pkg-config --version &>/dev/null; then
54    echo "pkg-config is required to bootstrap this program"
55
56fi
57# Other necessary programs
58if ! autopoint --version &>/dev/null ; then
59    echo "autopoint is required to bootstrap this program"
60
61fi
62
63autoreconf --force --install --verbose
64
65if test "x$NOCONFIGURE" = "x"; then
66    CFLAGS="$CFLAGS -g -O0" $PASRC_PATH/configure --enable-force-preopen ${PA_CONFIG_OPTIONS} && \
67        make clean
68fi
69
70sed -i 's/#define ENABLE_NLS 1//g' config.h
71sed -i 's/#define HAVE_SHM_OPEN 1//g' config.h
72sed -i 's/#define HAVE_RUNNING_FROM_BUILD_TREE 1//g' config.h
73sed -i 's/#define HAVE_CPUID_H 1//g' config.h
74sed -i 's/#define HAVE_EXECINFO_H 1//g' config.h
75sed -i 's/#define HAVE_MEMFD 1//g' config.h
76echo "#define PACKAGE_NAME \"pulseaudio\"" >> config.h
77