Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 42 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ on:
version:
description: 'The version of libFLAC to build'
required: false
default: '1.3.3'
default: '1.3.4'
debug:
description: 'Enable debug'
required: false
default: 'no'

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-18.04
steps:
- name: Install dependencies
run: |
Expand All @@ -23,7 +23,7 @@ jobs:
autoconf \
clang \
gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu \
libtool \
mingw-w64 \
patchelf \
Expand All @@ -32,7 +32,7 @@ jobs:
run: |
wget https://ftp.osuosl.org/pub/xiph/releases/flac/flac-${{ github.event.inputs.version }}.tar.xz

- name: Build libFLAC (Linux)
- name: Build libFLAC (Linux x86_64)
run: |
tar xJf flac-${{ github.event.inputs.version }}.tar.xz
mv flac-${{ github.event.inputs.version }} flac-linux-x86_64
Expand All @@ -44,18 +44,36 @@ jobs:
cp src/libFLAC/.libs/libFLAC.so.8.3.0 ../linux-x86_64/libFLAC-8.3.0.so
cd ../linux-x86_64
patchelf --set-soname libFLAC-8.3.0.so libFLAC-8.3.0.so
- name: Upload Linux library
- name: Upload Linux x86_64 library
uses: actions/upload-artifact@v1
with:
name: linux-x86_64
path: linux-x86_64

- name: Build libFLAC (Linux arm64)
run: |
tar xJf flac-${{ github.event.inputs.version }}.tar.xz
mv flac-${{ github.event.inputs.version }} flac-linux-arm64
cd flac-linux-arm64
./configure --host=aarch64-linux-gnu --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} --enable-shared --disable-static --disable-examples
make
ls -l src/libFLAC/.libs
mkdir ../linux-arm64
cp src/libFLAC/.libs/libFLAC.so.8.3.0 ../linux-arm64/libFLAC-8.3.0.so
cd ../linux-arm64
patchelf --set-soname libFLAC-8.3.0.so libFLAC-8.3.0.so
- name: Upload Linux arm64 library
uses: actions/upload-artifact@v1
with:
name: linux-arm64
path: linux-arm64

- name: Build libFLAC (Windows x64)
run: |
tar xJf flac-${{ github.event.inputs.version }}.tar.xz
mv flac-${{ github.event.inputs.version }} flac-windows-x86_64
cd flac-windows-x86_64
./configure --host=x86_64-w64-mingw32 --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} --enable-shared --disable-static --disable-examples
./configure --host=x86_64-w64-mingw32 --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} CFLAGS="-D_FORTIFY_SOURCE=0" --enable-shared --disable-static --disable-examples
make
ls -l src/libFLAC/.libs
mkdir ../windows-x86_64
Expand All @@ -72,7 +90,7 @@ jobs:
tar xJf flac-${{ github.event.inputs.version }}.tar.xz
mv flac-${{ github.event.inputs.version }} flac-windows-i686
cd flac-windows-i686
./configure --host=i686-w64-mingw32 --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} --enable-shared --disable-static --disable-examples
./configure --host=i686-w64-mingw32 --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} CFLAGS="-D_FORTIFY_SOURCE=0" --enable-shared --disable-static --disable-examples
make
ls -l src/libFLAC/.libs
mkdir ../windows-i686
Expand Down Expand Up @@ -102,24 +120,6 @@ jobs:
name: raspbian-armv7a
path: raspbian-armv7a

- name: Build libFLAC (Raspbian armv6z)
run: |
tar xJf flac-${{ github.event.inputs.version }}.tar.xz
mv flac-${{ github.event.inputs.version }} flac-raspbian-armv6z
cd flac-raspbian-armv6z
./configure --host=arm-linux-gnueabihf --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} CFLAGS="-mfpu=vfp -mfloat-abi=hard" --enable-shared --disable-static --disable-examples
make
ls -l src/libFLAC/.libs
mkdir ../raspbian-armv6z
cp src/libFLAC/.libs/libFLAC.so.8.3.0 ../raspbian-armv6z/libFLAC-8.3.0.so
cd ../raspbian-armv6z
patchelf --set-soname libFLAC-8.3.0.so libFLAC-8.3.0.so
- name: Upload Raspbian armv6z library
uses: actions/upload-artifact@v1
with:
name: raspbian-armv6z
path: raspbian-armv6z

