#!/bin/bash set -e build_dir=$1 # With simpleBuildEnvironment flag, we're already in build directory # which contains the copied source tree # Copy patch file from sources directory echo "Copying patch file..." cp sources/bzip2-1.0.8-install_docs-1.patch sources/bzip2-1.0.8/ # Change to source directory cd sources/bzip2-1.0.8/ # Apply documentation patch (try different strip levels) echo "Applying documentation patch..." patch -Np0 -i bzip2-1.0.8-install_docs-1.patch || echo "Patch failed, continuing without documentation patch" # Fix symbolic links to be relative echo "Fixing symbolic links to be relative..." sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile # Ensure man pages are installed to correct location echo "Fixing man page installation path..." sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile # Build the shared library echo "Building shared library..." make -f Makefile-libbz2_so # Clean previous build artifacts echo "Cleaning previous build artifacts..." make clean # Build the package echo "Building bzip2..." make echo "Build complete."