# 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://github.com/p7zip-project/p7zip/archive/v${BPM_PKG_VERSION}/p7zip-${BPM_PKG_VERSION}.tar.gz" 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" cd "$BPM_SOURCE" # Disable manual page compression sed '/^gzip/d' -i install.sh # Security vulnerability fix sed -i '160a if(_buffer == nullptr || _size == _pos) return E_FAIL;' CPP/7zip/Common/StreamObjects.cpp } # The build function is executed in the source directory # This function is used to compile the source code build() { make all3 } # 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 } # The package function is executed in the source directory # This function is used to move the compiled files into the output directory package() { make DEST_HOME=/usr DEST_MAN=/usr/share/man DEST_DIR="$BPM_OUTPUT" install install -d "$BPM_OUTPUT"/usr/share/licenses/p7zip ln -s -t "$BPM_OUTPUT"/usr/share/licenses/p7zip/ /usr/share/doc/p7zip/DOC/{License.txt,unRarLicense.txt} }