Skip to content

Commit

Permalink
Merge pull request #34 from bemoody/robustness
Browse files Browse the repository at this point in the history
Build script improvements
  • Loading branch information
bastibe authored Dec 30, 2024
2 parents 27341b2 + 804500c commit daabd74
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 52 deletions.
59 changes: 16 additions & 43 deletions .github/workflows/build-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-11"]
os: ["macos-13"]
fail-fast: true

steps:
Expand All @@ -28,7 +28,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-11"]
os: ["macos-14"]
fail-fast: true

steps:
Expand Down Expand Up @@ -58,69 +58,42 @@ jobs:
name: lib-linux-x86_64
path: "libsndfile.so"

build-libs-linux-x86_64-glibc2_17:
build-libs-linux-x86_64-glibc2_28:
runs-on: "ubuntu-latest"
strategy:
fail-fast: true
container:
image: centos:7
env:
# OpenSSL<=1.0.2 is available for CentOS7, so we need to compile OpenSSL and Curl
SSL_VERSION: 3.1.0
CURL_VERSION: 8.0.1
image: quay.io/pypa/manylinux_2_28_x86_64
steps:
- uses: actions/checkout@v3
- name: Install required packages
run: |
yum install -y gcc gcc-c++ make bzip2 zlib-devel perl-core libmetalink-devel libssh2-devel c-ares-devel lbzip2
- name: Compile OpenSSL
run : |
curl -LO https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz
tar xvf openssl-${SSL_VERSION}.tar.gz
cd openssl-${SSL_VERSION}
./config --prefix=/usr shared zlib-dynamic
make
make test
make install
# check version
openssl version
- name: Compile curl
run: |
curl -LO https://curl.se/download/curl-${CURL_VERSION}.tar.gz
tar xvf curl-${CURL_VERSION}.tar.gz
cd curl-${CURL_VERSION}
./configure --enable-libcurl-option --with-openssl
make
make install
rm /usr/bin/curl
# check version
curl -V
- name: Compile library
run: ./linux_build.sh
- uses: actions/upload-artifact@v3
with:
name: lib-linux-x86_64-glibc2_17
name: lib-linux-x86_64-glibc2_28
path: "libsndfile.so"

build-libs-linux-arm64:
runs-on: ${{ matrix.os }}
container: debian:10
strategy:
matrix:
os: ["ubuntu-20.04"]
fail-fast: true

steps:
- name: Install aarch64-linux-gnu cross-compiler
run: |
apt-get update
apt-get install -y build-essential \
curl \
python3 \
g++-aarch64-linux-gnu
- uses: actions/checkout@v3
- name: Compile library
uses: pguyot/arm-runner-action@v2
with:
base_image: raspios_lite_arm64:2022-04-04
cpu: cortex-a53
cpu_info: cpuinfo/raspberrypi_zero2_w_arm64
bind_mount_repository: true
commands: |
./linux_build.sh
run: |
export CONFIGURE_FLAGS="--host=aarch64-linux-gnu --build=x86_64-linux-gnu"
./linux_build.sh
- uses: actions/upload-artifact@v3
with:
name: lib-linux-arm64
Expand Down
4 changes: 2 additions & 2 deletions darwin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ set(OPUS_INCLUDE_DIR $ENV{OPUS_INCLUDE})
set(MP3LAME_LIBRARY $ENV{MP3LAME_LIBS})
set(MP3LAME_INCLUDE_DIR $ENV{MP3LAME_INCLUDE})

set(MPG123_LIBRARY $ENV{MPG123_LIBS})
set(MPG123_INCLUDE_DIR $ENV{MPG123_INCLUDE})
set(mpg123_LIBRARY $ENV{MPG123_LIBS})
set(mpg123_INCLUDE_DIR $ENV{MPG123_INCLUDE})
22 changes: 15 additions & 7 deletions linux_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

OGGVERSION=1.3.5
VORBISVERSION=1.3.7
FLACVERSION=1.4.3
Expand All @@ -11,6 +13,8 @@ SNDFILENAME=libsndfile-$SNDFILE_VERSION
OGG_INCDIR="$(pwd)/libogg-$OGGVERSION/include"
OGG_LIBDIR="$(pwd)/libogg-$OGGVERSION/src/.libs"

set -e

# make sure all static libraries are position-independent, so we can link them
# into the libsndfile.so later:
export CFLAGS="-fPIC"
Expand All @@ -21,16 +25,19 @@ export LDFLAGS="-fPIC"
curl -LO https://downloads.xiph.org/releases/ogg/libogg-$OGGVERSION.tar.gz
tar xvf libogg-$OGGVERSION.tar.gz
cd libogg-$OGGVERSION
./configure --disable-shared
./configure --disable-shared $CONFIGURE_FLAGS
make -j$JOBS
cd ..

# libvorbis

