MacOS + Upstream Sourceware Bzip2 1.0 #110
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MacOS + Upstream Sourceware Bzip2 1.0 | |
# Disabled - not working | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
schedule: | |
- cron: '02 02 * * 6' # Run every Saturday | |
jobs: | |
build: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
perl: | |
- '5.40' | |
# - '5.38' | |
# - '5.36' | |
# - '5.34' | |
# - '5.32' | |
# - '5.30' | |
# - '5.28' | |
# - '5.26' | |
# - '5.24' | |
# - '5.22' | |
# - '5.20' | |
# - '5.18' | |
# - '5.16' | |
# - '5.14' | |
# - '5.12' | |
# - '5.10' | |
# - '5.8' | |
# - '5.6' | |
upstream-bzip2-branch: | |
- master | |
upstream-dummy-version: | |
- '1.0.999' | |
env: | |
bzip2-source: ${{ github.workspace }}/upstream-bzip2-source | |
bzip2-install: ${{ github.workspace }}/upstream-bzip2-install | |
BZIP2_LIB: ${{ github.workspace }}/upstream-bzip2-install/lib | |
BZIP2_INCLUDE: ${{ github.workspace }}/upstream-bzip2-install/include | |
BZIP2_VERSION: ${{ matrix.upstream-dummy-version }} | |
BUILD_BZIP2: 0 | |
defaults: | |
run: | |
working-directory: repo | |
name: Perl ${{ matrix.perl }} + Upstream Sourceware '${{ matrix.upstream-bzip2-branch }}' | |
steps: | |
# - name: Checkout upstream bzip2 '${{matrix.upstream-bzip2-branch}}' | |
# uses: actions/checkout@v4 | |
# with: | |
# repository: https://sourceware.org/git/bzip2.git | |
# ref: ${{ matrix.upstream-bzip2-branch }} | |
# path: ${{ env.bzip2-source }} | |
- uses: actions/checkout@v4 | |
with: | |
path: repo | |
- name: Make Paths | |
run: | | |
mkdir -p ${{ env.bzip2-source }} | |
mkdir -p ${{ env.bzip2-install }} | |
mkdir -p ${{ env.bzip2-install }}/lib | |
mkdir -p ${{ env.bzip2-install }}/include | |
mkdir -p ${{ github.workspace }}/repo | |
- name: Checkout upstream bzip2 '${{matrix.upstream-bzip2-branch}}' | |
run: | | |
git clone --depth 1 https://sourceware.org/git/bzip2.git . | |
sed -i -e s'/BZ_VERSION "1.0.8.*"/BZ_VERSION "${{ env.BZIP2_VERSION }}"/' bzlib_private.h | |
working-directory: ${{ env.bzip2-source }} | |
# mac makefile sourced from https://stackoverflow.com/questions/67179779/building-and-installing-bzip2-with-shared-library-dylib-on-macos | |
- name: Build upstream bzip2 '${{matrix.upstream-bzip2-branch}}'' | |
run: | | |
#wget -c https://gist.githubusercontent.com/obihill/3278c17bcee41c0c8b59a41ada8c0d35/raw/3bf890e2ad40d0af358e153395c228326f0b44d5/Makefile-libbz2_dylib | |
#make -f Makefile-libbz2_dylib | |
gcc --shared -Wl,-install_name -Wl,libbz2.dylib -fpic -fPIC -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64 blocksort.c huffman.c crctable.c randtable.c compress.c decompress.c bzlib.c -o libbz2.${{ env.BZIP2_VERSION }}.dylib | |
ln -s libbz2.${{ env.BZIP2_VERSION }}.dylib libbz2.dylib | |
cp bzlib.h ${{ env.bzip2-install }}/include | |
cp libbz2.${{ env.BZIP2_VERSION }}.dylib libbz2.dylib ${{ env.bzip2-install }}/lib | |
working-directory: ${{ env.bzip2-source }} | |
- name: Show Installed Bzip2 files in ${{ env.bzip2-install }} | |
run: | | |
find . | |
working-directory: ${{ env.bzip2-install }} | |
- name: Setup perl | |
uses: shogo82148/actions-setup-perl@v1 | |
with: | |
perl-version: ${{ matrix.perl }} | |
- name: Perl version | |
run: perl -V | |
- name: Install dependencies | |
run: cpanm --quiet --installdeps --notest . | |
- name: Build | |
run: | | |
flags=$( perl -MConfig -e 'print $Config::Config{ccflags}' ) | |
perl Makefile.PL CCFLAGS="$flags -Werror" && make | |
- name: Show blib | |
run: | | |
find blib | |
- name: run install_name_tool | |
run: | | |
install_name_tool -change libbz2.dylib ${{ env.bzip2-install }}/lib/libbz2.dylib ./blib/arch/auto/Compress/Raw/Bzip2/Bzip2.bundle | |
- name: Test | |
run: make test | |
- name: Check Bzip2 Version | |
run: | | |
perl -Mblib -MCompress::Raw::Bzip2 -e ' | |
my $expected = "${{ env.BZIP2_VERSION }}"; | |
my $got = Compress::Raw::Bzip2::bzlibversion() ; | |
print "Expected: $expected\n" ; | |
print "Got: $got\n"; | |
die "Unexpected Bzip2 version\n" | |
if $expected ne $got; | |
' |