build_macos:
runs-on: macos-latest
steps:
Expand All @@ -129,7 +129,7 @@ jobs:
run: |
wget https://ftp.osuosl.org/pub/xiph/releases/flac/flac-${{ github.event.inputs.version }}.tar.xz
tar xvf flac-${{ github.event.inputs.version }}.tar.xz
- name: Build libFLAC
- name: Build libFLAC (x86_64)
run: |
cd flac-${{ github.event.inputs.version }}
CC=clang ./configure --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} --enable-shared --disable-static --disable-examples
Expand All @@ -139,8 +139,23 @@ jobs:
cp src/libFLAC/.libs/libFLAC.8.dylib ../darwin-x86_64/
cd ../darwin-x86_64
install_name_tool -id @rpath/libFLAC.8.dylib libFLAC.8.dylib
- name: Upload macOS library
- name: Upload macOS x86_64 library
uses: actions/upload-artifact@v1
with:
name: darwin-x86_64
path: darwin-x86_64
- name: Build libFLAC (arm64)
run: |
cd flac-${{ github.event.inputs.version }}
./configure --host=aarch64-apple-darwin --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} CFLAGS="-arch arm64 -target arm64-apple-macos11" CXXFLAGS="-arch arm64 -target arm64-apple-macos11" --enable-shared --disable-static --disable-examples
make
mkdir ../darwin-arm64
ls -l src/libFLAC/.libs
cp src/libFLAC/.libs/libFLAC.8.dylib ../darwin-arm64/
cd ../darwin-arm64
install_name_tool -id @rpath/libFLAC.8.dylib libFLAC.8.dylib
- name: Upload macOS arm64 library
uses: actions/upload-artifact@v1
with:
name: darwin-arm64
path: darwin-arm64
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.6', '3.7', '3.8', '3.9' ]
python-version: [ '3.7', '3.8', '3.9', '3.10' ]

steps:
- uses: actions/checkout@v2
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
pyFLAC Changelog
----------------

**v2.1.0**

