# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT DOWNLOAD="https://www.freedesktop.org/software/pulseaudio/releases/pulseaudio-${BPM_PKG_VERSION}.tar.xz" FILENAME="${DOWNLOAD##*/}" # The prepare function is executed in the root of the temp directory # This function is used for downloading files and putting them into the correct location prepare() { wget "$DOWNLOAD" tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" } # The build function is executed in the source directory # This function is used to compile the source code build() { mkdir build cd build meson setup --prefix=/usr \ --libdir=/usr/lib \ --buildtype=release \ -Dsystemd=disabled \ -Delogind=enabled \ -Ddatabase=gdbm \ -Ddoxygen=false \ .. ninja } # The check function is executed in the source directory # This function is used to run tests to verify the package has been compiled correctly check() { cd build ninja test } package_libpulse() { cd build # Replace 'output' directory with 'output-libpulse' rmdir "$BPM_OUTPUT" mv "$BPM_SOURCE"/output-libpulse "$BPM_OUTPUT" # Install package license install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/pulseaudio/LICENSE } package_pulseaudio() { cd build DESTDIR="$BPM_OUTPUT" ninja install # Move libraries to temporary directory for libpulse package mkdir "$BPM_SOURCE"/output-libpulse install -d "$BPM_SOURCE"/output-libpulse/usr/bin install -d "$BPM_SOURCE"/output-libpulse/usr/lib install -d "$BPM_SOURCE"/output-libpulse/usr/share/{,man/man1,man/man5,bash-completion/completions} mv "$BPM_OUTPUT"/usr/bin/pa{cat,ctl,dsp,mon,play,rec,record} -t "$BPM_SOURCE"/output-libpulse/usr/bin/ mv "$BPM_OUTPUT"/usr/lib/*.so* -t "$BPM_SOURCE"/output-libpulse/usr/lib/ mv "$BPM_OUTPUT"/usr/lib/pulseaudio -t "$BPM_SOURCE"/output-libpulse/usr/lib/ mv "$BPM_OUTPUT"/usr/lib/{cmake,pkgconfig} -t "$BPM_SOURCE"/output-libpulse/usr/lib/ mv "$BPM_OUTPUT"/usr/include -t "$BPM_SOURCE"/output-libpulse/usr/ mv "$BPM_OUTPUT"/usr/share/vala -t "$BPM_SOURCE"/output-libpulse/usr/share mv "$BPM_OUTPUT"/usr/share/bash-completion/completions/{pulseaudio,pacat,pactl,padsp,paplay,parec,parecord} -t "$BPM_SOURCE"/output-libpulse/usr/share/bash-completion/completions/ mv "$BPM_OUTPUT"/usr/share/zsh -t "$BPM_SOURCE"/output-libpulse/usr/share mv "$BPM_OUTPUT"/usr/share/man/man1/{pacat,pactl,padsp,paplay,parec,parecord}.1 -t "$BPM_SOURCE"/output-libpulse/usr/share/man/man1/ mv "$BPM_OUTPUT"/usr/share/man/man5/pulse-client.conf.5 -t "$BPM_SOURCE"/output-libpulse/usr/share/man/man5/ # Remove system-wide dbus service rm "$BPM_OUTPUT"/usr/share/dbus-1/system.d/pulseaudio-system.conf # Install package license install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/pulseaudio/LICENSE }