diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92feca6..6dacd8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ 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 @@ -14,7 +14,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - name: Install dependencies run: | @@ -23,7 +23,7 @@ jobs: autoconf \ clang \ gcc-arm-linux-gnueabihf \ - g++-arm-linux-gnueabihf \ + gcc-aarch64-linux-gnu \ libtool \ mingw-w64 \ patchelf \ @@ -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 @@ -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 @@ -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 @@ -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: @@ -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 @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 987e6e2..9b62d25 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4361989..e1ac802 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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` diff --git a/MANIFEST.in b/MANIFEST.in index 37f4ddb..fa4006a 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/README.rst b/README.rst index da334d7..1354121 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/docs/index.rst b/docs/index.rst index b7a7d8c..a931db4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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 diff --git a/pyflac/__init__.py b/pyflac/__init__.py index 4c42cfd..08e5765 100644 --- a/pyflac/__init__.py +++ b/pyflac/__init__.py @@ -10,7 +10,7 @@ # ------------------------------------------------------------------------------ __title__ = 'pyFLAC' -__version__ = '2.0.0' +__version__ = '2.1.0' __all__ = [ 'StreamEncoder', 'FileEncoder', diff --git a/pyflac/builder/build_args.py b/pyflac/builder/build_args.py index 5e137b4..b628974 100644 --- a/pyflac/builder/build_args.py +++ b/pyflac/builder/build_args.py @@ -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] @@ -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' diff --git a/pyflac/include/FLAC/export.h b/pyflac/include/FLAC/export.h index d52f0bb..3e3e764 100644 --- a/pyflac/include/FLAC/export.h +++ b/pyflac/include/FLAC/export.h @@ -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. @@ -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 @@ -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 @@ -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 diff --git a/pyflac/libraries/darwin-arm64/libFLAC.8.dylib b/pyflac/libraries/darwin-arm64/libFLAC.8.dylib new file mode 100644 index 0000000..304d556 Binary files /dev/null and b/pyflac/libraries/darwin-arm64/libFLAC.8.dylib differ diff --git a/pyflac/libraries/darwin-x86_64/libFLAC.8.dylib b/pyflac/libraries/darwin-x86_64/libFLAC.8.dylib index 06dd75a..38b0d46 100644 Binary files a/pyflac/libraries/darwin-x86_64/libFLAC.8.dylib and b/pyflac/libraries/darwin-x86_64/libFLAC.8.dylib differ diff --git a/pyflac/libraries/linux-arm64/libFLAC-8.3.0.so b/pyflac/libraries/linux-arm64/libFLAC-8.3.0.so new file mode 100644 index 0000000..3cde363 Binary files /dev/null and b/pyflac/libraries/linux-arm64/libFLAC-8.3.0.so differ diff --git a/pyflac/libraries/linux-x86_64/libFLAC-8.3.0.so b/pyflac/libraries/linux-x86_64/libFLAC-8.3.0.so index 02f9aa7..c65f780 100644 Binary files a/pyflac/libraries/linux-x86_64/libFLAC-8.3.0.so and b/pyflac/libraries/linux-x86_64/libFLAC-8.3.0.so differ diff --git a/pyflac/libraries/raspbian-armv6z/libFLAC-8.3.0.so b/pyflac/libraries/raspbian-armv6z/libFLAC-8.3.0.so index b7d326e..211ac81 100644 Binary files a/pyflac/libraries/raspbian-armv6z/libFLAC-8.3.0.so and b/pyflac/libraries/raspbian-armv6z/libFLAC-8.3.0.so differ diff --git a/pyflac/libraries/raspbian-armv7a/libFLAC-8.3.0.so b/pyflac/libraries/raspbian-armv7a/libFLAC-8.3.0.so index b730034..e11f91b 100644 Binary files a/pyflac/libraries/raspbian-armv7a/libFLAC-8.3.0.so and b/pyflac/libraries/raspbian-armv7a/libFLAC-8.3.0.so differ diff --git a/pyflac/libraries/windows-i686/FLAC-8.lib b/pyflac/libraries/windows-i686/FLAC-8.lib index 3c2be8a..3b09a12 100644 Binary files a/pyflac/libraries/windows-i686/FLAC-8.lib and b/pyflac/libraries/windows-i686/FLAC-8.lib differ diff --git a/pyflac/libraries/windows-i686/libFLAC-8.dll b/pyflac/libraries/windows-i686/libFLAC-8.dll index 9c0893d..60a088d 100644 Binary files a/pyflac/libraries/windows-i686/libFLAC-8.dll and b/pyflac/libraries/windows-i686/libFLAC-8.dll differ diff --git a/pyflac/libraries/windows-x86_64/FLAC-8.lib b/pyflac/libraries/windows-x86_64/FLAC-8.lib index e3dcab1..9737716 100644 Binary files a/pyflac/libraries/windows-x86_64/FLAC-8.lib and b/pyflac/libraries/windows-x86_64/FLAC-8.lib differ diff --git a/pyflac/libraries/windows-x86_64/libFLAC-8.dll b/pyflac/libraries/windows-x86_64/libFLAC-8.dll index 4e78118..fb694d6 100644 Binary files a/pyflac/libraries/windows-x86_64/libFLAC-8.dll and b/pyflac/libraries/windows-x86_64/libFLAC-8.dll differ diff --git a/setup.cfg b/setup.cfg index 9692d51..94b60b5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -description-file = README.rst +description_file = README.rst [build_sphinx] source-dir = docs @@ -10,4 +10,4 @@ all_files = 1 upload-dir = docs/_build/html [flake8] -max-line-length = 120 \ No newline at end of file +max-line-length = 120 diff --git a/setup.py b/setup.py index 31b9ff0..fad452a 100644 --- a/setup.py +++ b/setup.py @@ -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', @@ -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', ], ) diff --git a/tox.ini b/tox.ini index c9dc4c2..1aafdcc 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36, py37, py38, py39 +envlist = py37, py38, py39, py310 [testenv] deps = pytest==6.2.2