Skip to content

Commit

Permalink
Merge pull request #11 from bastibe/bastibe/1.1.0-build
Browse files Browse the repository at this point in the history
automatically build libsndfile 1.1.0 on the CI with MP3 support
  • Loading branch information
bastibe committed Sep 27, 2022
2 parents 6735b25 + b8c1068 commit 4bd2073
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 9 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/build-libs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Compile Libraries (macOS/Intel)

on:
push:
pull_request:
workflow_dispatch:

jobs:
build-libs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-11"]
fail-fast: true

steps:
- uses: actions/checkout@v2
- name: Compile library
run: ./mac_build.sh
- uses: actions/upload-artifact@v2
with:
name: lib
path: "libsndfile.dylib"
retention-days: 7
if-no-files-found: error

build-libs-windows:
runs-on: windows-2019
strategy:
matrix:
include:
- triplet: "x64-windows-custom"
libname: "libsndfile_x64.dll"
- triplet: "x86-windows-custom"
libname: "libsndfile_x86.dll"
fail-fast: true

steps:
- uses: actions/checkout@v2
- name: Update VCPKG
run: "vcpkg update"
- name: Build library
run: "vcpkg install libsndfile:${{ matrix.triplet }} --overlay-triplets=triplets"
- name: Copy library
run: "Copy-Item c:/vcpkg/installed/${{ matrix.triplet }}/bin/sndfile.dll -Destination ${{ matrix.libname }}"
- uses: actions/upload-artifact@v2
with:
name: lib
path: ${{ matrix.libname }}
retention-days: 7
if-no-files-found: error
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ libsndfile binaries
===================

