Add patches and improve source.sh readability

This commit is contained in:
2025-04-14 17:02:07 +03:00
parent 6d8c7368b9
commit 9559d775dd
6 changed files with 368 additions and 12 deletions
+27 -9
View File
@@ -10,30 +10,48 @@ FILENAME="${DOWNLOAD##*/}"
prepare() {
wget "$DOWNLOAD"
tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE"
cd "$BPM_SOURCE"
# Apply patches from Arch Linux
patch -Np1 < "$BPM_WORKDIR"/expect-5.45.4-covscan-fixes.patch
patch -Np0 < "$BPM_WORKDIR"/expect-5.45-format-security.patch
# Apply patches from https://sourceforge.net/p/expect/patches/24/
patch -Np1 < "$BPM_WORKDIR"/expect-c99.patch
patch -Np1 < "$BPM_WORKDIR"/expect-configure-c99.patch
autoreconf -i
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
./configure --prefix=/usr \
--with-tcl=/usr/lib \
--enable-shared \
--mandir=/usr/share/man \
--with-tclinclude=/usr/include
./configure --prefix=/usr \
--mandir=/usr/share/man \
--with-tcl=/usr/lib \
--with-tclinclude=/usr/include \
--enable-shared \
--disable-rpath
make
}
# 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() {
make test
SHELL=/bin/sh make test | tee tests.log # Save output to file to read la
set -e
grep -q 'Files with failing tests' tests.log && exit 1 # Throw error if any files had failing tests
set +e
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
make DESTDIR="$BPM_OUTPUT" install
ln -svf expect"${BPM_PKG_VERSION}"/libexpect"${BPM_PKG_VERSION}".so "$BPM_OUTPUT"/usr/lib
mkdir -p "$BPM_OUTPUT"/usr/share/licenses/expect/
cp license.terms "$BPM_OUTPUT"/usr/share/licenses/expect/license.terms
# Create libexpect link
ln -sf expect"${BPM_PKG_VERSION}"/libexpect"${BPM_PKG_VERSION}".so "$BPM_OUTPUT"/usr/lib
# Install package license
install -Dm644 license.terms "$BPM_OUTPUT"/usr/share/licenses/expect/license.terms
}