* Added support for Linux `arm64` architectures
* Added support for Darwin `arm64` architectures (macOS Apple Silicon)
* Fixed Raspberry Pi Zero library (see #13)
* Updated FLAC library to v1.3.4

**v2.0.0**

* Added `seek` and `tell` callbacks to `StreamEncoder`
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ include pyflac/builder/*.py
include pyflac/include/FLAC/*.h
include pyflac/libraries/LICENSE
include pyflac/libraries/darwin-x86_64/*.dylib
include pyflac/libraries/darwin-arm64/*.dylib
include pyflac/libraries/linux-x86_64/*.so
include pyflac/libraries/linux-arm64/*.so
include pyflac/libraries/raspbian-armv7a/*.so
include pyflac/libraries/raspbian-armv6z/*.so
include pyflac/libraries/windows-i686/*.dll
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ You can use pip to download and install the latest release with a single command
Supported platforms
-------------------

- macOS
- Linux
- RPi Zero/2/3/4
- Windows 7/8/10
- **macOS** (Intel/Apple Silicon)
- **Linux** (x86_64/arm64)
- **RPi** Zero/2/3/4
- **Windows** 7/8/10


CLI
Expand Down
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Limitations

- pyFLAC currently only supports 16-bit audio.
- FLAC metadata handling is not implemented.
- Seek/tell functionality is not implemented.


API Reference
Expand Down
2 changes: 1 addition & 1 deletion pyflac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ------------------------------------------------------------------------------

__title__ = 'pyFLAC'
__version__ = '2.0.0'
__version__ = '2.1.0'
__all__ = [
'StreamEncoder',
'FileEncoder',
Expand Down
9 changes: 8 additions & 1 deletion pyflac/builder/build_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ def get_build_kwargs():
}

if system == 'Darwin':
architecture = 'darwin-x86_64'
cpuinfo = subprocess.check_output(['sysctl', '-n', 'machdep.cpu.brand_string']).decode()
if cpuinfo.startswith('Apple'):
architecture = 'darwin-arm64'
else:
architecture = 'darwin-x86_64'

build_kwargs['libraries'] = ['FLAC.8']
build_kwargs['library_dirs'] = [os.path.join(package_path, 'libraries', architecture)]
build_kwargs['extra_link_args'] = ['-Wl,-rpath,@loader_path/libraries/' + architecture]
Expand All @@ -36,6 +41,8 @@ def get_build_kwargs():
architecture = 'raspbian-armv7a'
else:
architecture = 'raspbian-armv6z'
elif platform.machine() == 'aarch64':
architecture = 'linux-arm64'
else:
architecture = 'linux-x86_64'

Expand Down
8 changes: 4 additions & 4 deletions pyflac/include/FLAC/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/** \file include/FLAC/export.h
*
* \brief
* This module contains #defines and symbols for exporting function
* This module contains \#defines and symbols for exporting function
* calls, and providing version information and compiled-in features.
*
* See the \link flac_export export \endlink module.
Expand All @@ -46,7 +46,7 @@
* \ingroup flac
*
* \brief
* This module contains #defines and symbols for exporting function
* This module contains \#defines and symbols for exporting function
* calls, and providing version information and compiled-in features.
*
* If you are compiling with MSVC and will link to the static library
Expand All @@ -59,7 +59,7 @@
#if defined(FLAC__NO_DLL)
#define FLAC_API

#elif defined(_MSC_VER)
#elif defined(_WIN32)
#ifdef FLAC_API_EXPORTS
#define FLAC_API __declspec(dllexport)
#else
Expand All @@ -74,7 +74,7 @@

#endif

/** These #defines will mirror the libtool-based library version number, see
/** These \#defines will mirror the libtool-based library version number, see
* http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
*/
#define FLAC_API_VERSION_CURRENT 11
Expand Down
Binary file added pyflac/libraries/darwin-arm64/libFLAC.8.dylib
Binary file not shown.
Binary file modified pyflac/libraries/darwin-x86_64/libFLAC.8.dylib
Binary file not shown.
Binary file added pyflac/libraries/linux-arm64/libFLAC-8.3.0.so
Binary file not shown.
Binary file modified pyflac/libraries/linux-x86_64/libFLAC-8.3.0.so
Binary file not shown.
Binary file modified pyflac/libraries/raspbian-armv6z/libFLAC-8.3.0.so
Binary file not shown.
Binary file modified pyflac/libraries/raspbian-armv7a/libFLAC-8.3.0.so
Binary file not shown.
Binary file modified pyflac/libraries/windows-i686/FLAC-8.lib
Binary file not shown.
Binary file modified pyflac/libraries/windows-i686/libFLAC-8.dll
Binary file not shown.
Binary file modified pyflac/libraries/windows-x86_64/FLAC-8.lib
Binary file not shown.
Binary file modified pyflac/libraries/windows-x86_64/libFLAC-8.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
description-file = README.rst
description_file = README.rst

[build_sphinx]
source-dir = docs
Expand All @@ -10,4 +10,4 @@ all_files = 1
upload-dir = docs/_build/html

[flake8]
max-line-length = 120
max-line-length = 120
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ def read(fname):
],
install_requires=[
'cffi>=1.4.0',
'numpy; python_version >= "3.7.0"',
'numpy<=1.19.5; python_version < "3.7.0"',
'SoundFile>=0.8.0',
'numpy>=1.22; python_version >= "3.8"',
'numpy<1.22; python_version < "3.8.0"',
'SoundFile>=0.11',
],
test_suite='tests',
python_requires='>=3.6',
python_requires='>=3.7',
entry_points={
'console_scripts': [
'pyflac = pyflac.__main__:main',
Expand All @@ -58,10 +58,10 @@ def read(fname):
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Multimedia :: Sound/Audio',
],
)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py36, py37, py38, py39
envlist = py37, py38, py39, py310

[testenv]
deps = pytest==6.2.2
Expand Down