This repository provides pre-compiled dynamic libraries for
[libsndfile](http://www.mega-nerd.com/libsndfile/).
The files have no dependencies on other libraries, support for
[FLAC](https://xiph.org/flac/) and [Ogg Vorbis](http://xiph.org/vorbis/)
[libsndfile](http://www.mega-nerd.com/libsndfile/). The files have no
dependencies on other libraries, support for
[FLAC](https://xiph.org/flac/) and
[Ogg Vorbis](http://xiph.org/vorbis/) and
[Opus](https://opus-codec.org/) and
MP3[encoding](https://lame.sourceforge.io/)/
[decoding](https://mpg123.org/)
is built-in statically.


Expand All @@ -27,8 +31,9 @@ Edit the versions of required libraries in the `mac_build.sh` file
VORBISNAME=libvorbis-1.3.7
FLACNAME=flac-1.3.3
OPUSNAME=opus-1.3.1
SNDFILE_VERSION=1.0.31

MPG123VERSION=1.29.3
LAMEVERSION=3.100
SNDFILE_VERSION=1.1.0

Run the script to build `libsndfile.dylib`

Expand All @@ -44,3 +49,7 @@ Copyright
* Ogg Vorbis by Xiph.Org Foundation, 3-clause BSD License.

* Opus by Xiph.Org Foundation and Broadcom and Microsoft, 3-clause BSD License.

* Mpg123 by Michael Hipp and others, LGPL v2.1 License.

* Lame by Mike Cheng, Mark Taylor, and The LAME Project, LGP v2 License.
Binary file removed libsndfile32bit.dll
Binary file not shown.
Binary file removed libsndfile64bit.dll
Binary file not shown.
Binary file added libsndfile_32bit.dll
Binary file not shown.
Binary file added libsndfile_64bit.dll
Binary file not shown.
Binary file removed libsndfile_arm.dylib
Binary file not shown.
Binary file added libsndfile_arm64.dylib
Binary file not shown.
Binary file removed libsndfile_intel.dylib
Binary file not shown.
Binary file added libsndfile_x86_64.dylib
Binary file not shown.
32 changes: 28 additions & 4 deletions mac_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ OGGVERSION=1.3.5
VORBISVERSION=1.3.7
FLACVERSION=1.3.3
OPUSVERSION=1.3.1
SNDFILE_VERSION=1.0.31
MPG123VERSION=1.30.2
LAMEVERSION=3.100
SNDFILE_VERSION=1.1.0

JOBS=8
SNDFILENAME=libsndfile-$SNDFILE_VERSION
Expand Down Expand Up @@ -48,6 +50,24 @@ cd opus-$OPUSVERSION
make -j$JOBS
cd ..

# mpg123

curl -LO https://sourceforge.net/projects/mpg123/files/mpg123/$MPG123VERSION/mpg123-$MPG123VERSION.tar.bz2
tar zxvf mpg123-$MPG123VERSION.tar.bz2
cd mpg123-$MPG123VERSION
./configure --enable-static --disable-shared
make -j$JOBS
cd ..

# liblame

curl -LO https://sourceforge.net/projects/lame/files/lame/$LAMEVERSION/lame-$LAMEVERSION.tar.gz
tar zxvf lame-$LAMEVERSION.tar.gz
cd lame-$LAMEVERSION
./configure --enable-static --disable-shared
make -j$JOBS
cd ..

# libsndfile

export FLAC_CFLAGS="-I$(pwd)/flac-$FLACVERSION/include"
Expand All @@ -60,11 +80,15 @@ export VORBISENC_CFLAGS="-I$(pwd)/libvorbis-$VORBISVERSION/include"
export VORBISENC_LIBS="$(pwd)/libvorbis-$VORBISVERSION/lib/libvorbisenc.la"
export OPUS_CFLAGS="-I$(pwd)/opus-$OPUSVERSION/include"
export OPUS_LIBS="$(pwd)/opus-$OPUSVERSION/libopus.la"
export LAME_CFLAGS="-I$(pwd)/lame-$LAMEVERSION/include"
export LAME_LIBS="$(pwd)/lame-$LAMEVERSION/libmp3lame/.libs/libmp3lame.la"
export MPG123_CFLAGS="-I$(pwd)/mpg123-$MPG123VERSION/src/libmpg123 $LAME_CFLAGS"
export MPG123_LIBS="$(pwd)/mpg123-$MPG123VERSION/src/libmpg123/libmpg123.la $LAME_LIBS"

curl -LO https://github.com/libsndfile/libsndfile/releases/download/$SNDFILE_VERSION/$SNDFILENAME.tar.bz2
tar jxvf $SNDFILENAME.tar.bz2
curl -LO https://github.com/libsndfile/libsndfile/releases/download/$SNDFILE_VERSION/libsndfile-$SNDFILE_VERSION.tar.xz
tar jxvf libsndfile-$SNDFILE_VERSION.tar.xz
cd $SNDFILENAME
./configure --disable-static --disable-sqlite --disable-alsa --enable-werror
./configure --disable-static --disable-sqlite --disable-alsa
make -j$JOBS
cd ..

Expand Down
4 changes: 4 additions & 0 deletions triplets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Custom triplets for Vcpkg.

https://vcpkg.readthedocs.io/en/latest/users/triplets/
https://vcpkg.readthedocs.io/en/latest/examples/overlay-triplets-linux-dynamic/
9 changes: 9 additions & 0 deletions triplets/x64-windows-custom.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic) # Runtime always dynamically linked.
set(VCPKG_LIBRARY_LINKAGE static) # Libs are static by default.
set(VCPKG_PLATFORM_TOOLSET v140) # Enforce v140 toolset.
set(VCPKG_BUILD_TYPE release) # Skip debug builds.

if (PORT STREQUAL libsndfile) # Only libsndfile is dynamic.
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
9 changes: 9 additions & 0 deletions triplets/x86-windows-custom.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_PLATFORM_TOOLSET v140)
set(VCPKG_BUILD_TYPE release)

if (PORT STREQUAL libsndfile)
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()

0 comments on commit 4bd2073

Please sign in to comment.