export OGG_CFLAGS="-I$OGG_INCDIR"
export OGG_LIBS="-L$OGG_LIBDIR -logg"

curl -LO https://downloads.xiph.org/releases/vorbis/libvorbis-$VORBISVERSION.tar.gz
tar xvf libvorbis-$VORBISVERSION.tar.gz
cd libvorbis-$VORBISVERSION
./configure --disable-shared --with-ogg-includes=$OGG_INCDIR --with-ogg-libraries=$OGG_LIBDIR
./configure --disable-shared --with-ogg-includes=$OGG_INCDIR --with-ogg-libraries=$OGG_LIBDIR $CONFIGURE_FLAGS
make -j$JOBS
cd ..

Expand All @@ -39,7 +46,7 @@ cd ..
curl -LO https://downloads.xiph.org/releases/flac/flac-$FLACVERSION.tar.xz
tar xvf flac-$FLACVERSION.tar.xz
cd flac-$FLACVERSION
./configure --enable-static --disable-shared --with-ogg-includes=$OGG_INCDIR --with-ogg-libraries=$OGG_LIBDIR
./configure --enable-static --disable-shared --with-ogg-includes=$OGG_INCDIR --with-ogg-libraries=$OGG_LIBDIR $CONFIGURE_FLAGS
make -j$JOBS
cd ..

Expand All @@ -48,7 +55,7 @@ cd ..
curl -LO https://downloads.xiph.org/releases/opus/opus-$OPUSVERSION.tar.gz
tar xvf opus-$OPUSVERSION.tar.gz
cd opus-$OPUSVERSION
./configure --disable-shared
./configure --disable-shared $CONFIGURE_FLAGS
make -j$JOBS
cd ..

Expand All @@ -57,7 +64,7 @@ cd ..
curl -LO https://sourceforge.net/projects/mpg123/files/mpg123/$MPG123VERSION/mpg123-$MPG123VERSION.tar.bz2
tar xvf mpg123-$MPG123VERSION.tar.bz2
cd mpg123-$MPG123VERSION
./configure --enable-static --disable-shared
./configure --enable-static --disable-shared $CONFIGURE_FLAGS
make -j$JOBS
cd ..

Expand All @@ -66,7 +73,7 @@ cd ..
curl -LO https://sourceforge.net/projects/lame/files/lame/$LAMEVERSION/lame-$LAMEVERSION.tar.gz
tar xvf lame-$LAMEVERSION.tar.gz
cd lame-$LAMEVERSION
./configure --enable-static --disable-shared
./configure --enable-static --disable-shared $CONFIGURE_FLAGS
make -j$JOBS
cd ..

Expand Down Expand Up @@ -101,7 +108,8 @@ cp lame-$LAMEVERSION/include/*.h lame-$LAMEVERSION/include/lame
curl -LO https://github.com/libsndfile/libsndfile/releases/download/$SNDFILE_VERSION/libsndfile-$SNDFILE_VERSION.tar.xz
tar xvf libsndfile-$SNDFILE_VERSION.tar.xz
cd $SNDFILENAME
./configure --disable-static --disable-sqlite --disable-alsa && make -j$JOBS
./configure --disable-static --disable-sqlite --disable-alsa --enable-external-libs --enable-mpeg $CONFIGURE_FLAGS
make -j$JOBS
cd ..

cp $SNDFILENAME/src/.libs/libsndfile.so libsndfile.so
Expand Down
8 changes: 8 additions & 0 deletions mac_build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

OGGVERSION=1.3.5
VORBISVERSION=1.3.7
FLACVERSION=1.4.3
Expand All @@ -11,6 +13,8 @@ SNDFILENAME=libsndfile-$SNDFILE_VERSION
OGG_INCDIR="$(pwd)/libogg-$OGGVERSION/include"
OGG_LIBDIR="$(pwd)/libogg-$OGGVERSION/src/.libs"

set -e

if [ "$1" = "arm64" ]; then
echo "Cross compiling for Darwin arm64.."
export MACOSX_DEPLOYMENT_TARGET=11.0
Expand All @@ -34,9 +38,13 @@ cd ..

# libvorbis

export OGG_CFLAGS="-I$OGG_INCDIR"
export OGG_LIBS="-L$OGG_LIBDIR -logg"

curl -LO https://downloads.xiph.org/releases/vorbis/libvorbis-$VORBISVERSION.tar.gz
tar zxvf libvorbis-$VORBISVERSION.tar.gz
cd libvorbis-$VORBISVERSION
sed -e 's/ -force_cpusubtype_ALL / /' -i.orig configure
CFLAGS=$EXTRA_CFLAGS CXXFLAGS=$EXTRA_CFLAGS ./configure $BUILD_HOST --disable-shared --with-ogg-includes=$OGG_INCDIR --with-ogg-libraries=$OGG_LIBDIR
make -j$JOBS
cd ..
Expand Down

0 comments on commit daabd74

Please sign in to comment.