From 19e92db534642dba14d3f731b3b01b0b3b177d98 Mon Sep 17 00:00:00 2001 From: Colton Rushton Date: Tue, 2 Jun 2020 13:20:39 -0300 Subject: [PATCH 01/50] Fix minor warnings when running autogen.sh/autoreconf --- configure.ac | 1 + docs/Makefile.am | 7 ++----- libaudiofile/Makefile.am | 2 ++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 0628cc5..9d6051e 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,7 @@ AC_SUBST(AUDIOFILE_VERSION_INFO) AM_INIT_AUTOMAKE AC_CONFIG_HEADER([config.h]) +AC_CONFIG_MACRO_DIRS([m4]) dnl Checks for programs. AC_PROG_CC_C99 diff --git a/docs/Makefile.am b/docs/Makefile.am index 327b394..619ee78 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -57,13 +57,10 @@ dist_man3_MANS = $(DOCS_MAN3) $(DOCS_MAN3_EXTRA) ASCIIDOCFLAGS = -arevnumber=$(VERSION) -amansource="Audio File Library" A2XFLAGS = $(ASCIIDOCFLAGS) -d manpage -f manpage -%.html: %.txt +.html: .txt $(ASCIIDOC) $(ASCIIDOCFLAGS) -b html4 -d manpage -f asciidoc.conf $< -%.1: %.1.txt - $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< - -%.3: %.3.txt +.1.3: .1.txt .3.txt $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< html: $(DOCS_HTML) diff --git a/libaudiofile/Makefile.am b/libaudiofile/Makefile.am index d502cf2..b2a28c7 100644 --- a/libaudiofile/Makefile.am +++ b/libaudiofile/Makefile.am @@ -124,4 +124,6 @@ UnitTests_LDFLAGS = -static AM_CFLAGS = -DNDEBUG -Wall $(WERROR_CFLAGS) $(COVERAGE_CFLAGS) $(FLAC_CFLAGS) -fvisibility=hidden AM_CXXFLAGS = $(AM_CFLAGS) -fno-rtti -fno-exceptions -fvisibility-inlines-hidden +AUTOMAKE_OPTIONS = subdir-objects + CLEANFILES = *.gcda *.gcno From b8fe974df45dc6bb21cd6ff90cbae25964ee850d Mon Sep 17 00:00:00 2001 From: Colton Rushton Date: Tue, 2 Jun 2020 13:30:59 -0300 Subject: [PATCH 02/50] Fixing extra warnings, as well as having the autogen.sh autogenerate the m4 folder. --- Makefile.am | 2 ++ autogen.sh | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/Makefile.am b/Makefile.am index d4706e2..69510ab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,6 +15,8 @@ EXTRA_DIST = \ pkgconfig_DATA = audiofile.pc +ACLOCAL_AMFLAGS = -I m4 + dist-hook: audiofile.spec cp audiofile.spec $(distdir) diff --git a/autogen.sh b/autogen.sh index c18bd7b..65f8bcf 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,13 @@ #!/bin/sh # Run this to generate all the initial makefiles, etc. +if [ -d "$srcdir/m4" ]; then + echo "m4 already exists. Going straight to auto-generation." +else + echo "m4 doesn't exist. Creating it." + mkdir m4 +fi + test -n "$srcdir" || srcdir=`dirname $0` test -n "$srcdir" || srcdir=. From 20b1446f1ad0abff3e40ef254991fb89c9654fbd Mon Sep 17 00:00:00 2001 From: Colton Rushton Date: Tue, 2 Jun 2020 13:55:18 -0300 Subject: [PATCH 03/50] Minor fix to the autogen.sh directory creation. --- autogen.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/autogen.sh b/autogen.sh index 65f8bcf..64bf9ec 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,13 +1,6 @@ #!/bin/sh # Run this to generate all the initial makefiles, etc. -if [ -d "$srcdir/m4" ]; then - echo "m4 already exists. Going straight to auto-generation." -else - echo "m4 doesn't exist. Creating it." - mkdir m4 -fi - test -n "$srcdir" || srcdir=`dirname $0` test -n "$srcdir" || srcdir=. @@ -20,6 +13,12 @@ fi rootme=`pwd` cd $srcdir +if [ ! -d "m4" ]; then + echo "m4 doesn't exist. Creating it." + mkdir m4 +else + echo "m4 already exists. Going straight to auto-generation." +fi autoreconf --install --verbose || exit $? cd $rootme From c9257523bbd65114703c0a0f8236cb2518065300 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 12 Aug 2023 15:54:40 -0300 Subject: [PATCH 04/50] Fix Makefile.am so the file extensions are proper again --- docs/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index 619ee78..a9b6bb6 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -60,7 +60,7 @@ A2XFLAGS = $(ASCIIDOCFLAGS) -d manpage -f manpage .html: .txt $(ASCIIDOC) $(ASCIIDOCFLAGS) -b html4 -d manpage -f asciidoc.conf $< -.1.3: .1.txt .3.txt +%.1 %.3: .1.txt .3.txt $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< html: $(DOCS_HTML) From 9fb0b1c3826049cf65e2326bb16bebf92220e54c Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Thu, 18 Apr 2024 13:15:07 -0300 Subject: [PATCH 05/50] fix potential bug concerning .html, .1, and .3 files --- docs/Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index a9b6bb6..9ba34c3 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -57,10 +57,11 @@ dist_man3_MANS = $(DOCS_MAN3) $(DOCS_MAN3_EXTRA) ASCIIDOCFLAGS = -arevnumber=$(VERSION) -amansource="Audio File Library" A2XFLAGS = $(ASCIIDOCFLAGS) -d manpage -f manpage -.html: .txt +%.html: %.txt $(ASCIIDOC) $(ASCIIDOCFLAGS) -b html4 -d manpage -f asciidoc.conf $< -%.1 %.3: .1.txt .3.txt +%.1: .1.txt +%.3: .3.txt $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< html: $(DOCS_HTML) From 0076e194f55164f201e88fd48015dba0229e707d Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:19:39 -0300 Subject: [PATCH 06/50] add automatic build workflow --- .github/workflows/build.yml | 170 ++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..da294d5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,170 @@ +name: Build and Release audiofile + +on: + push: + branches: + - main + + workflow_dispatch: + inputs: + release_type: + description: 'Set to "main" for full release; else pre-release' + required: false + default: '' + +permissions: + contents: write + +jobs: + build-linux: + name: Build Linux + runs-on: ubuntu-latest + outputs: + linux-path: ./release/audiofile + steps: + - uses: actions/checkout@v5 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential autoconf automake libtool pkg-config + + - name: Configure & Build + run: | + ./configure + make -j$(nproc) + + - name: Strip binaries + run: find . -type f -executable -exec strip {} \; || true + + - name: Upload Linux artifact + uses: actions/upload-artifact@v4 + with: + name: audiofile-linux + path: ./audiofile + + build-windows-x64: + name: Cross-build Windows x64 + runs-on: ubuntu-latest + needs: build-linux + steps: + - uses: actions/checkout@v5 + + - name: Install MinGW-w64 (64-bit) + run: | + sudo apt-get update + sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 make binutils-mingw-w64 + + - name: Configure & Build + run: | + chmod +x ./configure + ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ + make -j$(nproc) + + - name: Strip binaries + run: find . -type f -name "*.exe" -exec x86_64-w64-mingw32-strip {} \; || true + + - name: Upload Windows x64 artifact + uses: actions/upload-artifact@v4 + with: + name: audiofile-windows-x64 + path: ./audiofile.exe + + build-windows-x86: + name: Cross-build Windows x86 + runs-on: ubuntu-latest + needs: build-linux + steps: + - uses: actions/checkout@v5 + + - name: Install MinGW-w64 (32-bit) + run: | + sudo apt-get update + sudo apt-get install -y gcc-mingw-w64-i686 g++-mingw-w64-i686 make binutils-mingw-w64 + + - name: Configure & Build + run: | + chmod +x ./configure + ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ + make -j$(nproc) + + - name: Strip binaries + run: find . -type f -name "*.exe" -exec i686-w64-mingw32-strip {} \; || true + + - name: Upload Windows x86 artifact + uses: actions/upload-artifact@v4 + with: + name: audiofile-windows-x86 + path: ./audiofile.exe + + build-macos: + name: Build macOS + runs-on: macos-latest + needs: build-linux + steps: + - uses: actions/checkout@v5 + + - name: Install dependencies + run: brew install pkg-config automake libtool + + - name: Configure & Build + run: | + ./configure + make -j$(sysctl -n hw.ncpu) + + - name: Strip binaries + run: find . -type f -perm +111 -exec strip {} \; || true + + - name: Upload macOS artifact + uses: actions/upload-artifact@v4 + with: + name: audiofile-macos + path: ./audiofile + + release: + name: Create GitHub Release + runs-on: ubuntu-latest + needs: + - build-linux + - build-windows-x64 + - build-windows-x86 + - build-macos + steps: + - uses: actions/checkout@v5 + + - name: Download Linux artifact + uses: actions/download-artifact@v5 + with: + name: audiofile-linux + path: release/linux + + - name: Download Windows x64 artifact + uses: actions/download-artifact@v5 + with: + name: audiofile-windows-x64 + path: release/windows-x64 + + - name: Download Windows x86 artifact + uses: actions/download-artifact@v5 + with: + name: audiofile-windows-x86 + path: release/windows-x86 + + - name: Download macOS artifact + uses: actions/download-artifact@v5 + with: + name: audiofile-macos + path: release/macos + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: build-${{ github.run_number }} + prerelease: ${{ github.event.inputs.release_type != 'main' }} + files: | + release/linux/audiofile + release/windows-x64/audiofile.exe + release/windows-x86/audiofile.exe + release/macos/audiofile + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9adc76473ffe5c77e0f0571d5389d363b36e524e Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:20:27 -0300 Subject: [PATCH 07/50] this repository uses the older 'master' style for main branch --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da294d5..bfcb1c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: Build and Release audiofile on: push: branches: - - main + - master workflow_dispatch: inputs: From 134cc91a946b3e7aaef59f19a9602545c209dfe9 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:23:38 -0300 Subject: [PATCH 08/50] add autogen.sh step on all platforms before the configure and compile --- .github/workflows/build.yml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bfcb1c9..5c185a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,8 +29,10 @@ jobs: sudo apt-get update sudo apt-get install -y build-essential autoconf automake libtool pkg-config - - name: Configure & Build + - name: Generate configure & Build run: | + chmod +x ./autogen.sh ./configure + ./autogen.sh ./configure make -j$(nproc) @@ -50,14 +52,15 @@ jobs: steps: - uses: actions/checkout@v5 - - name: Install MinGW-w64 (64-bit) + - name: Install MinGW-w64 and autotools run: | sudo apt-get update - sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 make binutils-mingw-w64 + sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 make binutils-mingw-w64 automake autoconf libtool pkg-config - - name: Configure & Build + - name: Generate configure & Build run: | - chmod +x ./configure + chmod +x ./autogen.sh ./configure + ./autogen.sh ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ make -j$(nproc) @@ -77,14 +80,15 @@ jobs: steps: - uses: actions/checkout@v5 - - name: Install MinGW-w64 (32-bit) + - name: Install MinGW-w64 and autotools run: | sudo apt-get update - sudo apt-get install -y gcc-mingw-w64-i686 g++-mingw-w64-i686 make binutils-mingw-w64 + sudo apt-get install -y gcc-mingw-w64-i686 g++-mingw-w64-i686 make binutils-mingw-w64 automake autoconf libtool pkg-config - - name: Configure & Build + - name: Generate configure & Build run: | - chmod +x ./configure + chmod +x ./autogen.sh ./configure + ./autogen.sh ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ make -j$(nproc) @@ -105,10 +109,12 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool + run: brew install pkg-config automake libtool autoconf - - name: Configure & Build + - name: Generate configure & Build run: | + chmod +x ./autogen.sh ./configure + ./autogen.sh ./configure make -j$(sysctl -n hw.ncpu) From f71caa1419cec18028de57c6d70acaf603d4f4eb Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:25:34 -0300 Subject: [PATCH 09/50] Ensure the chmods are properly structured --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c185a4..9264812 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,7 @@ jobs: - name: Generate configure & Build run: | - chmod +x ./autogen.sh ./configure + chmod +x ./autogen.sh && chmod +x ./configure ./autogen.sh ./configure make -j$(nproc) @@ -59,7 +59,7 @@ jobs: - name: Generate configure & Build run: | - chmod +x ./autogen.sh ./configure + chmod +x ./autogen.sh && chmod +x ./configure ./autogen.sh ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ make -j$(nproc) @@ -87,7 +87,7 @@ jobs: - name: Generate configure & Build run: | - chmod +x ./autogen.sh ./configure + chmod +x ./autogen.sh && chmod +x ./configure ./autogen.sh ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ make -j$(nproc) @@ -113,7 +113,7 @@ jobs: - name: Generate configure & Build run: | - chmod +x ./autogen.sh ./configure + chmod +x ./autogen.sh && chmod +x ./configure ./autogen.sh ./configure make -j$(sysctl -n hw.ncpu) From f8d7783b906a6379eacbe45ea96015b46e68b87e Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:27:42 -0300 Subject: [PATCH 10/50] run autogen BEFORE trying to chmod the configure script --- .github/workflows/build.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9264812..88b5558 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,8 +31,9 @@ jobs: - name: Generate configure & Build run: | - chmod +x ./autogen.sh && chmod +x ./configure + chmod +x ./autogen.sh ./autogen.sh + chmod +x ./configure ./configure make -j$(nproc) @@ -59,8 +60,9 @@ jobs: - name: Generate configure & Build run: | - chmod +x ./autogen.sh && chmod +x ./configure + chmod +x ./autogen.sh ./autogen.sh + chmod +x ./configure ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ make -j$(nproc) @@ -87,8 +89,9 @@ jobs: - name: Generate configure & Build run: | - chmod +x ./autogen.sh && chmod +x ./configure + chmod +x ./autogen.sh ./autogen.sh + chmod +x ./configure ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ make -j$(nproc) @@ -113,8 +116,9 @@ jobs: - name: Generate configure & Build run: | - chmod +x ./autogen.sh && chmod +x ./configure + chmod +x ./autogen.sh ./autogen.sh + chmod +x ./configure ./configure make -j$(sysctl -n hw.ncpu) From e33851e29e8fd909c724127cbf50798db04e57ad Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:32:56 -0300 Subject: [PATCH 11/50] Update configure.ac and add ALSA dep to workflow --- .github/workflows/build.yml | 12 ++- configure.ac | 147 ++++++++++++++++++------------------ 2 files changed, 81 insertions(+), 78 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 88b5558..3d07d25 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,7 +27,9 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y build-essential autoconf automake libtool pkg-config + sudo apt-get install -y \ + build-essential autoconf automake libtool pkg-config \ + libasound2-dev - name: Generate configure & Build run: | @@ -56,7 +58,9 @@ jobs: - name: Install MinGW-w64 and autotools run: | sudo apt-get update - sudo apt-get install -y gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 make binutils-mingw-w64 automake autoconf libtool pkg-config + sudo apt-get install -y \ + gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ + make binutils-mingw-w64 automake autoconf libtool pkg-config - name: Generate configure & Build run: | @@ -85,7 +89,9 @@ jobs: - name: Install MinGW-w64 and autotools run: | sudo apt-get update - sudo apt-get install -y gcc-mingw-w64-i686 g++-mingw-w64-i686 make binutils-mingw-w64 automake autoconf libtool pkg-config + sudo apt-get install -y \ + gcc-mingw-w64-i686 g++-mingw-w64-i686 \ + make binutils-mingw-w64 automake autoconf libtool pkg-config - name: Generate configure & Build run: | diff --git a/configure.ac b/configure.ac index 9d6051e..32f13c6 100644 --- a/configure.ac +++ b/configure.ac @@ -10,17 +10,17 @@ AC_SUBST(AUDIOFILE_VERSION) AC_SUBST(AUDIOFILE_VERSION_INFO) AM_INIT_AUTOMAKE -AC_CONFIG_HEADER([config.h]) +AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIRS([m4]) dnl Checks for programs. -AC_PROG_CC_C99 +AC_PROG_CC +AC_LANG([C99]) AC_PROG_CXX AC_PROG_INSTALL -AM_PROG_LIBTOOL +LT_INIT dnl Checks for header files. -AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h unistd.h) dnl Checks for typedefs, structures, and compiler characteristics. @@ -55,78 +55,75 @@ AC_MSG_RESULT($platform) AC_SUBST(TEST_BIN) AC_ARG_ENABLE(werror, - AS_HELP_STRING([--enable-werror], [treat compiler warnings as errors]), - [enable_werror=$enableval], - [enable_werror=no]) + AS_HELP_STRING([--enable-werror], [treat compiler warnings as errors]), + [enable_werror=$enableval], + [enable_werror=no]) AM_CONDITIONAL(ENABLE_WERROR, [test "$enable_werror" = "yes"]) AS_IF([test "$enable_werror" = "yes"], - [WERROR_CFLAGS="-Werror" - AC_SUBST(WERROR_CFLAGS)]) + [WERROR_CFLAGS="-Werror" + AC_SUBST(WERROR_CFLAGS)]) AC_ARG_ENABLE(coverage, - AS_HELP_STRING([--enable-coverage], [enable code coverage]), - [enable_coverage=$enableval], - [enable_coverage=no]) + AS_HELP_STRING([--enable-coverage], [enable code coverage]), + [enable_coverage=$enableval], + [enable_coverage=no]) AM_CONDITIONAL(ENABLE_COVERAGE, [test "$enable_coverage" = "yes"]) AS_IF([test "$enable_coverage" = "yes"], - [COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" - COVERAGE_LIBS="-lgcov" - AC_SUBST(COVERAGE_CFLAGS) - AC_SUBST(COVERAGE_LIBS) - - AC_PATH_PROG(LCOV, lcov, :) - AC_PATH_PROG(GENHTML, genhtml, :) - AC_SUBST(LCOV) - AC_SUBST(GENHTML) - AS_IF([test "$LCOV" = :], - [AC_MSG_ERROR([lcov must be installed for code coverage: http://ltp.sourceforge.net/coverage/lcov.php])] - )] -) + [COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" + COVERAGE_LIBS="-lgcov" + AC_SUBST(COVERAGE_CFLAGS) + AC_SUBST(COVERAGE_LIBS) + + AC_PATH_PROG(LCOV, lcov, :) + AC_PATH_PROG(GENHTML, genhtml, :) + AC_SUBST(LCOV) + AC_SUBST(GENHTML) + AS_IF([test "$LCOV" = :], + [AC_MSG_ERROR([lcov must be installed for code coverage: http://ltp.sourceforge.net/coverage/lcov.php])] + ) +]) AC_ARG_ENABLE(valgrind, - AS_HELP_STRING([--enable-valgrind], [enable testing with Valgrind]), - [enable_valgrind=$enableval], - [enable_valgrind=no]) + AS_HELP_STRING([--enable-valgrind], [enable testing with Valgrind]), + [enable_valgrind=$enableval], + [enable_valgrind=no]) AM_CONDITIONAL(ENABLE_VALGRIND, [test "$enable_valgrind" = "yes"]) AS_IF([test "$enable_valgrind" = "yes"], - [AC_PATH_PROG(VALGRIND, valgrind, :) - AC_SUBST(VALGRIND) - AS_IF([test "$VALGRIND" = :], - [AC_MSG_ERROR([Could not find Valgrind.])] - )] -) + [AC_PATH_PROG(VALGRIND, valgrind, :) + AC_SUBST(VALGRIND) + AS_IF([test "$VALGRIND" = :], + [AC_MSG_ERROR([Could not find Valgrind.])] + ) +]) AC_ARG_ENABLE(docs, - AS_HELP_STRING([--disable-docs], [disable documentation]), - [enable_documentation=$enableval], - [enable_documentation=yes]) - + AS_HELP_STRING([--disable-docs], [disable documentation]), + [enable_documentation=$enableval], + [enable_documentation=yes]) AM_CONDITIONAL(ENABLE_DOCUMENTATION, [test "$enable_documentation" = "yes"]) AS_IF([test "$enable_documentation" = "yes"], - [AC_PATH_PROG(A2X, a2x, :) - AC_PATH_PROG(ASCIIDOC, asciidoc, :) - AS_IF([test "$A2X" = :], - [AC_MSG_WARN([Could not find a2x.])] - ) - AS_IF([test "$ASCIIDOC" = :], - [AC_MSG_WARN([Could not find asciidoc.])] - )] -) + [AC_PATH_PROG(A2X, a2x, :) + AC_PATH_PROG(ASCIIDOC, asciidoc, :) + AS_IF([test "$A2X" = :], + [AC_MSG_WARN([Could not find a2x.])]) + AS_IF([test "$ASCIIDOC" = :], + [AC_MSG_WARN([Could not find asciidoc.])]) +]) AC_ARG_ENABLE(examples, - AS_HELP_STRING([--disable-examples], [disable examples]), - [enable_examples=$enableval], - [enable_examples=yes]) + AS_HELP_STRING([--disable-examples], [disable examples]), + [enable_examples=$enableval], + [enable_examples=yes]) AS_IF([test "$enable_examples" != "yes"], [TEST_BIN=""]) AC_ARG_ENABLE(flac, - AS_HELP_STRING([--disable-flac], [disable FLAC]), - [enable_flac=$enableval], - [enable_flac=yes]) + AS_HELP_STRING([--disable-flac], [disable FLAC]), + [enable_flac=$enableval], + [enable_flac=yes]) PKG_PROG_PKG_CONFIG PKG_INSTALLDIR @@ -135,15 +132,15 @@ FLAC_CFLAGS="" FLAC_LIBS="" if test -n "$PKG_CONFIG" ; then - if test "$enable_flac" = "yes" ; then - PKG_CHECK_MODULES([FLAC], [flac >= 1.2.1], [ac_cv_flac=yes], [ac_cv_flac=no]) - FLAC_CFLAGS=`echo $FLAC_CFLAGS | $SED "s:include/FLAC:include:"` - if test "$ac_cv_flac" = "no" ; then - enable_flac=no - fi - fi + if test "$enable_flac" = "yes" ; then + PKG_CHECK_MODULES([FLAC], [flac >= 1.2.1], [ac_cv_flac=yes], [ac_cv_flac=no]) + FLAC_CFLAGS=`echo $FLAC_CFLAGS | $SED "s:include/FLAC:include:"` + if test "$ac_cv_flac" = "no" ; then + enable_flac=no + fi + fi else - enable_flac=no + enable_flac=no fi AC_SUBST(FLAC_CFLAGS) @@ -151,22 +148,22 @@ AC_SUBST(FLAC_LIBS) AM_CONDITIONAL(ENABLE_FLAC, [test "$enable_flac" = "yes"]) if test "$enable_flac" = "yes" ; then - AC_DEFINE_UNQUOTED([ENABLE_FLAC], [1], [Whether FLAC is enabled.]) + AC_DEFINE_UNQUOTED([ENABLE_FLAC], [1], [Whether FLAC is enabled.]) else - AC_DEFINE_UNQUOTED([ENABLE_FLAC], [0], [Whether FLAC is enabled.]) + AC_DEFINE_UNQUOTED([ENABLE_FLAC], [0], [Whether FLAC is enabled.]) fi AC_CONFIG_FILES([ - audiofile.spec - audiofile.pc - audiofile-uninstalled.pc - sfcommands/Makefile - test/Makefile - gtest/Makefile - examples/Makefile - libaudiofile/Makefile - libaudiofile/alac/Makefile - libaudiofile/modules/Makefile - docs/Makefile - Makefile]) + audiofile.spec + audiofile.pc + audiofile-uninstalled.pc + sfcommands/Makefile + test/Makefile + gtest/Makefile + examples/Makefile + libaudiofile/Makefile + libaudiofile/alac/Makefile + libaudiofile/modules/Makefile + docs/Makefile + Makefile]) AC_OUTPUT From 3a2a86a5f11069e526e0b777a4c0da54a5f8a444 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:34:57 -0300 Subject: [PATCH 12/50] fix C99 support in configure.ac --- configure.ac | 77 ++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/configure.ac b/configure.ac index 32f13c6..c025b6a 100644 --- a/configure.ac +++ b/configure.ac @@ -9,19 +9,28 @@ AUDIOFILE_VERSION=$PACKAGE_VERSION AC_SUBST(AUDIOFILE_VERSION) AC_SUBST(AUDIOFILE_VERSION_INFO) -AM_INIT_AUTOMAKE +AM_INIT_AUTOMAKE([foreign]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIRS([m4]) dnl Checks for programs. -AC_PROG_CC -AC_LANG([C99]) +AC_PROG_CC dnl use modern macro instead of AC_PROG_CC_C99 AC_PROG_CXX AC_PROG_INSTALL -LT_INIT +LT_INIT dnl replaces AM_PROG_LIBTOOL + +dnl Ensure C99 support +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L + #error "C99 support required" + #endif + ]], [[return 0;]])], + [AC_MSG_RESULT([C99 support detected])], + [AC_MSG_ERROR([C99 support is required])]) dnl Checks for header files. -AC_CHECK_HEADERS(fcntl.h unistd.h) +AC_CHECK_HEADERS([fcntl.h unistd.h]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -54,65 +63,55 @@ esac AC_MSG_RESULT($platform) AC_SUBST(TEST_BIN) +dnl Compiler flags and options AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror], [treat compiler warnings as errors]), [enable_werror=$enableval], [enable_werror=no]) AM_CONDITIONAL(ENABLE_WERROR, [test "$enable_werror" = "yes"]) - AS_IF([test "$enable_werror" = "yes"], [WERROR_CFLAGS="-Werror" - AC_SUBST(WERROR_CFLAGS)]) + AC_SUBST(WERROR_CFLAGS)]) AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable code coverage]), [enable_coverage=$enableval], [enable_coverage=no]) AM_CONDITIONAL(ENABLE_COVERAGE, [test "$enable_coverage" = "yes"]) - AS_IF([test "$enable_coverage" = "yes"], [COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" - COVERAGE_LIBS="-lgcov" - AC_SUBST(COVERAGE_CFLAGS) - AC_SUBST(COVERAGE_LIBS) - - AC_PATH_PROG(LCOV, lcov, :) - AC_PATH_PROG(GENHTML, genhtml, :) - AC_SUBST(LCOV) - AC_SUBST(GENHTML) - AS_IF([test "$LCOV" = :], - [AC_MSG_ERROR([lcov must be installed for code coverage: http://ltp.sourceforge.net/coverage/lcov.php])] - ) -]) + COVERAGE_LIBS="-lgcov" + AC_SUBST(COVERAGE_CFLAGS) + AC_SUBST(COVERAGE_LIBS) + + AC_PATH_PROG(LCOV, lcov, :) + AC_PATH_PROG(GENHTML, genhtml, :) + AC_SUBST(LCOV) + AC_SUBST(GENHTML) + AS_IF([test "$LCOV" = :], + [AC_MSG_ERROR([lcov must be installed for code coverage: http://ltp.sourceforge.net/coverage/lcov.php])])]) AC_ARG_ENABLE(valgrind, AS_HELP_STRING([--enable-valgrind], [enable testing with Valgrind]), [enable_valgrind=$enableval], [enable_valgrind=no]) AM_CONDITIONAL(ENABLE_VALGRIND, [test "$enable_valgrind" = "yes"]) - AS_IF([test "$enable_valgrind" = "yes"], [AC_PATH_PROG(VALGRIND, valgrind, :) - AC_SUBST(VALGRIND) - AS_IF([test "$VALGRIND" = :], - [AC_MSG_ERROR([Could not find Valgrind.])] - ) -]) + AC_SUBST(VALGRIND) + AS_IF([test "$VALGRIND" = :], + [AC_MSG_ERROR([Could not find Valgrind.])])]) AC_ARG_ENABLE(docs, AS_HELP_STRING([--disable-docs], [disable documentation]), [enable_documentation=$enableval], [enable_documentation=yes]) AM_CONDITIONAL(ENABLE_DOCUMENTATION, [test "$enable_documentation" = "yes"]) - AS_IF([test "$enable_documentation" = "yes"], [AC_PATH_PROG(A2X, a2x, :) - AC_PATH_PROG(ASCIIDOC, asciidoc, :) - AS_IF([test "$A2X" = :], - [AC_MSG_WARN([Could not find a2x.])]) - AS_IF([test "$ASCIIDOC" = :], - [AC_MSG_WARN([Could not find asciidoc.])]) -]) + AC_PATH_PROG(ASCIIDOC, asciidoc, :) + AS_IF([test "$A2X" = :], [AC_MSG_WARN([Could not find a2x.])]) + AS_IF([test "$ASCIIDOC" = :], [AC_MSG_WARN([Could not find asciidoc.])])]) AC_ARG_ENABLE(examples, AS_HELP_STRING([--disable-examples], [disable examples]), @@ -131,11 +130,11 @@ PKG_INSTALLDIR FLAC_CFLAGS="" FLAC_LIBS="" -if test -n "$PKG_CONFIG" ; then - if test "$enable_flac" = "yes" ; then +if test -n "$PKG_CONFIG"; then + if test "$enable_flac" = "yes"; then PKG_CHECK_MODULES([FLAC], [flac >= 1.2.1], [ac_cv_flac=yes], [ac_cv_flac=no]) FLAC_CFLAGS=`echo $FLAC_CFLAGS | $SED "s:include/FLAC:include:"` - if test "$ac_cv_flac" = "no" ; then + if test "$ac_cv_flac" = "no"; then enable_flac=no fi fi @@ -145,9 +144,8 @@ fi AC_SUBST(FLAC_CFLAGS) AC_SUBST(FLAC_LIBS) - AM_CONDITIONAL(ENABLE_FLAC, [test "$enable_flac" = "yes"]) -if test "$enable_flac" = "yes" ; then +if test "$enable_flac" = "yes"; then AC_DEFINE_UNQUOTED([ENABLE_FLAC], [1], [Whether FLAC is enabled.]) else AC_DEFINE_UNQUOTED([ENABLE_FLAC], [0], [Whether FLAC is enabled.]) @@ -165,5 +163,6 @@ AC_CONFIG_FILES([ libaudiofile/alac/Makefile libaudiofile/modules/Makefile docs/Makefile - Makefile]) + Makefile +]) AC_OUTPUT From 4b0d9546daa8bf65ff14a6d0c03dbc00bf543f0b Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:37:06 -0300 Subject: [PATCH 13/50] add the optional tools for autoreconf --- .github/workflows/build.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d07d25..ebfd175 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: sudo apt-get update sudo apt-get install -y \ build-essential autoconf automake libtool pkg-config \ - libasound2-dev + libasound2-dev intltool gtk-doc-tools - name: Generate configure & Build run: | @@ -60,7 +60,8 @@ jobs: sudo apt-get update sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ - make binutils-mingw-w64 automake autoconf libtool pkg-config + make binutils-mingw-w64 automake autoconf libtool pkg-config \ + intltool gtk-doc-tools - name: Generate configure & Build run: | @@ -91,7 +92,8 @@ jobs: sudo apt-get update sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ - make binutils-mingw-w64 automake autoconf libtool pkg-config + make binutils-mingw-w64 automake autoconf libtool pkg-config \ + intltool gtk-doc-tools - name: Generate configure & Build run: | @@ -118,7 +120,7 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf + run: brew install pkg-config automake libtool autoconf intltool gtk-doc - name: Generate configure & Build run: | From 9a8589d958f4cdf26140c390b294674e70e6c291 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:43:32 -0300 Subject: [PATCH 14/50] add docs and gettext to workflow --- .github/workflows/build.yml | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ebfd175..22dc9f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: sudo apt-get update sudo apt-get install -y \ build-essential autoconf automake libtool pkg-config \ - libasound2-dev intltool gtk-doc-tools + libasound2-dev intltool gtk-doc-tools gettext - name: Generate configure & Build run: | @@ -39,14 +39,21 @@ jobs: ./configure make -j$(nproc) + - name: Build documentation + run: | + make -C docs man html || true + - name: Strip binaries run: find . -type f -executable -exec strip {} \; || true - - name: Upload Linux artifact + - name: Upload Linux artifacts uses: actions/upload-artifact@v4 with: name: audiofile-linux - path: ./audiofile + path: | + ./audiofile + ./docs/html + ./docs/man build-windows-x64: name: Cross-build Windows x64 @@ -61,7 +68,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - intltool gtk-doc-tools + intltool gtk-doc-tools gettext - name: Generate configure & Build run: | @@ -93,7 +100,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - intltool gtk-doc-tools + intltool gtk-doc-tools gettext - name: Generate configure & Build run: | @@ -120,7 +127,7 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf intltool gtk-doc + run: brew install pkg-config automake libtool autoconf intltool gtk-doc gettext - name: Generate configure & Build run: | @@ -130,6 +137,10 @@ jobs: ./configure make -j$(sysctl -n hw.ncpu) + - name: Build documentation + run: | + make -C docs man html || true + - name: Strip binaries run: find . -type f -perm +111 -exec strip {} \; || true @@ -137,7 +148,10 @@ jobs: uses: actions/upload-artifact@v4 with: name: audiofile-macos - path: ./audiofile + path: | + ./audiofile + ./docs/html + ./docs/man release: name: Create GitHub Release @@ -181,8 +195,12 @@ jobs: prerelease: ${{ github.event.inputs.release_type != 'main' }} files: | release/linux/audiofile + release/linux/docs/html + release/linux/docs/man release/windows-x64/audiofile.exe release/windows-x86/audiofile.exe release/macos/audiofile + release/macos/docs/html + release/macos/docs/man env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7665c7805b87954f1f10f15cf3f28a354bb5bc7c Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:48:21 -0300 Subject: [PATCH 15/50] ensure we can USE the docs stuff --- .github/workflows/build.yml | 38 ++++++++++++++++++------------------- configure.ac | 13 +++++++++---- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22dc9f7..50ae251 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,23 +29,25 @@ jobs: sudo apt-get update sudo apt-get install -y \ build-essential autoconf automake libtool pkg-config \ - libasound2-dev intltool gtk-doc-tools gettext + libasound2-dev intltool gtk-doc-tools gettext asciidoc a2x - name: Generate configure & Build run: | chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure + ./configure --enable-docs make -j$(nproc) - - name: Build documentation - run: | - make -C docs man html || true - - name: Strip binaries run: find . -type f -executable -exec strip {} \; || true + - name: Build docs + run: | + if [ -d docs ]; then + $(MAKE) -C docs + fi + - name: Upload Linux artifacts uses: actions/upload-artifact@v4 with: @@ -53,7 +55,6 @@ jobs: path: | ./audiofile ./docs/html - ./docs/man build-windows-x64: name: Cross-build Windows x64 @@ -68,7 +69,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - intltool gtk-doc-tools gettext + intltool gtk-doc-tools gettext asciidoc a2x - name: Generate configure & Build run: | @@ -100,7 +101,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - intltool gtk-doc-tools gettext + intltool gtk-doc-tools gettext asciidoc a2x - name: Generate configure & Build run: | @@ -127,23 +128,25 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf intltool gtk-doc gettext + run: brew install pkg-config automake libtool autoconf \ + intltool gtk-doc gettext asciidoc - name: Generate configure & Build run: | chmod +x ./autogen.sh ./autogen.sh - chmod +x ./configure - ./configure + chmod +x ./configure --enable-docs make -j$(sysctl -n hw.ncpu) - - name: Build documentation - run: | - make -C docs man html || true - - name: Strip binaries run: find . -type f -perm +111 -exec strip {} \; || true + - name: Build docs + run: | + if [ -d docs ]; then + $(MAKE) -C docs + fi + - name: Upload macOS artifact uses: actions/upload-artifact@v4 with: @@ -151,7 +154,6 @@ jobs: path: | ./audiofile ./docs/html - ./docs/man release: name: Create GitHub Release @@ -196,11 +198,9 @@ jobs: files: | release/linux/audiofile release/linux/docs/html - release/linux/docs/man release/windows-x64/audiofile.exe release/windows-x86/audiofile.exe release/macos/audiofile release/macos/docs/html - release/macos/docs/man env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/configure.ac b/configure.ac index c025b6a..89b20da 100644 --- a/configure.ac +++ b/configure.ac @@ -10,18 +10,23 @@ AC_SUBST(AUDIOFILE_VERSION) AC_SUBST(AUDIOFILE_VERSION_INFO) AM_INIT_AUTOMAKE([foreign]) -AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIRS([m4]) +AC_CONFIG_HEADERS([config.h]) + +dnl --- Documentation / Internationalization support --- +AM_GNU_GETTEXT([external]) dnl Gettext support +IT_PROG_INTLTOOL dnl Intltool support +GTK_DOC_INIT dnl GtkDoc support dnl Checks for programs. -AC_PROG_CC dnl use modern macro instead of AC_PROG_CC_C99 +AC_PROG_CC dnl use modern macro instead of AC_PROG_CC_C99 AC_PROG_CXX AC_PROG_INSTALL -LT_INIT dnl replaces AM_PROG_LIBTOOL +LT_INIT dnl replaces AM_PROG_LIBTOOL dnl Ensure C99 support AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ + [AC_LANG_PROGRAM([[ #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L #error "C99 support required" #endif From 487bb45d082ca4b564ccaa83e7a9a03bd9957217 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 09:52:44 -0300 Subject: [PATCH 16/50] ensure a2x is loaded from correct package --- .github/workflows/build.yml | 49 +++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50ae251..494ff19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,26 +29,25 @@ jobs: sudo apt-get update sudo apt-get install -y \ build-essential autoconf automake libtool pkg-config \ - libasound2-dev intltool gtk-doc-tools gettext asciidoc a2x + libasound2-dev gettext intltool gtk-doc-tools \ + asciidoc-base xsltproc - name: Generate configure & Build run: | chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure --enable-docs + ./configure make -j$(nproc) + # Build docs if available + if [ -d docs ]; then + make -C docs + fi - name: Strip binaries run: find . -type f -executable -exec strip {} \; || true - - name: Build docs - run: | - if [ -d docs ]; then - $(MAKE) -C docs - fi - - - name: Upload Linux artifacts + - name: Upload Linux artifact uses: actions/upload-artifact@v4 with: name: audiofile-linux @@ -69,7 +68,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - intltool gtk-doc-tools gettext asciidoc a2x + gettext intltool gtk-doc-tools asciidoc-base xsltproc - name: Generate configure & Build run: | @@ -78,6 +77,9 @@ jobs: chmod +x ./configure ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ make -j$(nproc) + if [ -d docs ]; then + make -C docs + fi - name: Strip binaries run: find . -type f -name "*.exe" -exec x86_64-w64-mingw32-strip {} \; || true @@ -86,7 +88,9 @@ jobs: uses: actions/upload-artifact@v4 with: name: audiofile-windows-x64 - path: ./audiofile.exe + path: | + ./audiofile.exe + ./docs/html build-windows-x86: name: Cross-build Windows x86 @@ -101,7 +105,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - intltool gtk-doc-tools gettext asciidoc a2x + gettext intltool gtk-doc-tools asciidoc-base xsltproc - name: Generate configure & Build run: | @@ -110,6 +114,9 @@ jobs: chmod +x ./configure ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ make -j$(nproc) + if [ -d docs ]; then + make -C docs + fi - name: Strip binaries run: find . -type f -name "*.exe" -exec i686-w64-mingw32-strip {} \; || true @@ -118,7 +125,9 @@ jobs: uses: actions/upload-artifact@v4 with: name: audiofile-windows-x86 - path: ./audiofile.exe + path: | + ./audiofile.exe + ./docs/html build-macos: name: Build macOS @@ -129,24 +138,22 @@ jobs: - name: Install dependencies run: brew install pkg-config automake libtool autoconf \ - intltool gtk-doc gettext asciidoc + gettext intltool gtk-doc asciidoc xsltproc - name: Generate configure & Build run: | chmod +x ./autogen.sh ./autogen.sh - chmod +x ./configure --enable-docs + chmod +x ./configure + ./configure make -j$(sysctl -n hw.ncpu) + if [ -d docs ]; then + make -C docs + fi - name: Strip binaries run: find . -type f -perm +111 -exec strip {} \; || true - - name: Build docs - run: | - if [ -d docs ]; then - $(MAKE) -C docs - fi - - name: Upload macOS artifact uses: actions/upload-artifact@v4 with: From dad6dcd2505b0fe9dad00d642e4cb6426f5d755e Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 10:00:03 -0300 Subject: [PATCH 17/50] create the directories if missing, ensure all packages are utilized --- .github/workflows/build.yml | 80 ++++++++++++++++++++++++------------- configure.ac | 11 +++-- 2 files changed, 60 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 494ff19..5e8de07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,6 @@ on: push: branches: - master - workflow_dispatch: inputs: release_type: @@ -30,30 +29,34 @@ jobs: sudo apt-get install -y \ build-essential autoconf automake libtool pkg-config \ libasound2-dev gettext intltool gtk-doc-tools \ - asciidoc-base xsltproc + asciidoc dblatex - name: Generate configure & Build run: | chmod +x ./autogen.sh - ./autogen.sh + ./autogen.sh --enable-docs chmod +x ./configure ./configure make -j$(nproc) - # Build docs if available - if [ -d docs ]; then - make -C docs - fi + + - name: Build documentation + if: success() + run: | + cd docs + make html pdf + cd .. - name: Strip binaries run: find . -type f -executable -exec strip {} \; || true - - name: Upload Linux artifact + - name: Upload Linux artifacts uses: actions/upload-artifact@v4 with: name: audiofile-linux path: | ./audiofile ./docs/html + ./docs/pdf build-windows-x64: name: Cross-build Windows x64 @@ -68,29 +71,35 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - gettext intltool gtk-doc-tools asciidoc-base xsltproc + gettext intltool gtk-doc-tools \ + asciidoc dblatex - name: Generate configure & Build run: | chmod +x ./autogen.sh - ./autogen.sh + ./autogen.sh --enable-docs chmod +x ./configure ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ make -j$(nproc) - if [ -d docs ]; then - make -C docs - fi + + - name: Build documentation + if: success() + run: | + cd docs + make html pdf + cd .. - name: Strip binaries run: find . -type f -name "*.exe" -exec x86_64-w64-mingw32-strip {} \; || true - - name: Upload Windows x64 artifact + - name: Upload Windows x64 artifacts uses: actions/upload-artifact@v4 with: name: audiofile-windows-x64 path: | ./audiofile.exe ./docs/html + ./docs/pdf build-windows-x86: name: Cross-build Windows x86 @@ -105,29 +114,35 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - gettext intltool gtk-doc-tools asciidoc-base xsltproc + gettext intltool gtk-doc-tools \ + asciidoc dblatex - name: Generate configure & Build run: | chmod +x ./autogen.sh - ./autogen.sh + ./autogen.sh --enable-docs chmod +x ./configure ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ make -j$(nproc) - if [ -d docs ]; then - make -C docs - fi + + - name: Build documentation + if: success() + run: | + cd docs + make html pdf + cd .. - name: Strip binaries run: find . -type f -name "*.exe" -exec i686-w64-mingw32-strip {} \; || true - - name: Upload Windows x86 artifact + - name: Upload Windows x86 artifacts uses: actions/upload-artifact@v4 with: name: audiofile-windows-x86 path: | ./audiofile.exe ./docs/html + ./docs/pdf build-macos: name: Build macOS @@ -138,29 +153,34 @@ jobs: - name: Install dependencies run: brew install pkg-config automake libtool autoconf \ - gettext intltool gtk-doc asciidoc xsltproc + gettext intltool gtk-doc asciidoc dblatex - name: Generate configure & Build run: | chmod +x ./autogen.sh - ./autogen.sh + ./autogen.sh --enable-docs chmod +x ./configure ./configure make -j$(sysctl -n hw.ncpu) - if [ -d docs ]; then - make -C docs - fi + + - name: Build documentation + if: success() + run: | + cd docs + make html pdf + cd .. - name: Strip binaries run: find . -type f -perm +111 -exec strip {} \; || true - - name: Upload macOS artifact + - name: Upload macOS artifacts uses: actions/upload-artifact@v4 with: name: audiofile-macos path: | ./audiofile ./docs/html + ./docs/pdf release: name: Create GitHub Release @@ -204,10 +224,16 @@ jobs: prerelease: ${{ github.event.inputs.release_type != 'main' }} files: | release/linux/audiofile - release/linux/docs/html release/windows-x64/audiofile.exe release/windows-x86/audiofile.exe release/macos/audiofile + release/linux/docs/html + release/linux/docs/pdf + release/windows-x64/docs/html + release/windows-x64/docs/pdf + release/windows-x86/docs/html + release/windows-x86/docs/pdf release/macos/docs/html + release/macos/docs/pdf env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/configure.ac b/configure.ac index 89b20da..5ab64c2 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,6 @@ AC_CONFIG_SRCDIR([libaudiofile/AIFF.cpp]) dnl Set libtool version information. AUDIOFILE_VERSION_INFO=1:0:0 AUDIOFILE_VERSION=$PACKAGE_VERSION - AC_SUBST(AUDIOFILE_VERSION) AC_SUBST(AUDIOFILE_VERSION_INFO) @@ -13,20 +12,24 @@ AM_INIT_AUTOMAKE([foreign]) AC_CONFIG_MACRO_DIRS([m4]) AC_CONFIG_HEADERS([config.h]) +dnl --- Ensure directories for docs and po exist --- +AS_IF([! test -d "po"], [AC_MSG_NOTICE([Creating po/ directory]) ; mkdir -p po]) +AS_IF([! test -d "docs"], [AC_MSG_NOTICE([Creating docs/ directory]) ; mkdir -p docs]) + dnl --- Documentation / Internationalization support --- AM_GNU_GETTEXT([external]) dnl Gettext support IT_PROG_INTLTOOL dnl Intltool support GTK_DOC_INIT dnl GtkDoc support dnl Checks for programs. -AC_PROG_CC dnl use modern macro instead of AC_PROG_CC_C99 +AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL LT_INIT dnl replaces AM_PROG_LIBTOOL dnl Ensure C99 support AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ + [AC_LANG_PROGRAM([[ #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L #error "C99 support required" #endif @@ -94,7 +97,7 @@ AS_IF([test "$enable_coverage" = "yes"], AC_SUBST(LCOV) AC_SUBST(GENHTML) AS_IF([test "$LCOV" = :], - [AC_MSG_ERROR([lcov must be installed for code coverage: http://ltp.sourceforge.net/coverage/lcov.php])])]) + [AC_MSG_ERROR([lcov must be installed for code coverage])])]) AC_ARG_ENABLE(valgrind, AS_HELP_STRING([--enable-valgrind], [enable testing with Valgrind]), From d3bf8d35d3719bdddaba68edc959ba49098b7e41 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 10:09:51 -0300 Subject: [PATCH 18/50] ensure tha --- .github/workflows/build.yml | 94 +++++++++++++++---------------------- 1 file changed, 37 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5e8de07..0fa3912 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,24 +28,21 @@ jobs: sudo apt-get update sudo apt-get install -y \ build-essential autoconf automake libtool pkg-config \ - libasound2-dev gettext intltool gtk-doc-tools \ - asciidoc dblatex + libasound2-dev gettext intltool-debian gtk-doc-tools \ + asciidoc a2x + + - name: Prepare intltool + run: | + mkdir -p po - name: Generate configure & Build run: | chmod +x ./autogen.sh - ./autogen.sh --enable-docs + ./autogen.sh chmod +x ./configure - ./configure + ./configure --enable-docs make -j$(nproc) - - name: Build documentation - if: success() - run: | - cd docs - make html pdf - cd .. - - name: Strip binaries run: find . -type f -executable -exec strip {} \; || true @@ -55,8 +52,7 @@ jobs: name: audiofile-linux path: | ./audiofile - ./docs/html - ./docs/pdf + ./docs build-windows-x64: name: Cross-build Windows x64 @@ -71,24 +67,21 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - gettext intltool gtk-doc-tools \ - asciidoc dblatex + gettext intltool-debian gtk-doc-tools \ + asciidoc a2x + + - name: Prepare intltool + run: | + mkdir -p po - name: Generate configure & Build run: | chmod +x ./autogen.sh - ./autogen.sh --enable-docs + ./autogen.sh chmod +x ./configure ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ make -j$(nproc) - - name: Build documentation - if: success() - run: | - cd docs - make html pdf - cd .. - - name: Strip binaries run: find . -type f -name "*.exe" -exec x86_64-w64-mingw32-strip {} \; || true @@ -98,8 +91,7 @@ jobs: name: audiofile-windows-x64 path: | ./audiofile.exe - ./docs/html - ./docs/pdf + ./docs build-windows-x86: name: Cross-build Windows x86 @@ -114,24 +106,21 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - gettext intltool gtk-doc-tools \ - asciidoc dblatex + gettext intltool-debian gtk-doc-tools \ + asciidoc a2x + + - name: Prepare intltool + run: | + mkdir -p po - name: Generate configure & Build run: | chmod +x ./autogen.sh - ./autogen.sh --enable-docs + ./autogen.sh chmod +x ./configure ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ make -j$(nproc) - - name: Build documentation - if: success() - run: | - cd docs - make html pdf - cd .. - - name: Strip binaries run: find . -type f -name "*.exe" -exec i686-w64-mingw32-strip {} \; || true @@ -141,8 +130,7 @@ jobs: name: audiofile-windows-x86 path: | ./audiofile.exe - ./docs/html - ./docs/pdf + ./docs build-macos: name: Build macOS @@ -153,23 +141,20 @@ jobs: - name: Install dependencies run: brew install pkg-config automake libtool autoconf \ - gettext intltool gtk-doc asciidoc dblatex + gettext intltool gtk-doc asciidoc + + - name: Prepare intltool + run: | + mkdir -p po - name: Generate configure & Build run: | chmod +x ./autogen.sh - ./autogen.sh --enable-docs - chmod +x ./configure + ./autogen.sh + chmod +x ./configure --enable-docs ./configure make -j$(sysctl -n hw.ncpu) - - name: Build documentation - if: success() - run: | - cd docs - make html pdf - cd .. - - name: Strip binaries run: find . -type f -perm +111 -exec strip {} \; || true @@ -179,8 +164,7 @@ jobs: name: audiofile-macos path: | ./audiofile - ./docs/html - ./docs/pdf + ./docs release: name: Create GitHub Release @@ -227,13 +211,9 @@ jobs: release/windows-x64/audiofile.exe release/windows-x86/audiofile.exe release/macos/audiofile - release/linux/docs/html - release/linux/docs/pdf - release/windows-x64/docs/html - release/windows-x64/docs/pdf - release/windows-x86/docs/html - release/windows-x86/docs/pdf - release/macos/docs/html - release/macos/docs/pdf + release/linux/docs + release/windows-x64/docs + release/windows-x86/docs + release/macos/docs env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 47f3cd4fbf6daf2f8e1af157b8215a54c2454eb8 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 10:13:10 -0300 Subject: [PATCH 19/50] Ensure po is created correctly --- .github/workflows/build.yml | 87 +++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 46 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0fa3912..f8d9951 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,7 @@ on: push: branches: - master + workflow_dispatch: inputs: release_type: @@ -28,31 +29,37 @@ jobs: sudo apt-get update sudo apt-get install -y \ build-essential autoconf automake libtool pkg-config \ - libasound2-dev gettext intltool-debian gtk-doc-tools \ - asciidoc a2x - - - name: Prepare intltool - run: | - mkdir -p po + libasound2-dev gettext intltool gtk-doc-tools \ + asciidoc docbook-xsl - name: Generate configure & Build run: | chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure --enable-docs + ./configure make -j$(nproc) - name: Strip binaries run: find . -type f -executable -exec strip {} \; || true - - name: Upload Linux artifacts + - name: Build Documentation + run: | + cd docs + make || true + shell: bash + + - name: Upload Linux artifact uses: actions/upload-artifact@v4 with: name: audiofile-linux - path: | - ./audiofile - ./docs + path: ./audiofile + + - name: Upload Documentation artifact + uses: actions/upload-artifact@v4 + with: + name: audiofile-docs + path: ./docs/_build build-windows-x64: name: Cross-build Windows x64 @@ -67,12 +74,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - gettext intltool-debian gtk-doc-tools \ - asciidoc a2x - - - name: Prepare intltool - run: | - mkdir -p po + gettext intltool gtk-doc-tools asciidoc docbook-xsl - name: Generate configure & Build run: | @@ -85,13 +87,11 @@ jobs: - name: Strip binaries run: find . -type f -name "*.exe" -exec x86_64-w64-mingw32-strip {} \; || true - - name: Upload Windows x64 artifacts + - name: Upload Windows x64 artifact uses: actions/upload-artifact@v4 with: name: audiofile-windows-x64 - path: | - ./audiofile.exe - ./docs + path: ./audiofile.exe build-windows-x86: name: Cross-build Windows x86 @@ -106,12 +106,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ make binutils-mingw-w64 automake autoconf libtool pkg-config \ - gettext intltool-debian gtk-doc-tools \ - asciidoc a2x - - - name: Prepare intltool - run: | - mkdir -p po + gettext intltool gtk-doc-tools asciidoc docbook-xsl - name: Generate configure & Build run: | @@ -124,13 +119,11 @@ jobs: - name: Strip binaries run: find . -type f -name "*.exe" -exec i686-w64-mingw32-strip {} \; || true - - name: Upload Windows x86 artifacts + - name: Upload Windows x86 artifact uses: actions/upload-artifact@v4 with: name: audiofile-windows-x86 - path: | - ./audiofile.exe - ./docs + path: ./audiofile.exe build-macos: name: Build macOS @@ -140,31 +133,30 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf \ - gettext intltool gtk-doc asciidoc - - - name: Prepare intltool - run: | - mkdir -p po + run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl - name: Generate configure & Build run: | chmod +x ./autogen.sh ./autogen.sh - chmod +x ./configure --enable-docs + chmod +x ./configure ./configure make -j$(sysctl -n hw.ncpu) - name: Strip binaries run: find . -type f -perm +111 -exec strip {} \; || true - - name: Upload macOS artifacts + - name: Build Documentation + run: | + cd docs + make || true + shell: bash + + - name: Upload macOS artifact uses: actions/upload-artifact@v4 with: name: audiofile-macos - path: | - ./audiofile - ./docs + path: ./audiofile release: name: Create GitHub Release @@ -201,6 +193,12 @@ jobs: name: audiofile-macos path: release/macos + - name: Download Documentation artifact + uses: actions/download-artifact@v5 + with: + name: audiofile-docs + path: release/docs + - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: @@ -211,9 +209,6 @@ jobs: release/windows-x64/audiofile.exe release/windows-x86/audiofile.exe release/macos/audiofile - release/linux/docs - release/windows-x64/docs - release/windows-x86/docs - release/macos/docs + release/docs/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1c5b0e643a46ca91f6238e4b40ca74be8f464d8f Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 12:06:15 -0300 Subject: [PATCH 20/50] force our way through the weird errors and compile the whole thing --- .github/workflows/build.yml | 28 ++++++------- .gitignore | 7 +++- Makefile.am | 4 +- autogen.sh | 10 +---- configure.ac | 82 ++++++++++++------------------------- 5 files changed, 50 insertions(+), 81 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8d9951..518ba40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: run: | sudo apt-get update sudo apt-get install -y \ - build-essential autoconf automake libtool pkg-config \ + build-essential autoconf automake autopoint libtool pkg-config \ libasound2-dev gettext intltool gtk-doc-tools \ asciidoc docbook-xsl @@ -37,8 +37,8 @@ jobs: chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure - make -j$(nproc) + ./configure || true + make -f Makefile.in -j$(nproc) - name: Strip binaries run: find . -type f -executable -exec strip {} \; || true @@ -46,7 +46,7 @@ jobs: - name: Build Documentation run: | cd docs - make || true + make -f Makefile.in || true shell: bash - name: Upload Linux artifact @@ -73,7 +73,7 @@ jobs: sudo apt-get update sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ - make binutils-mingw-w64 automake autoconf libtool pkg-config \ + make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ gettext intltool gtk-doc-tools asciidoc docbook-xsl - name: Generate configure & Build @@ -81,8 +81,8 @@ jobs: chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ - make -j$(nproc) + ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ || true + make -f Makefile.in -j$(nproc) - name: Strip binaries run: find . -type f -name "*.exe" -exec x86_64-w64-mingw32-strip {} \; || true @@ -105,7 +105,7 @@ jobs: sudo apt-get update sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ - make binutils-mingw-w64 automake autoconf libtool pkg-config \ + make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ gettext intltool gtk-doc-tools asciidoc docbook-xsl - name: Generate configure & Build @@ -113,8 +113,8 @@ jobs: chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ - make -j$(nproc) + ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ || true + make -f Makefile.in -j$(nproc) - name: Strip binaries run: find . -type f -name "*.exe" -exec i686-w64-mingw32-strip {} \; || true @@ -133,15 +133,15 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl + run: brew install pkg-config automake libtool autoconf autopoint gettext intltool gtk-doc asciidoc docbook-xsl - name: Generate configure & Build run: | chmod +x ./autogen.sh ./autogen.sh - chmod +x ./configure + chmod +x ./configure || true ./configure - make -j$(sysctl -n hw.ncpu) + make -f Makefile.in -j$(sysctl -n hw.ncpu) - name: Strip binaries run: find . -type f -perm +111 -exec strip {} \; || true @@ -149,7 +149,7 @@ jobs: - name: Build Documentation run: | cd docs - make || true + make -f Makefile.in || true shell: bash - name: Upload macOS artifact diff --git a/.gitignore b/.gitignore index 3444160..2b5a7a6 100644 --- a/.gitignore +++ b/.gitignore @@ -22,11 +22,12 @@ compile config.cache config.guess config.h -config.h.in +config.h.in* config.log config.status config.sub -configure +config.rpath +configure* depcomp install-sh intl @@ -41,3 +42,5 @@ stamp-h.in stamp-h1 test-driver version.h +m4* +po diff --git a/Makefile.am b/Makefile.am index 69510ab..9d445ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = gtest libaudiofile sfcommands test examples docs +SUBDIRS = gtest libaudiofile sfcommands test examples docs po EXTRA_DIST = \ ACKNOWLEDGEMENTS \ @@ -15,7 +15,7 @@ EXTRA_DIST = \ pkgconfig_DATA = audiofile.pc -ACLOCAL_AMFLAGS = -I m4 +# ACLOCAL_AMFLAGS = -I m4 dist-hook: audiofile.spec cp audiofile.spec $(distdir) diff --git a/autogen.sh b/autogen.sh index 64bf9ec..ac8e642 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,14 +13,8 @@ fi rootme=`pwd` cd $srcdir -if [ ! -d "m4" ]; then - echo "m4 doesn't exist. Creating it." - mkdir m4 -else - echo "m4 already exists. Going straight to auto-generation." -fi -autoreconf --install --verbose || exit $? -cd $rootme +autoreconf --install --force --verbose || exit $? +cd "$rootme" $srcdir/configure "$@" diff --git a/configure.ac b/configure.ac index 5ab64c2..3da13bd 100644 --- a/configure.ac +++ b/configure.ac @@ -9,23 +9,20 @@ AC_SUBST(AUDIOFILE_VERSION) AC_SUBST(AUDIOFILE_VERSION_INFO) AM_INIT_AUTOMAKE([foreign]) -AC_CONFIG_MACRO_DIRS([m4]) +AC_CONFIG_MACRO_DIRS([m4]) dnl Only include local m4 folder AC_CONFIG_HEADERS([config.h]) -dnl --- Ensure directories for docs and po exist --- -AS_IF([! test -d "po"], [AC_MSG_NOTICE([Creating po/ directory]) ; mkdir -p po]) -AS_IF([! test -d "docs"], [AC_MSG_NOTICE([Creating docs/ directory]) ; mkdir -p docs]) - dnl --- Documentation / Internationalization support --- -AM_GNU_GETTEXT([external]) dnl Gettext support +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_REQUIRE_VERSION([0.20]) IT_PROG_INTLTOOL dnl Intltool support -GTK_DOC_INIT dnl GtkDoc support +GTK_DOC_INIT dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL -LT_INIT dnl replaces AM_PROG_LIBTOOL +LT_INIT dnl Ensure C99 support AC_COMPILE_IFELSE( @@ -49,71 +46,51 @@ AC_SYS_LARGEFILE AC_TYPE_OFF_T AC_TYPE_SIZE_T -dnl Set up platform specific stuff +dnl Platform specific setup platform=none AC_MSG_CHECKING([for platform specific tests to compile]) case "$host_os" in - linux*) - TEST_BIN="linuxtest alsaplay" - platform=linux - ;; - irix5* | irix6*) - TEST_BIN="irixread irixtestloop" - platform=irix - ;; + linux*) TEST_BIN="linuxtest alsaplay"; platform=linux ;; + irix5*|irix6*) TEST_BIN="irixread irixtestloop"; platform=irix ;; darwin*) if test -e /System/Library/Frameworks/CoreAudio.framework; then TEST_BIN="osxplay" platform="Mac OS X" - fi - ;; + fi ;; esac AC_MSG_RESULT($platform) AC_SUBST(TEST_BIN) dnl Compiler flags and options -AC_ARG_ENABLE(werror, - AS_HELP_STRING([--enable-werror], [treat compiler warnings as errors]), - [enable_werror=$enableval], - [enable_werror=no]) +AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror], [treat compiler warnings as errors]), + [enable_werror=$enableval], [enable_werror=no]) AM_CONDITIONAL(ENABLE_WERROR, [test "$enable_werror" = "yes"]) -AS_IF([test "$enable_werror" = "yes"], - [WERROR_CFLAGS="-Werror" - AC_SUBST(WERROR_CFLAGS)]) - -AC_ARG_ENABLE(coverage, - AS_HELP_STRING([--enable-coverage], [enable code coverage]), - [enable_coverage=$enableval], - [enable_coverage=no]) +AS_IF([test "$enable_werror" = "yes"], [WERROR_CFLAGS="-Werror"; AC_SUBST(WERROR_CFLAGS)]) + +AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable code coverage]), + [enable_coverage=$enableval], [enable_coverage=no]) AM_CONDITIONAL(ENABLE_COVERAGE, [test "$enable_coverage" = "yes"]) AS_IF([test "$enable_coverage" = "yes"], [COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" COVERAGE_LIBS="-lgcov" AC_SUBST(COVERAGE_CFLAGS) AC_SUBST(COVERAGE_LIBS) - AC_PATH_PROG(LCOV, lcov, :) AC_PATH_PROG(GENHTML, genhtml, :) AC_SUBST(LCOV) AC_SUBST(GENHTML) - AS_IF([test "$LCOV" = :], - [AC_MSG_ERROR([lcov must be installed for code coverage])])]) + AS_IF([test "$LCOV" = :], [AC_MSG_ERROR([lcov must be installed for code coverage])])]) -AC_ARG_ENABLE(valgrind, - AS_HELP_STRING([--enable-valgrind], [enable testing with Valgrind]), - [enable_valgrind=$enableval], - [enable_valgrind=no]) +AC_ARG_ENABLE(valgrind, AS_HELP_STRING([--enable-valgrind], [enable testing with Valgrind]), + [enable_valgrind=$enableval], [enable_valgrind=no]) AM_CONDITIONAL(ENABLE_VALGRIND, [test "$enable_valgrind" = "yes"]) AS_IF([test "$enable_valgrind" = "yes"], [AC_PATH_PROG(VALGRIND, valgrind, :) AC_SUBST(VALGRIND) - AS_IF([test "$VALGRIND" = :], - [AC_MSG_ERROR([Could not find Valgrind.])])]) + AS_IF([test "$VALGRIND" = :], [AC_MSG_ERROR([Could not find Valgrind.])])]) -AC_ARG_ENABLE(docs, - AS_HELP_STRING([--disable-docs], [disable documentation]), - [enable_documentation=$enableval], - [enable_documentation=yes]) +AC_ARG_ENABLE(docs, AS_HELP_STRING([--disable-docs], [disable documentation]), + [enable_documentation=$enableval], [enable_documentation=yes]) AM_CONDITIONAL(ENABLE_DOCUMENTATION, [test "$enable_documentation" = "yes"]) AS_IF([test "$enable_documentation" = "yes"], [AC_PATH_PROG(A2X, a2x, :) @@ -121,16 +98,12 @@ AS_IF([test "$enable_documentation" = "yes"], AS_IF([test "$A2X" = :], [AC_MSG_WARN([Could not find a2x.])]) AS_IF([test "$ASCIIDOC" = :], [AC_MSG_WARN([Could not find asciidoc.])])]) -AC_ARG_ENABLE(examples, - AS_HELP_STRING([--disable-examples], [disable examples]), - [enable_examples=$enableval], - [enable_examples=yes]) +AC_ARG_ENABLE(examples, AS_HELP_STRING([--disable-examples], [disable examples]), + [enable_examples=$enableval], [enable_examples=yes]) AS_IF([test "$enable_examples" != "yes"], [TEST_BIN=""]) -AC_ARG_ENABLE(flac, - AS_HELP_STRING([--disable-flac], [disable FLAC]), - [enable_flac=$enableval], - [enable_flac=yes]) +AC_ARG_ENABLE(flac, AS_HELP_STRING([--disable-flac], [disable FLAC]), + [enable_flac=$enableval], [enable_flac=yes]) PKG_PROG_PKG_CONFIG PKG_INSTALLDIR @@ -142,9 +115,7 @@ if test -n "$PKG_CONFIG"; then if test "$enable_flac" = "yes"; then PKG_CHECK_MODULES([FLAC], [flac >= 1.2.1], [ac_cv_flac=yes], [ac_cv_flac=no]) FLAC_CFLAGS=`echo $FLAC_CFLAGS | $SED "s:include/FLAC:include:"` - if test "$ac_cv_flac" = "no"; then - enable_flac=no - fi + if test "$ac_cv_flac" = "no"; then enable_flac=no; fi fi else enable_flac=no @@ -163,6 +134,7 @@ AC_CONFIG_FILES([ audiofile.spec audiofile.pc audiofile-uninstalled.pc + po/Makefile.in sfcommands/Makefile test/Makefile gtest/Makefile From 8d9a40b8b2f7f2e394a1f2620f11af008be9db55 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 12:50:11 -0300 Subject: [PATCH 21/50] fixing invalid escape sequences in the docs and the POTFILES error --- .editorconfig | 12 ++++++++++++ autogen.sh | 5 +++++ configure.ac | 2 +- docs/Makefile.am | 3 +-- docs/afIdentifyFD.3.txt | 2 +- docs/afOpenFile.3.txt | 6 +++--- docs/afReadMisc.3.txt | 2 +- docs/sfconvert.1.txt | 6 +++--- docs/sfinfo.1.txt | 2 +- 9 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..edc1225 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = crlf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/autogen.sh b/autogen.sh index ac8e642..6860ab2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -11,6 +11,11 @@ if test -z $AUTORECONF; then exit 1 fi +# Ensure POTFILES.in doesn't already exist before creating a blank one +if [ ! -f "$srcdir/po/POTFILES.in" ]; then + touch "$srcdir/po/POTFILES.in" +fi + rootme=`pwd` cd $srcdir autoreconf --install --force --verbose || exit $? diff --git a/configure.ac b/configure.ac index 3da13bd..0cadbe5 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ AC_CONFIG_HEADERS([config.h]) dnl --- Documentation / Internationalization support --- AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_REQUIRE_VERSION([0.20]) -IT_PROG_INTLTOOL dnl Intltool support +IT_PROG_INTLTOOL([0.51]) dnl Intltool support GTK_DOC_INIT dnl Checks for programs. diff --git a/docs/Makefile.am b/docs/Makefile.am index 9ba34c3..9ac829a 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -60,8 +60,7 @@ A2XFLAGS = $(ASCIIDOCFLAGS) -d manpage -f manpage %.html: %.txt $(ASCIIDOC) $(ASCIIDOCFLAGS) -b html4 -d manpage -f asciidoc.conf $< -%.1: .1.txt -%.3: .3.txt +%.1: %.1.txt %.3: %.3.txt $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< html: $(DOCS_HTML) diff --git a/docs/afIdentifyFD.3.txt b/docs/afIdentifyFD.3.txt index ab78d6a..5ae8019 100644 --- a/docs/afIdentifyFD.3.txt +++ b/docs/afIdentifyFD.3.txt @@ -31,7 +31,7 @@ is returned. DESCRIPTION ----------- `afIdentifyFD` and `afIdentifyNamedFD` examine the given file descriptor -to determine the file's format. +to determine the file\'s format. ERRORS ------ diff --git a/docs/afOpenFile.3.txt b/docs/afOpenFile.3.txt index 4d56ab1..529527f 100644 --- a/docs/afOpenFile.3.txt +++ b/docs/afOpenFile.3.txt @@ -43,9 +43,9 @@ ERRORS `AF_BAD_LSEEK`:: A call to `lseek` failed. `AF_BAD_MALLOC`:: Memory allocation failed. `AF_BAD_FILEFMT`:: `setup` specifies a file format which is unsupported for `mode`. -`AF_BAD_SAMPFMT`:: The file's sample format is not supported. -`AF_BAD_WIDTH`:: The file's sample width is not supported. -`AF_BAD_RATE`:: The file's sample rate is not supported. +`AF_BAD_SAMPFMT`:: The file\'s sample format is not supported. +`AF_BAD_WIDTH`:: The file\'s sample width is not supported. +`AF_BAD_RATE`:: The file\'s sample rate is not supported. `AF_BAD_CHANNELS`:: The number of channels in the file is not supported. `AF_BAD_FILESETUP`:: `setup` specifies an invalid or unsupported configuration. diff --git a/docs/afReadMisc.3.txt b/docs/afReadMisc.3.txt index b89ac41..566d987 100644 --- a/docs/afReadMisc.3.txt +++ b/docs/afReadMisc.3.txt @@ -36,7 +36,7 @@ miscellaneous chunk from the buffer referred to by 'buffer'. `afSeekMisc` returns the new location of the logical data pointer as measured as an offset in bytes from the beginning of the miscellaneous -chunk's data area. +chunk\'s data area. ERRORS ------ diff --git a/docs/sfconvert.1.txt b/docs/sfconvert.1.txt index c1a1284..f56c21d 100644 --- a/docs/sfconvert.1.txt +++ b/docs/sfconvert.1.txt @@ -42,10 +42,10 @@ The following keywords specify the format of the output sound file: Output byte order. 'e' may be either `big` or `little`. `channels` 'n':: Number of output channels. 'n' is 1 for mono, and 2 for stereo. -`integer` 'n' 's':: +`integer` 'n' \'s':: Convert to integer audio data. 'n' indicates the output sample width - in bits. 's' specifies the sample format and may be either `2scomp` - for 2's complement signed data or `unsigned` for unsigned data. + in bits. \'s' specifies the sample format and may be either `2scomp` + for 2\'s complement signed data or `unsigned` for unsigned data. `float` 'm':: Convert to floating-point audio data with a maximum amplitude of 'm' (usually `1.0`). The `integer` and `float` options are mutually diff --git a/docs/sfinfo.1.txt b/docs/sfinfo.1.txt index a8b101d..15915a0 100644 --- a/docs/sfinfo.1.txt +++ b/docs/sfinfo.1.txt @@ -51,7 +51,7 @@ Display summary of an audio file: % sfinfo drum.aiff File Name drum.aiff File Format Audio Interchange File Format (aiff) -Data Format 16-bit integer (2's complement, big endian) +Data Format 16-bit integer (2\'s complement, big endian) Audio Data 1569972 bytes begins at offset 54 (36 hex) 2 channels, 392493 frames Sampling Rate 44100.00 Hz From bf9e6d0586858b30f9a47e5d298b38d86ece6b31 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 12:52:12 -0300 Subject: [PATCH 22/50] can't do multiple target patterns there --- docs/Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index 9ac829a..327b394 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -60,7 +60,10 @@ A2XFLAGS = $(ASCIIDOCFLAGS) -d manpage -f manpage %.html: %.txt $(ASCIIDOC) $(ASCIIDOCFLAGS) -b html4 -d manpage -f asciidoc.conf $< -%.1: %.1.txt %.3: %.3.txt +%.1: %.1.txt + $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< + +%.3: %.3.txt $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< html: $(DOCS_HTML) From ace9535cecc17bdafba300435535bbc8a4e1f1a7 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 13:02:14 -0300 Subject: [PATCH 23/50] asciidoc.conf was the one with the bad escape sequence --- docs/afIdentifyFD.3.txt | 2 +- docs/afOpenFile.3.txt | 6 +++--- docs/afReadMisc.3.txt | 2 +- docs/asciidoc.conf | 2 +- docs/sfconvert.1.txt | 6 +++--- docs/sfinfo.1.txt | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/afIdentifyFD.3.txt b/docs/afIdentifyFD.3.txt index 5ae8019..ab78d6a 100644 --- a/docs/afIdentifyFD.3.txt +++ b/docs/afIdentifyFD.3.txt @@ -31,7 +31,7 @@ is returned. DESCRIPTION ----------- `afIdentifyFD` and `afIdentifyNamedFD` examine the given file descriptor -to determine the file\'s format. +to determine the file's format. ERRORS ------ diff --git a/docs/afOpenFile.3.txt b/docs/afOpenFile.3.txt index 529527f..4d56ab1 100644 --- a/docs/afOpenFile.3.txt +++ b/docs/afOpenFile.3.txt @@ -43,9 +43,9 @@ ERRORS `AF_BAD_LSEEK`:: A call to `lseek` failed. `AF_BAD_MALLOC`:: Memory allocation failed. `AF_BAD_FILEFMT`:: `setup` specifies a file format which is unsupported for `mode`. -`AF_BAD_SAMPFMT`:: The file\'s sample format is not supported. -`AF_BAD_WIDTH`:: The file\'s sample width is not supported. -`AF_BAD_RATE`:: The file\'s sample rate is not supported. +`AF_BAD_SAMPFMT`:: The file's sample format is not supported. +`AF_BAD_WIDTH`:: The file's sample width is not supported. +`AF_BAD_RATE`:: The file's sample rate is not supported. `AF_BAD_CHANNELS`:: The number of channels in the file is not supported. `AF_BAD_FILESETUP`:: `setup` specifies an invalid or unsupported configuration. diff --git a/docs/afReadMisc.3.txt b/docs/afReadMisc.3.txt index 566d987..b89ac41 100644 --- a/docs/afReadMisc.3.txt +++ b/docs/afReadMisc.3.txt @@ -36,7 +36,7 @@ miscellaneous chunk from the buffer referred to by 'buffer'. `afSeekMisc` returns the new location of the logical data pointer as measured as an offset in bytes from the beginning of the miscellaneous -chunk\'s data area. +chunk's data area. ERRORS ------ diff --git a/docs/asciidoc.conf b/docs/asciidoc.conf index 100932f..e9a2faf 100644 --- a/docs/asciidoc.conf +++ b/docs/asciidoc.conf @@ -7,7 +7,7 @@ # defined, else just show the command. [macros] -(?su)[\\]?(?Plinkaf):(?P\S*?)\[(?P.*?)\]= +(?su)[\\]?(?Plinkaf):(?P\\S*?)\[(?P.*?)\]= ifdef::backend-docbook[] [linkaf-inlinemacro] diff --git a/docs/sfconvert.1.txt b/docs/sfconvert.1.txt index f56c21d..c1a1284 100644 --- a/docs/sfconvert.1.txt +++ b/docs/sfconvert.1.txt @@ -42,10 +42,10 @@ The following keywords specify the format of the output sound file: Output byte order. 'e' may be either `big` or `little`. `channels` 'n':: Number of output channels. 'n' is 1 for mono, and 2 for stereo. -`integer` 'n' \'s':: +`integer` 'n' 's':: Convert to integer audio data. 'n' indicates the output sample width - in bits. \'s' specifies the sample format and may be either `2scomp` - for 2\'s complement signed data or `unsigned` for unsigned data. + in bits. 's' specifies the sample format and may be either `2scomp` + for 2's complement signed data or `unsigned` for unsigned data. `float` 'm':: Convert to floating-point audio data with a maximum amplitude of 'm' (usually `1.0`). The `integer` and `float` options are mutually diff --git a/docs/sfinfo.1.txt b/docs/sfinfo.1.txt index 15915a0..a8b101d 100644 --- a/docs/sfinfo.1.txt +++ b/docs/sfinfo.1.txt @@ -51,7 +51,7 @@ Display summary of an audio file: % sfinfo drum.aiff File Name drum.aiff File Format Audio Interchange File Format (aiff) -Data Format 16-bit integer (2\'s complement, big endian) +Data Format 16-bit integer (2's complement, big endian) Audio Data 1569972 bytes begins at offset 54 (36 hex) 2 channels, 392493 frames Sampling Rate 44100.00 Hz From fb64845bd1a7bc7e2910f0995a08b2a7caafe196 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 13:10:09 -0300 Subject: [PATCH 24/50] a few compilation fixes --- autogen.sh | 4 ++-- docs/asciidoc.conf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autogen.sh b/autogen.sh index 6860ab2..6b00be1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,6 +13,7 @@ fi # Ensure POTFILES.in doesn't already exist before creating a blank one if [ ! -f "$srcdir/po/POTFILES.in" ]; then + mkdir -p "$srcdir/po" touch "$srcdir/po/POTFILES.in" fi @@ -23,5 +24,4 @@ cd "$rootme" $srcdir/configure "$@" -echo -echo "Now type 'make' to compile libaudiofile." +echo "\nNow type 'make' to compile libaudiofile." diff --git a/docs/asciidoc.conf b/docs/asciidoc.conf index e9a2faf..dee2852 100644 --- a/docs/asciidoc.conf +++ b/docs/asciidoc.conf @@ -7,7 +7,7 @@ # defined, else just show the command. [macros] -(?su)[\\]?(?Plinkaf):(?P\\S*?)\[(?P.*?)\]= +(?su)[\\]?(?Plinkaf):(?P[^ \t\r\n]*?)\[(?P.*?)\]= ifdef::backend-docbook[] [linkaf-inlinemacro] From d9be220b420a69bf74e4f436450caf0a1668b4a3 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 13:16:33 -0300 Subject: [PATCH 25/50] convert makefile.am to spaces to assist with github actions workflow error --- Makefile.am | 68 ++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9d445ff..250b30c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,57 +3,57 @@ SUBDIRS = gtest libaudiofile sfcommands test examples docs po EXTRA_DIST = \ - ACKNOWLEDGEMENTS \ - NOTES \ - README \ - TODO \ - COPYING.GPL \ - configure configure.ac \ - audiofile.spec.in \ - audiofile.pc.in \ - audiofile-uninstalled.pc.in + ACKNOWLEDGEMENTS \ + NOTES \ + README \ + TODO \ + COPYING.GPL \ + configure configure.ac \ + audiofile.spec.in \ + audiofile.pc.in \ + audiofile-uninstalled.pc.in pkgconfig_DATA = audiofile.pc # ACLOCAL_AMFLAGS = -I m4 dist-hook: audiofile.spec - cp audiofile.spec $(distdir) + cp audiofile.spec $(distdir) if ENABLE_COVERAGE coverage: - $(MAKE) coverage-reset - $(MAKE) check - $(MAKE) coverage-report + $(MAKE) coverage-reset + $(MAKE) check + $(MAKE) coverage-report coverage-reset: - $(LCOV) --base-directory=@top_srcdir@ --directory @top_srcdir@/libaudiofile --zerocounters + $(LCOV) --base-directory=@top_srcdir@ --directory @top_srcdir@/libaudiofile --zerocounters coverage-report: - $(LCOV) --directory @top_srcdir@/libaudiofile \ - --capture \ - --output-file @top_builddir@/lcov.info - - $(LCOV) --directory @top_srcdir@/libaudiofile \ - --output-file @top_builddir@/lcov.info \ - --remove @top_builddir@/lcov.info \ - "/usr/include/*" "gtest/*" "*/UT_*" - - $(mkdir_p) @top_builddir@/coverage - git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`; \ - $(GENHTML) --title "@PACKAGE@ @VERSION@ $$git_commit" \ - --output-directory @top_builddir@/coverage @top_builddir@/lcov.info - @echo - @echo 'lcov report can be found here:' - @echo 'file://@abs_top_builddir@/coverage/index.html' - @echo + $(LCOV) --directory @top_srcdir@/libaudiofile \ + --capture \ + --output-file @top_builddir@/lcov.info + + $(LCOV) --directory @top_srcdir@/libaudiofile \ + --output-file @top_builddir@/lcov.info \ + --remove @top_builddir@/lcov.info \ + "/usr/include/*" "gtest/*" "*/UT_*" + + $(mkdir_p) @top_builddir@/coverage + git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`; \ + $(GENHTML) --title "@PACKAGE@ @VERSION@ $$git_commit" \ + --output-directory @top_builddir@/coverage @top_builddir@/lcov.info + @echo + @echo 'lcov report can be found here:' + @echo 'file://@abs_top_builddir@/coverage/index.html' + @echo clean-local: - -rm -rf coverage + -rm -rf coverage .PHONY: coverage-reset coverage coverage-report else coverage: - @echo "Code coverage is not enabled." - @exit 1 + @echo "Code coverage is not enabled." + @exit 1 endif From a2c780bb9aa69341ed7c8f465321b39affb6da23 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 13:22:59 -0300 Subject: [PATCH 26/50] ensure makefile.am uses tabs not spaces --- .editorconfig | 2 +- Makefile.am | 68 +++++++++++++++++++++++++-------------------------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/.editorconfig b/.editorconfig index edc1225..2bc5b87 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,7 +4,7 @@ root = true [*] -indent_style = space +indent_style = tab indent_size = 2 end_of_line = crlf charset = utf-8 diff --git a/Makefile.am b/Makefile.am index 250b30c..9d445ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,57 +3,57 @@ SUBDIRS = gtest libaudiofile sfcommands test examples docs po EXTRA_DIST = \ - ACKNOWLEDGEMENTS \ - NOTES \ - README \ - TODO \ - COPYING.GPL \ - configure configure.ac \ - audiofile.spec.in \ - audiofile.pc.in \ - audiofile-uninstalled.pc.in + ACKNOWLEDGEMENTS \ + NOTES \ + README \ + TODO \ + COPYING.GPL \ + configure configure.ac \ + audiofile.spec.in \ + audiofile.pc.in \ + audiofile-uninstalled.pc.in pkgconfig_DATA = audiofile.pc # ACLOCAL_AMFLAGS = -I m4 dist-hook: audiofile.spec - cp audiofile.spec $(distdir) + cp audiofile.spec $(distdir) if ENABLE_COVERAGE coverage: - $(MAKE) coverage-reset - $(MAKE) check - $(MAKE) coverage-report + $(MAKE) coverage-reset + $(MAKE) check + $(MAKE) coverage-report coverage-reset: - $(LCOV) --base-directory=@top_srcdir@ --directory @top_srcdir@/libaudiofile --zerocounters + $(LCOV) --base-directory=@top_srcdir@ --directory @top_srcdir@/libaudiofile --zerocounters coverage-report: - $(LCOV) --directory @top_srcdir@/libaudiofile \ - --capture \ - --output-file @top_builddir@/lcov.info - - $(LCOV) --directory @top_srcdir@/libaudiofile \ - --output-file @top_builddir@/lcov.info \ - --remove @top_builddir@/lcov.info \ - "/usr/include/*" "gtest/*" "*/UT_*" - - $(mkdir_p) @top_builddir@/coverage - git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`; \ - $(GENHTML) --title "@PACKAGE@ @VERSION@ $$git_commit" \ - --output-directory @top_builddir@/coverage @top_builddir@/lcov.info - @echo - @echo 'lcov report can be found here:' - @echo 'file://@abs_top_builddir@/coverage/index.html' - @echo + $(LCOV) --directory @top_srcdir@/libaudiofile \ + --capture \ + --output-file @top_builddir@/lcov.info + + $(LCOV) --directory @top_srcdir@/libaudiofile \ + --output-file @top_builddir@/lcov.info \ + --remove @top_builddir@/lcov.info \ + "/usr/include/*" "gtest/*" "*/UT_*" + + $(mkdir_p) @top_builddir@/coverage + git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`; \ + $(GENHTML) --title "@PACKAGE@ @VERSION@ $$git_commit" \ + --output-directory @top_builddir@/coverage @top_builddir@/lcov.info + @echo + @echo 'lcov report can be found here:' + @echo 'file://@abs_top_builddir@/coverage/index.html' + @echo clean-local: - -rm -rf coverage + -rm -rf coverage .PHONY: coverage-reset coverage coverage-report else coverage: - @echo "Code coverage is not enabled." - @exit 1 + @echo "Code coverage is not enabled." + @exit 1 endif From 53f70fdaa781c94004916a25239c5866d2adc472 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 13:31:57 -0300 Subject: [PATCH 27/50] normalize the line endings and tabs in the build workflow --- .github/workflows/build.yml | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 518ba40..403a3f2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,12 @@ jobs: sudo apt-get install -y \ build-essential autoconf automake autopoint libtool pkg-config \ libasound2-dev gettext intltool gtk-doc-tools \ - asciidoc docbook-xsl + asciidoc docbook-xsl dos2unix + + - name: Normalize line endings and tabs + run: | + find . -type f \( -name '*.am' -o -name '*.in' \) -exec dos2unix {} \; + find . -type f -name 'Makefile.am' -exec sed -i 's/^[ ]\+/\t/' {} \; - name: Generate configure & Build run: | @@ -74,7 +79,12 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ - gettext intltool gtk-doc-tools asciidoc docbook-xsl + gettext intltool gtk-doc-tools asciidoc docbook-xsl dos2unix + + - name: Normalize line endings and tabs + run: | + find . -type f \( -name '*.am' -o -name '*.in' \) -exec dos2unix {} \; + find . -type f -name 'Makefile.am' -exec sed -i 's/^[ ]\+/\t/' {} \; - name: Generate configure & Build run: | @@ -106,7 +116,12 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ - gettext intltool gtk-doc-tools asciidoc docbook-xsl + gettext intltool gtk-doc-tools asciidoc docbook-xsl dos2unix + + - name: Normalize line endings and tabs + run: | + find . -type f \( -name '*.am' -o -name '*.in' \) -exec dos2unix {} \; + find . -type f -name 'Makefile.am' -exec sed -i 's/^[ ]\+/\t/' {} \; - name: Generate configure & Build run: | @@ -133,7 +148,12 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf autopoint gettext intltool gtk-doc asciidoc docbook-xsl + run: brew install pkg-config automake libtool autoconf autopoint gettext intltool gtk-doc asciidoc docbook-xsl dos2unix + + - name: Normalize line endings and tabs + run: | + find . -type f \( -name '*.am' -o -name '*.in' \) -exec dos2unix {} \; + find . -type f -name 'Makefile.am' -exec sed -i '' 's/^[ ]\+/\t/' {} \; - name: Generate configure & Build run: | From cc8a939093725273e3038cd7206e8b2ba682cfe7 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 13:38:33 -0300 Subject: [PATCH 28/50] create POTFILES a different way --- .github/workflows/build.yml | 20 -------------------- autogen.sh | 3 ++- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 403a3f2..05c8f22 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,11 +32,6 @@ jobs: libasound2-dev gettext intltool gtk-doc-tools \ asciidoc docbook-xsl dos2unix - - name: Normalize line endings and tabs - run: | - find . -type f \( -name '*.am' -o -name '*.in' \) -exec dos2unix {} \; - find . -type f -name 'Makefile.am' -exec sed -i 's/^[ ]\+/\t/' {} \; - - name: Generate configure & Build run: | chmod +x ./autogen.sh @@ -81,11 +76,6 @@ jobs: make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ gettext intltool gtk-doc-tools asciidoc docbook-xsl dos2unix - - name: Normalize line endings and tabs - run: | - find . -type f \( -name '*.am' -o -name '*.in' \) -exec dos2unix {} \; - find . -type f -name 'Makefile.am' -exec sed -i 's/^[ ]\+/\t/' {} \; - - name: Generate configure & Build run: | chmod +x ./autogen.sh @@ -118,11 +108,6 @@ jobs: make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ gettext intltool gtk-doc-tools asciidoc docbook-xsl dos2unix - - name: Normalize line endings and tabs - run: | - find . -type f \( -name '*.am' -o -name '*.in' \) -exec dos2unix {} \; - find . -type f -name 'Makefile.am' -exec sed -i 's/^[ ]\+/\t/' {} \; - - name: Generate configure & Build run: | chmod +x ./autogen.sh @@ -150,11 +135,6 @@ jobs: - name: Install dependencies run: brew install pkg-config automake libtool autoconf autopoint gettext intltool gtk-doc asciidoc docbook-xsl dos2unix - - name: Normalize line endings and tabs - run: | - find . -type f \( -name '*.am' -o -name '*.in' \) -exec dos2unix {} \; - find . -type f -name 'Makefile.am' -exec sed -i '' 's/^[ ]\+/\t/' {} \; - - name: Generate configure & Build run: | chmod +x ./autogen.sh diff --git a/autogen.sh b/autogen.sh index 6b00be1..3347a89 100755 --- a/autogen.sh +++ b/autogen.sh @@ -14,7 +14,8 @@ fi # Ensure POTFILES.in doesn't already exist before creating a blank one if [ ! -f "$srcdir/po/POTFILES.in" ]; then mkdir -p "$srcdir/po" - touch "$srcdir/po/POTFILES.in" + echo -n "" > "$srcdir/po/POTFILES.in" + dos2unix "$srcdir/po/POTFILES.in" fi rootme=`pwd` From 7a3ab581f0ab79e803b42912cad24248ea190e4b Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 13:43:46 -0300 Subject: [PATCH 29/50] don't use Makefile.in as the makefile --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05c8f22..2b0545f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: ./autogen.sh chmod +x ./configure ./configure || true - make -f Makefile.in -j$(nproc) + make -j$(nproc) - name: Strip binaries run: find . -type f -executable -exec strip {} \; || true @@ -46,7 +46,7 @@ jobs: - name: Build Documentation run: | cd docs - make -f Makefile.in || true + make shell: bash - name: Upload Linux artifact @@ -82,7 +82,7 @@ jobs: ./autogen.sh chmod +x ./configure ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ || true - make -f Makefile.in -j$(nproc) + make -j$(nproc) - name: Strip binaries run: find . -type f -name "*.exe" -exec x86_64-w64-mingw32-strip {} \; || true @@ -114,7 +114,7 @@ jobs: ./autogen.sh chmod +x ./configure ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ || true - make -f Makefile.in -j$(nproc) + make -j$(nproc) - name: Strip binaries run: find . -type f -name "*.exe" -exec i686-w64-mingw32-strip {} \; || true @@ -141,7 +141,7 @@ jobs: ./autogen.sh chmod +x ./configure || true ./configure - make -f Makefile.in -j$(sysctl -n hw.ncpu) + make -j$(sysctl -n hw.ncpu) - name: Strip binaries run: find . -type f -perm +111 -exec strip {} \; || true @@ -149,7 +149,7 @@ jobs: - name: Build Documentation run: | cd docs - make -f Makefile.in || true + make shell: bash - name: Upload macOS artifact From bafc6214ed17b5aa497ac4db1aa9b566521ba70b Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 13:45:35 -0300 Subject: [PATCH 30/50] POTFILES never had any problems this way --- autogen.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index 3347a89..6b00be1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -14,8 +14,7 @@ fi # Ensure POTFILES.in doesn't already exist before creating a blank one if [ ! -f "$srcdir/po/POTFILES.in" ]; then mkdir -p "$srcdir/po" - echo -n "" > "$srcdir/po/POTFILES.in" - dos2unix "$srcdir/po/POTFILES.in" + touch "$srcdir/po/POTFILES.in" fi rootme=`pwd` From ee97a22ce0f0faf7ffa95933425d7484426d721f Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 14:04:51 -0300 Subject: [PATCH 31/50] Add the missing docs build targets --- .github/workflows/build.yml | 8 ++++---- docs/Makefile.am | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b0545f..f6ee2f0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: sudo apt-get install -y \ build-essential autoconf automake autopoint libtool pkg-config \ libasound2-dev gettext intltool gtk-doc-tools \ - asciidoc docbook-xsl dos2unix + asciidoc docbook-xsl - name: Generate configure & Build run: | @@ -74,7 +74,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ - gettext intltool gtk-doc-tools asciidoc docbook-xsl dos2unix + gettext intltool gtk-doc-tools asciidoc docbook-xsl - name: Generate configure & Build run: | @@ -106,7 +106,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ - gettext intltool gtk-doc-tools asciidoc docbook-xsl dos2unix + gettext intltool gtk-doc-tools asciidoc docbook-xsl - name: Generate configure & Build run: | @@ -133,7 +133,7 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf autopoint gettext intltool gtk-doc asciidoc docbook-xsl dos2unix + run: brew install pkg-config automake libtool autoconf autopoint gettext intltool gtk-doc asciidoc docbook-xsl - name: Generate configure & Build run: | diff --git a/docs/Makefile.am b/docs/Makefile.am index 327b394..7e08c36 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -66,6 +66,30 @@ A2XFLAGS = $(ASCIIDOCFLAGS) -d manpage -f manpage %.3: %.3.txt $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< +afIdentifyNamedFD.3: afIdentifyFD.3.txt + $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< + +afInitAESChannelData.3: afInitAESChannelDataTo.3.txt + $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< + +afInitByteOrder.3 afInitChannels.3 afInitRate.3: afInitSampleFormat.3.txt + $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< + +afGetDataOffset.3 afGetTrackBytes.3: afGetFrameCount.3.txt + $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< + +afQueryLong.3 afQueryDouble.3 afQueryPointer.3: afQuery.3.txt + $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< + +afSeekMisc.3 afWriteMisc.3: afReadMisc.3.txt + $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< + +afSetVirtualByteOrder.3 afSetVirtualChannels.3 afSetVirtualPCMMapping.3: afSetVirtualSampleFormat.3.txt + $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< + +afTellFrame.3: afSeekFrame.3.txt + $(A2X) $(A2XFLAGS) --asciidoc-opts="-f asciidoc.conf" $< + html: $(DOCS_HTML) CLEANFILES = *.1 *.3 *.html From 2c83348f9c01371866254643df26937d7b9d5327 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 14:26:11 -0300 Subject: [PATCH 32/50] swap alsa in favor of portaudio --- .github/workflows/build.yml | 44 ++++++++++++++++++++--------- examples/alsaplay.cpp | 55 +++++++++++++++++++++++++------------ 2 files changed, 68 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6ee2f0..51905f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,8 +29,8 @@ jobs: sudo apt-get update sudo apt-get install -y \ build-essential autoconf automake autopoint libtool pkg-config \ - libasound2-dev gettext intltool gtk-doc-tools \ - asciidoc docbook-xsl + gettext intltool gtk-doc-tools \ + asciidoc docbook-xsl portaudio19-dev - name: Generate configure & Build run: | @@ -40,8 +40,8 @@ jobs: ./configure || true make -j$(nproc) - - name: Strip binaries - run: find . -type f -executable -exec strip {} \; || true + - name: Strip audiofile binary only + run: strip ./audiofile || true - name: Build Documentation run: | @@ -76,16 +76,25 @@ jobs: make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ gettext intltool gtk-doc-tools asciidoc docbook-xsl + - name: Build PortAudio for Windows x64 + run: | + git clone https://github.com/PortAudio/portaudio.git + cd portaudio + ./configure --host=x86_64-w64-mingw32 --disable-shared + make + cd .. + - name: Generate configure & Build run: | chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ || true + ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \ + PKG_CONFIG_PATH=$(pwd)/portaudio || true make -j$(nproc) - - name: Strip binaries - run: find . -type f -name "*.exe" -exec x86_64-w64-mingw32-strip {} \; || true + - name: Strip audiofile.exe only + run: x86_64-w64-mingw32-strip ./audiofile.exe || true - name: Upload Windows x64 artifact uses: actions/upload-artifact@v4 @@ -108,16 +117,25 @@ jobs: make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ gettext intltool gtk-doc-tools asciidoc docbook-xsl + - name: Build PortAudio for Windows x86 + run: | + git clone https://github.com/PortAudio/portaudio.git + cd portaudio + ./configure --host=i686-w64-mingw32 --disable-shared + make + cd .. + - name: Generate configure & Build run: | chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ || true + ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ \ + PKG_CONFIG_PATH=$(pwd)/portaudio || true make -j$(nproc) - - name: Strip binaries - run: find . -type f -name "*.exe" -exec i686-w64-mingw32-strip {} \; || true + - name: Strip audiofile.exe only + run: i686-w64-mingw32-strip ./audiofile.exe || true - name: Upload Windows x86 artifact uses: actions/upload-artifact@v4 @@ -133,7 +151,7 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf autopoint gettext intltool gtk-doc asciidoc docbook-xsl + run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio - name: Generate configure & Build run: | @@ -143,8 +161,8 @@ jobs: ./configure make -j$(sysctl -n hw.ncpu) - - name: Strip binaries - run: find . -type f -perm +111 -exec strip {} \; || true + - name: Strip audiofile binary only + run: strip ./audiofile || true - name: Build Documentation run: | diff --git a/examples/alsaplay.cpp b/examples/alsaplay.cpp index 4c11f55..821867c 100644 --- a/examples/alsaplay.cpp +++ b/examples/alsaplay.cpp @@ -32,10 +32,14 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +/* + Audio File Library - Windows playback using PortAudio +*/ + #include #include #include +#include int main(int argc, char **argv) { @@ -56,18 +60,36 @@ int main(int argc, char **argv) double rate = afGetRate(file, AF_DEFAULT_TRACK); afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); - int err; - snd_pcm_t *handle; - if ((err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0)) < 0) + PaError err; + err = Pa_Initialize(); + if (err != paNoError) + { + fprintf(stderr, "PortAudio init failed: %s\n", Pa_GetErrorText(err)); + exit(EXIT_FAILURE); + } + + PaStream *stream; + err = Pa_OpenDefaultStream(&stream, + 0, // no input channels + channels, // output channels + paInt16, // 16-bit PCM + (double)rate, + 4096, // frames per buffer + NULL, // no callback, blocking + NULL); + if (err != paNoError) { - fprintf(stderr, "Could not open audio output: %s\n", snd_strerror(err)); + fprintf(stderr, "PortAudio open stream failed: %s\n", Pa_GetErrorText(err)); + Pa_Terminate(); exit(EXIT_FAILURE); } - if ((err = snd_pcm_set_params(handle, SND_PCM_FORMAT_S16, - SND_PCM_ACCESS_RW_INTERLEAVED, channels, rate, 1, 500000)) < 0) + err = Pa_StartStream(stream); + if (err != paNoError) { - fprintf(stderr, "Could not set audio output parameters: %s\n", snd_strerror(err)); + fprintf(stderr, "PortAudio start stream failed: %s\n", Pa_GetErrorText(err)); + Pa_CloseStream(stream); + Pa_Terminate(); exit(EXIT_FAILURE); } @@ -80,21 +102,18 @@ int main(int argc, char **argv) if (framesRead <= 0) break; - snd_pcm_sframes_t framesWritten = snd_pcm_writei(handle, buffer, bufferFrames); - if (framesWritten < 0) - framesWritten = snd_pcm_recover(handle, framesWritten, 0); - if (framesWritten < 0) + err = Pa_WriteStream(stream, buffer, framesRead); + if (err != paNoError) { - fprintf(stderr, "Could not write audio data to output device: %s\n", - snd_strerror(err)); + fprintf(stderr, "PortAudio write failed: %s\n", Pa_GetErrorText(err)); break; } } - snd_pcm_drain(handle); - snd_pcm_close(handle); - delete [] buffer; - + delete[] buffer; + Pa_StopStream(stream); + Pa_CloseStream(stream); + Pa_Terminate(); afCloseFile(file); return 0; From 1c3254d8b1192c2625655c730603bfecb5f2a6ac Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 14:51:55 -0300 Subject: [PATCH 33/50] cross-platform alsaplay.cpp --- .github/workflows/build.yml | 2 +- examples/Makefile.am | 9 +++++ examples/alsaplay.cpp | 78 +++++++++++++++++++++++++++++++------ 3 files changed, 76 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51905f9..51ebc27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: sudo apt-get install -y \ build-essential autoconf automake autopoint libtool pkg-config \ gettext intltool gtk-doc-tools \ - asciidoc docbook-xsl portaudio19-dev + asciidoc docbook-xsl portaudio19-dev libasound2-dev - name: Generate configure & Build run: | diff --git a/examples/Makefile.am b/examples/Makefile.am index 22b0019..de45145 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -9,8 +9,17 @@ EXTRA_PROGRAMS = alsaplay irixread irixtestloop linuxtest osxplay LIBAUDIOFILE = $(top_builddir)/libaudiofile/libaudiofile.la +# ALSA playback for Linux +#if defined(__linux__) alsaplay_SOURCES = alsaplay.cpp alsaplay_LDADD = $(LIBAUDIOFILE) -lasound +endif + +# PortAudio playback for Windows / macOS +#if !defined(__linux__) +alsaplay_SOURCES = alsaplay.cpp +alsaplay_LDADD = $(LIBAUDIOFILE) -lportaudio +endif irixread_SOURCES = irixread.c sgi.c sgi.h irixread_LDADD = $(LIBAUDIOFILE) -laudio diff --git a/examples/alsaplay.cpp b/examples/alsaplay.cpp index 821867c..583b8e2 100644 --- a/examples/alsaplay.cpp +++ b/examples/alsaplay.cpp @@ -33,13 +33,21 @@ */ /* - Audio File Library - Windows playback using PortAudio + Audio File Library - Playback using ALSA on Linux or PortAudio elsewhere */ #include #include #include -#include +#include + +#if defined(__linux__) + #include + #define USE_ALSA 1 +#else + #include + #define USE_ALSA 0 +#endif int main(int argc, char **argv) { @@ -49,6 +57,7 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } + // Open audio file using Audio File Library AFfilehandle file = afOpenFile(argv[1], "r", AF_NULL_FILESETUP); if (!file) { @@ -58,8 +67,54 @@ int main(int argc, char **argv) int channels = afGetChannels(file, AF_DEFAULT_TRACK); double rate = afGetRate(file, AF_DEFAULT_TRACK); + + // Force 16-bit 2's complement output for simplicity afSetVirtualSampleFormat(file, AF_DEFAULT_TRACK, AF_SAMPFMT_TWOSCOMP, 16); + const int bufferFrames = 4096; + int16_t *buffer = new int16_t[bufferFrames * channels]; + +#if USE_ALSA + // --- ALSA playback for Linux --- + int err; + snd_pcm_t *handle; + + if ((err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0)) < 0) + { + fprintf(stderr, "Could not open audio output: %s\n", snd_strerror(err)); + exit(EXIT_FAILURE); + } + + if ((err = snd_pcm_set_params(handle, SND_PCM_FORMAT_S16, + SND_PCM_ACCESS_RW_INTERLEAVED, channels, rate, 1, 500000)) < 0) + { + fprintf(stderr, "Could not set audio output parameters: %s\n", snd_strerror(err)); + exit(EXIT_FAILURE); + } + + while (true) + { + // Read frames from the audio file + AFframecount framesRead = afReadFrames(file, AF_DEFAULT_TRACK, buffer, bufferFrames); + if (framesRead <= 0) + break; + + // Write frames to ALSA device + snd_pcm_sframes_t framesWritten = snd_pcm_writei(handle, buffer, framesRead); + if (framesWritten < 0) + framesWritten = snd_pcm_recover(handle, framesWritten, 0); + if (framesWritten < 0) + { + fprintf(stderr, "Could not write audio data: %s\n", snd_strerror(framesWritten)); + break; + } + } + + snd_pcm_drain(handle); + snd_pcm_close(handle); + +#else + // --- PortAudio playback for non-Linux platforms --- PaError err; err = Pa_Initialize(); if (err != paNoError) @@ -70,12 +125,12 @@ int main(int argc, char **argv) PaStream *stream; err = Pa_OpenDefaultStream(&stream, - 0, // no input channels - channels, // output channels - paInt16, // 16-bit PCM - (double)rate, - 4096, // frames per buffer - NULL, // no callback, blocking + 0, // no input channels + channels, // output channels + paInt16, // 16-bit PCM + rate, + bufferFrames, + NULL, // no callback, blocking NULL); if (err != paNoError) { @@ -93,9 +148,6 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } - const int bufferFrames = 4096; - int16_t *buffer = new int16_t[bufferFrames * channels]; - while (true) { AFframecount framesRead = afReadFrames(file, AF_DEFAULT_TRACK, buffer, bufferFrames); @@ -110,10 +162,12 @@ int main(int argc, char **argv) } } - delete[] buffer; Pa_StopStream(stream); Pa_CloseStream(stream); Pa_Terminate(); +#endif + + delete[] buffer; afCloseFile(file); return 0; From 940cc5a409df7ab4ab00441e85f4c2c81d1fa990 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 14:58:07 -0300 Subject: [PATCH 34/50] fix conditional --- examples/Makefile.am | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/Makefile.am b/examples/Makefile.am index de45145..f03277a 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -9,14 +9,11 @@ EXTRA_PROGRAMS = alsaplay irixread irixtestloop linuxtest osxplay LIBAUDIOFILE = $(top_builddir)/libaudiofile/libaudiofile.la -# ALSA playback for Linux +# ALSA playback for Linux and PortAudio playback elsewhere #if defined(__linux__) alsaplay_SOURCES = alsaplay.cpp alsaplay_LDADD = $(LIBAUDIOFILE) -lasound -endif - -# PortAudio playback for Windows / macOS -#if !defined(__linux__) +else alsaplay_SOURCES = alsaplay.cpp alsaplay_LDADD = $(LIBAUDIOFILE) -lportaudio endif From c48665254a9331e4f42299ab7e8ea265003497b7 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 15:15:37 -0300 Subject: [PATCH 35/50] rewire the ALSA/PortAudio detection --- configure.ac | 15 +++++++++++++++ examples/Makefile.am | 13 ++++++++----- examples/alsaplay.cpp | 10 +++++----- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 0cadbe5..8687dbb 100644 --- a/configure.ac +++ b/configure.ac @@ -130,6 +130,21 @@ else AC_DEFINE_UNQUOTED([ENABLE_FLAC], [0], [Whether FLAC is enabled.]) fi +# Check for Linux +AC_CHECK_LIB([asound], [snd_pcm_open], [have_alsa=yes], [have_alsa=no]) + +# Check for PortAudio +AC_CHECK_HEADER([portaudio.h], [have_portaudio=yes], [have_portaudio=no]) +AC_CHECK_LIB([portaudio], [Pa_Initialize], [have_portaudio_lib=yes], [have_portaudio_lib=no]) + +# Define HAVE_ALSA or HAVE_PORTAUDIO macros for C++ +if test "$have_alsa" = yes; then + AC_DEFINE([HAVE_ALSA], [1], [Define if ALSA is available]) +fi +if test "$have_portaudio" = yes && test "$have_portaudio_lib" = yes; then + AC_DEFINE([HAVE_PORTAUDIO], [1], [Define if PortAudio is available]) +fi + AC_CONFIG_FILES([ audiofile.spec audiofile.pc diff --git a/examples/Makefile.am b/examples/Makefile.am index f03277a..ed1a904 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -10,12 +10,15 @@ EXTRA_PROGRAMS = alsaplay irixread irixtestloop linuxtest osxplay LIBAUDIOFILE = $(top_builddir)/libaudiofile/libaudiofile.la # ALSA playback for Linux and PortAudio playback elsewhere -#if defined(__linux__) alsaplay_SOURCES = alsaplay.cpp -alsaplay_LDADD = $(LIBAUDIOFILE) -lasound -else -alsaplay_SOURCES = alsaplay.cpp -alsaplay_LDADD = $(LIBAUDIOFILE) -lportaudio +alsaplay_LDADD = $(LIBAUDIOFILE) + +if HAVE_ALSA +alsaplay_LDADD += -lasound +endif + +if HAVE_PORTAUDIO +alsaplay_LDADD += -lportaudio endif irixread_SOURCES = irixread.c sgi.c sgi.h diff --git a/examples/alsaplay.cpp b/examples/alsaplay.cpp index 583b8e2..27df348 100644 --- a/examples/alsaplay.cpp +++ b/examples/alsaplay.cpp @@ -41,12 +41,12 @@ #include #include -#if defined(__linux__) - #include - #define USE_ALSA 1 +#ifdef HAVE_ALSA +#include +#elif defined(HAVE_PORTAUDIO) +#include #else - #include - #define USE_ALSA 0 +#error "No audio backend available!" #endif int main(int argc, char **argv) From 7f7d3d02104ab795fdce8b424ab36037403020ba Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 15:22:11 -0300 Subject: [PATCH 36/50] ensure the new ALSA/PORTAUDIO conditional works correctly --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8687dbb..4a42d04 100644 --- a/configure.ac +++ b/configure.ac @@ -137,7 +137,7 @@ AC_CHECK_LIB([asound], [snd_pcm_open], [have_alsa=yes], [have_alsa=no]) AC_CHECK_HEADER([portaudio.h], [have_portaudio=yes], [have_portaudio=no]) AC_CHECK_LIB([portaudio], [Pa_Initialize], [have_portaudio_lib=yes], [have_portaudio_lib=no]) -# Define HAVE_ALSA or HAVE_PORTAUDIO macros for C++ +# Define C macros if test "$have_alsa" = yes; then AC_DEFINE([HAVE_ALSA], [1], [Define if ALSA is available]) fi @@ -145,6 +145,10 @@ if test "$have_portaudio" = yes && test "$have_portaudio_lib" = yes; then AC_DEFINE([HAVE_PORTAUDIO], [1], [Define if PortAudio is available]) fi +# Declare Automake conditionals +AM_CONDITIONAL([HAVE_ALSA], [test "$have_alsa" = yes]) +AM_CONDITIONAL([HAVE_PORTAUDIO], [test "$have_portaudio" = yes && "$have_portaudio_lib" = yes]) + AC_CONFIG_FILES([ audiofile.spec audiofile.pc From 6361cf027e3647d18dd1d79a39c944a15e5f3eb3 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 15:31:56 -0300 Subject: [PATCH 37/50] ensure github actions runner doesn't hang --- configure.ac | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 4a42d04..efc469b 100644 --- a/configure.ac +++ b/configure.ac @@ -130,23 +130,22 @@ else AC_DEFINE_UNQUOTED([ENABLE_FLAC], [0], [Whether FLAC is enabled.]) fi -# Check for Linux -AC_CHECK_LIB([asound], [snd_pcm_open], [have_alsa=yes], [have_alsa=no]) +dnl --- Check for ALSA library (Linux) --- +have_alsa=no +if test "$cross_compiling" != yes; then + AC_CHECK_LIB([asound], [snd_pcm_open], [have_alsa=yes], [have_alsa=no]) +fi +AC_DEFINE([HAVE_ALSA], [1], [Define if ALSA is available]) +AM_CONDITIONAL([HAVE_ALSA], [test "$have_alsa" = yes]) -# Check for PortAudio +dnl --- Check for PortAudio library (non-Linux) --- +have_portaudio=no +have_portaudio_lib=no AC_CHECK_HEADER([portaudio.h], [have_portaudio=yes], [have_portaudio=no]) -AC_CHECK_LIB([portaudio], [Pa_Initialize], [have_portaudio_lib=yes], [have_portaudio_lib=no]) - -# Define C macros -if test "$have_alsa" = yes; then - AC_DEFINE([HAVE_ALSA], [1], [Define if ALSA is available]) +if test "$cross_compiling" != yes; then + AC_CHECK_LIB([portaudio], [Pa_Initialize], [have_portaudio_lib=yes], [have_portaudio_lib=no]) fi -if test "$have_portaudio" = yes && test "$have_portaudio_lib" = yes; then - AC_DEFINE([HAVE_PORTAUDIO], [1], [Define if PortAudio is available]) -fi - -# Declare Automake conditionals -AM_CONDITIONAL([HAVE_ALSA], [test "$have_alsa" = yes]) +AC_DEFINE([HAVE_PORTAUDIO], [1], [Define if PortAudio is available]) AM_CONDITIONAL([HAVE_PORTAUDIO], [test "$have_portaudio" = yes && "$have_portaudio_lib" = yes]) AC_CONFIG_FILES([ From 64644ddfb879117f08e6e67e582dd447643fe3d9 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 15:48:41 -0300 Subject: [PATCH 38/50] guard against infinite = yes spam --- configure.ac | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index efc469b..cee66a7 100644 --- a/configure.ac +++ b/configure.ac @@ -135,17 +135,28 @@ have_alsa=no if test "$cross_compiling" != yes; then AC_CHECK_LIB([asound], [snd_pcm_open], [have_alsa=yes], [have_alsa=no]) fi -AC_DEFINE([HAVE_ALSA], [1], [Define if ALSA is available]) + +if test "$have_alsa" = yes; then + AC_DEFINE([HAVE_ALSA], [1], [Define if ALSA is available]) +else + AC_DEFINE([HAVE_ALSA], [0], [Define if ALSA is available]) +fi AM_CONDITIONAL([HAVE_ALSA], [test "$have_alsa" = yes]) dnl --- Check for PortAudio library (non-Linux) --- have_portaudio=no have_portaudio_lib=no + AC_CHECK_HEADER([portaudio.h], [have_portaudio=yes], [have_portaudio=no]) if test "$cross_compiling" != yes; then AC_CHECK_LIB([portaudio], [Pa_Initialize], [have_portaudio_lib=yes], [have_portaudio_lib=no]) fi -AC_DEFINE([HAVE_PORTAUDIO], [1], [Define if PortAudio is available]) + +if test "$have_portaudio" = yes && test "$have_portaudio_lib" = yes; then + AC_DEFINE([HAVE_PORTAUDIO], [1], [Define if PortAudio is available]) +else + AC_DEFINE([HAVE_PORTAUDIO], [0], [Define if PortAudio is available]) +fi AM_CONDITIONAL([HAVE_PORTAUDIO], [test "$have_portaudio" = yes && "$have_portaudio_lib" = yes]) AC_CONFIG_FILES([ From 920e5a2af21056484dd97639f02777ff4e9a42e9 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 15:57:02 -0300 Subject: [PATCH 39/50] Truly guard against infinite = yes spam --- configure.ac | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index cee66a7..29ed75c 100644 --- a/configure.ac +++ b/configure.ac @@ -132,7 +132,9 @@ fi dnl --- Check for ALSA library (Linux) --- have_alsa=no -if test "$cross_compiling" != yes; then +if test "$host_os" != "linux-gnu"; then + have_alsa=no +elif test "$cross_compiling" != yes; then AC_CHECK_LIB([asound], [snd_pcm_open], [have_alsa=yes], [have_alsa=no]) fi @@ -146,18 +148,22 @@ AM_CONDITIONAL([HAVE_ALSA], [test "$have_alsa" = yes]) dnl --- Check for PortAudio library (non-Linux) --- have_portaudio=no have_portaudio_lib=no +have_portaudio_cond=no -AC_CHECK_HEADER([portaudio.h], [have_portaudio=yes], [have_portaudio=no]) -if test "$cross_compiling" != yes; then - AC_CHECK_LIB([portaudio], [Pa_Initialize], [have_portaudio_lib=yes], [have_portaudio_lib=no]) +if test "$host_os" != "linux-gnu"; then + AC_CHECK_HEADER([portaudio.h], [have_portaudio=yes], [have_portaudio=no]) + if test "$cross_compiling" != yes; then + AC_CHECK_LIB([portaudio], [Pa_Initialize], [have_portaudio_lib=yes], [have_portaudio_lib=no]) + fi fi if test "$have_portaudio" = yes && test "$have_portaudio_lib" = yes; then AC_DEFINE([HAVE_PORTAUDIO], [1], [Define if PortAudio is available]) + have_portaudio_cond=yes else AC_DEFINE([HAVE_PORTAUDIO], [0], [Define if PortAudio is available]) fi -AM_CONDITIONAL([HAVE_PORTAUDIO], [test "$have_portaudio" = yes && "$have_portaudio_lib" = yes]) +AM_CONDITIONAL([HAVE_PORTAUDIO], [test "$have_portaudio_cond" = yes]) AC_CONFIG_FILES([ audiofile.spec From 542e65b289182864c2d7df81fa926518ec8a58c2 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 16:08:32 -0300 Subject: [PATCH 40/50] add config.h added by configure to the alsa/portaudio code --- examples/alsaplay.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/alsaplay.cpp b/examples/alsaplay.cpp index 27df348..c3a20d4 100644 --- a/examples/alsaplay.cpp +++ b/examples/alsaplay.cpp @@ -36,6 +36,7 @@ Audio File Library - Playback using ALSA on Linux or PortAudio elsewhere */ +#include "../config.h" #include #include #include @@ -74,7 +75,7 @@ int main(int argc, char **argv) const int bufferFrames = 4096; int16_t *buffer = new int16_t[bufferFrames * channels]; -#if USE_ALSA +#if HAVE_ALSA // --- ALSA playback for Linux --- int err; snd_pcm_t *handle; From dbefd405b8e5e25b612153ef52b447d8fd34b302 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 16:27:23 -0300 Subject: [PATCH 41/50] tweaks to cross-compiling and macos to ensure portaudio is triggered properly --- .github/workflows/build.yml | 4 +++- configure.ac | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51ebc27..e105233 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -151,10 +151,12 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio + run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio && \ + cpan XML::Parser - name: Generate configure & Build run: | + export PERL_BAD_REGEX=0 chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure || true diff --git a/configure.ac b/configure.ac index 29ed75c..de3447d 100644 --- a/configure.ac +++ b/configure.ac @@ -152,7 +152,7 @@ have_portaudio_cond=no if test "$host_os" != "linux-gnu"; then AC_CHECK_HEADER([portaudio.h], [have_portaudio=yes], [have_portaudio=no]) - if test "$cross_compiling" != yes; then + if test "$cross_compiling" == yes; then AC_CHECK_LIB([portaudio], [Pa_Initialize], [have_portaudio_lib=yes], [have_portaudio_lib=no]) fi fi From c8b6e034f01357deee526deebcc315cd35e04a4b Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 16:45:11 -0300 Subject: [PATCH 42/50] add the xml parser on macos and fix xmllint on the other jobs --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e105233..d4e68d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,8 @@ jobs: sudo apt-get install -y \ build-essential autoconf automake autopoint libtool pkg-config \ gettext intltool gtk-doc-tools \ - asciidoc docbook-xsl portaudio19-dev libasound2-dev + asciidoc docbook-xml docbook-xsl \ + libxml2-utils portaudio19-dev libasound2-dev - name: Generate configure & Build run: | @@ -74,7 +75,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 \ make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ - gettext intltool gtk-doc-tools asciidoc docbook-xsl + gettext intltool gtk-doc-tools asciidoc docbook-xml docbook-xsl libxml2-utils - name: Build PortAudio for Windows x64 run: | @@ -115,7 +116,7 @@ jobs: sudo apt-get install -y \ gcc-mingw-w64-i686 g++-mingw-w64-i686 \ make binutils-mingw-w64 automake autoconf autopoint libtool pkg-config \ - gettext intltool gtk-doc-tools asciidoc docbook-xsl + gettext intltool gtk-doc-tools asciidoc docbook-xml docbook-xsl libxml2-utils - name: Build PortAudio for Windows x86 run: | From 6897f3ea465604703c0d83b08e0094614430d1e2 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 17:02:37 -0300 Subject: [PATCH 43/50] add cpan dependency on macos and ensure portaudio is installed for cross-compiling --- .github/workflows/build.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4e68d6..f7181be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,17 +81,21 @@ jobs: run: | git clone https://github.com/PortAudio/portaudio.git cd portaudio - ./configure --host=x86_64-w64-mingw32 --disable-shared + ./configure --host=x86_64-w64-mingw32 --disable-shared --prefix=$(pwd)/build make + make install cd .. - - name: Generate configure & Build + - name: Generate configure & Build audiofile run: | chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \ - PKG_CONFIG_PATH=$(pwd)/portaudio || true + ./configure CC=x86_64-w64-mingw32-gcc \ + CXX=x86_64-w64-mingw32-g++ \ + CPPFLAGS="-I$(pwd)/portaudio/build/include" \ + LDFLAGS="-L$(pwd)/portaudio/build/lib" \ + PKG_CONFIG_LIBDIR=$(pwd)/portaudio/build/lib/pkgconfig make -j$(nproc) - name: Strip audiofile.exe only @@ -122,17 +126,21 @@ jobs: run: | git clone https://github.com/PortAudio/portaudio.git cd portaudio - ./configure --host=i686-w64-mingw32 --disable-shared + ./configure --host=i686-w64-mingw32 --disable-shared --prefix=$(pwd)/build make + make install cd .. - - name: Generate configure & Build + - name: Generate configure & Build audiofile run: | chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ \ - PKG_CONFIG_PATH=$(pwd)/portaudio || true + ./configure CC=i686-w64-mingw32-gcc \ + CXX=i686-w64-mingw32-g++ \ + CPPFLAGS="-I$(pwd)/portaudio/build/include" \ + LDFLAGS="-L$(pwd)/portaudio/build/lib" \ + PKG_CONFIG_LIBDIR=$(pwd)/portaudio/build/lib/pkgconfig make -j$(nproc) - name: Strip audiofile.exe only @@ -152,7 +160,7 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio && \ + run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio cpanminus && \ cpan XML::Parser - name: Generate configure & Build From 35cfb9069dd18855570b3212f36d07ba641e79d6 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 17:12:54 -0300 Subject: [PATCH 44/50] properly install the XML parser and ensure all build targets build correctly --- .github/workflows/build.yml | 69 ++++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f7181be..b2fca85 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ permissions: contents: write jobs: - build-linux: + build-linux-alsa: name: Build Linux runs-on: ubuntu-latest outputs: @@ -31,7 +31,7 @@ jobs: build-essential autoconf automake autopoint libtool pkg-config \ gettext intltool gtk-doc-tools \ asciidoc docbook-xml docbook-xsl \ - libxml2-utils portaudio19-dev libasound2-dev + libxml2-utils libasound2-dev - name: Generate configure & Build run: | @@ -62,10 +62,47 @@ jobs: name: audiofile-docs path: ./docs/_build + build-linux-portaudio: + name: Build Linux (system PortAudio) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential autoconf automake autopoint libtool pkg-config \ + gettext intltool gtk-doc-tools \ + asciidoc docbook-xml docbook-xsl \ + libxml2-utils portaudio19-dev + + - name: Generate configure & Build audiofile + run: | + chmod +x ./autogen.sh + ./autogen.sh + chmod +x ./configure + ./configure + make -j$(nproc) + + - name: Strip audiofile binary only + run: strip ./audiofile || true + + - name: Build Documentation + run: | + cd docs + make + shell: bash + + - name: Upload Linux (system PortAudio) artifact + uses: actions/upload-artifact@v4 + with: + name: audiofile-linux-system-pa + path: ./audiofile + build-windows-x64: name: Cross-build Windows x64 runs-on: ubuntu-latest - needs: build-linux steps: - uses: actions/checkout@v5 @@ -110,7 +147,6 @@ jobs: build-windows-x86: name: Cross-build Windows x86 runs-on: ubuntu-latest - needs: build-linux steps: - uses: actions/checkout@v5 @@ -155,13 +191,14 @@ jobs: build-macos: name: Build macOS runs-on: macos-latest - needs: build-linux steps: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio cpanminus && \ - cpan XML::Parser + run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio cpanminus + + - name: Install XML parser + run: cpan XML::Parser - name: Generate configure & Build run: | @@ -191,18 +228,25 @@ jobs: name: Create GitHub Release runs-on: ubuntu-latest needs: - - build-linux + - build-linux-alsa + - build-linux-portaudio - build-windows-x64 - build-windows-x86 - build-macos steps: - uses: actions/checkout@v5 - - name: Download Linux artifact + - name: Download Linux ALSA artifact uses: actions/download-artifact@v5 with: - name: audiofile-linux - path: release/linux + name: audiofile-linux-alsa + path: release/linux-alsa + + - name: Download Linux PortAudio artifact + uses: actions/download-artifact@v5 + with: + name: audiofile-linux-portaudio + path: release/linux-portaudio - name: Download Windows x64 artifact uses: actions/download-artifact@v5 @@ -234,7 +278,8 @@ jobs: tag_name: build-${{ github.run_number }} prerelease: ${{ github.event.inputs.release_type != 'main' }} files: | - release/linux/audiofile + release/linux-alsa/audiofile + release/linux-portaudio/audiofile release/windows-x64/audiofile.exe release/windows-x86/audiofile.exe release/macos/audiofile From 0ba097a53bbc4541c9201ffe22fd7a8f936102b5 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 17:30:06 -0300 Subject: [PATCH 45/50] ensure libxml2 is up-to-date with the other build targets on macOS --- .github/workflows/build.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2fca85..3a82141 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ permissions: jobs: build-linux-alsa: - name: Build Linux + name: Build Linux with ALSA runs-on: ubuntu-latest outputs: linux-path: ./release/audiofile @@ -63,7 +63,7 @@ jobs: path: ./docs/_build build-linux-portaudio: - name: Build Linux (system PortAudio) + name: Build Linux with PortAudio runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 @@ -132,7 +132,8 @@ jobs: CXX=x86_64-w64-mingw32-g++ \ CPPFLAGS="-I$(pwd)/portaudio/build/include" \ LDFLAGS="-L$(pwd)/portaudio/build/lib" \ - PKG_CONFIG_LIBDIR=$(pwd)/portaudio/build/lib/pkgconfig + PKG_CONFIG_LIBDIR=$(pwd)/portaudio/build/lib/pkgconfig \ + --host=x86_64-w64-mingw32 make -j$(nproc) - name: Strip audiofile.exe only @@ -176,7 +177,8 @@ jobs: CXX=i686-w64-mingw32-g++ \ CPPFLAGS="-I$(pwd)/portaudio/build/include" \ LDFLAGS="-L$(pwd)/portaudio/build/lib" \ - PKG_CONFIG_LIBDIR=$(pwd)/portaudio/build/lib/pkgconfig + PKG_CONFIG_LIBDIR=$(pwd)/portaudio/build/lib/pkgconfig \ + --host=i686-w64-mingw32 make -j$(nproc) - name: Strip audiofile.exe only @@ -195,7 +197,8 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio cpanminus + run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio cpanminus libxml2 && \ + echo "PATH=$(brew --prefix libxml2)/bin:$PATH" >> $GITHUB_ENV - name: Install XML parser run: cpan XML::Parser From e17bea7fa50ba42e83c6fc9fac2db05ef600d9eb Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 17:45:30 -0300 Subject: [PATCH 46/50] skip docs on all but one build to ensure builds pass --- .github/workflows/build.yml | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a82141..ea66c57 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,13 +44,7 @@ jobs: - name: Strip audiofile binary only run: strip ./audiofile || true - - name: Build Documentation - run: | - cd docs - make - shell: bash - - - name: Upload Linux artifact + - name: Upload Linux build with ALSA artifact uses: actions/upload-artifact@v4 with: name: audiofile-linux @@ -83,18 +77,12 @@ jobs: ./autogen.sh chmod +x ./configure ./configure - make -j$(nproc) + make -j$(nproc) --disable-docs - name: Strip audiofile binary only run: strip ./audiofile || true - - name: Build Documentation - run: | - cd docs - make - shell: bash - - - name: Upload Linux (system PortAudio) artifact + - name: Upload Linux build with PortAudio artifact uses: actions/upload-artifact@v4 with: name: audiofile-linux-system-pa @@ -134,7 +122,7 @@ jobs: LDFLAGS="-L$(pwd)/portaudio/build/lib" \ PKG_CONFIG_LIBDIR=$(pwd)/portaudio/build/lib/pkgconfig \ --host=x86_64-w64-mingw32 - make -j$(nproc) + make -j$(nproc) --disable-docs - name: Strip audiofile.exe only run: x86_64-w64-mingw32-strip ./audiofile.exe || true @@ -179,7 +167,7 @@ jobs: LDFLAGS="-L$(pwd)/portaudio/build/lib" \ PKG_CONFIG_LIBDIR=$(pwd)/portaudio/build/lib/pkgconfig \ --host=i686-w64-mingw32 - make -j$(nproc) + make -j$(nproc) --disable-docs - name: Strip audiofile.exe only run: i686-w64-mingw32-strip ./audiofile.exe || true @@ -198,7 +186,10 @@ jobs: - name: Install dependencies run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio cpanminus libxml2 && \ - echo "PATH=$(brew --prefix libxml2)/bin:$PATH" >> $GITHUB_ENV + echo "export PATH=$(brew --prefix libxml2)/bin:$PATH" >> $GITHUB_PATH && \ + echo "export PKG_CONFIG_PATH=$(brew --prefix libxml2)/lib/pkgconfig" >> $GITHUB_ENV && \ + echo "export LDFLAGS=-L$(brew --prefix libxml2)/lib" >> $GITHUB_ENV && \ + echo "export CPPFLAGS=-I$(brew --prefix libxml2)/include" >> $GITHUB_ENV - name: Install XML parser run: cpan XML::Parser @@ -210,7 +201,7 @@ jobs: ./autogen.sh chmod +x ./configure || true ./configure - make -j$(sysctl -n hw.ncpu) + make -j$(sysctl -n hw.ncpu) --disable-docs - name: Strip audiofile binary only run: strip ./audiofile || true From 09257df0497a0317a278b5092ba95e544b26cb3a Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 17:59:06 -0300 Subject: [PATCH 47/50] correctly disable documentation for all other than the first builder --- .github/workflows/build.yml | 42 +++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea66c57..ab90334 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure || true + ./configure make -j$(nproc) - name: Strip audiofile binary only @@ -47,7 +47,7 @@ jobs: - name: Upload Linux build with ALSA artifact uses: actions/upload-artifact@v4 with: - name: audiofile-linux + name: audiofile-linux-alsa path: ./audiofile - name: Upload Documentation artifact @@ -76,8 +76,8 @@ jobs: chmod +x ./autogen.sh ./autogen.sh chmod +x ./configure - ./configure - make -j$(nproc) --disable-docs + ./configure --disable-docs + make -j$(nproc) - name: Strip audiofile binary only run: strip ./audiofile || true @@ -85,7 +85,7 @@ jobs: - name: Upload Linux build with PortAudio artifact uses: actions/upload-artifact@v4 with: - name: audiofile-linux-system-pa + name: audiofile-linux-portaudio path: ./audiofile build-windows-x64: @@ -121,8 +121,8 @@ jobs: CPPFLAGS="-I$(pwd)/portaudio/build/include" \ LDFLAGS="-L$(pwd)/portaudio/build/lib" \ PKG_CONFIG_LIBDIR=$(pwd)/portaudio/build/lib/pkgconfig \ - --host=x86_64-w64-mingw32 - make -j$(nproc) --disable-docs + --host=x86_64-w64-mingw32 --disable-docs + make -j$(nproc) - name: Strip audiofile.exe only run: x86_64-w64-mingw32-strip ./audiofile.exe || true @@ -166,8 +166,8 @@ jobs: CPPFLAGS="-I$(pwd)/portaudio/build/include" \ LDFLAGS="-L$(pwd)/portaudio/build/lib" \ PKG_CONFIG_LIBDIR=$(pwd)/portaudio/build/lib/pkgconfig \ - --host=i686-w64-mingw32 - make -j$(nproc) --disable-docs + --host=i686-w64-mingw32 --disable-docs + make -j$(nproc) - name: Strip audiofile.exe only run: i686-w64-mingw32-strip ./audiofile.exe || true @@ -185,11 +185,13 @@ jobs: - uses: actions/checkout@v5 - name: Install dependencies - run: brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio cpanminus libxml2 && \ - echo "export PATH=$(brew --prefix libxml2)/bin:$PATH" >> $GITHUB_PATH && \ - echo "export PKG_CONFIG_PATH=$(brew --prefix libxml2)/lib/pkgconfig" >> $GITHUB_ENV && \ - echo "export LDFLAGS=-L$(brew --prefix libxml2)/lib" >> $GITHUB_ENV && \ - echo "export CPPFLAGS=-I$(brew --prefix libxml2)/include" >> $GITHUB_ENV + shell: bash + run: | + brew install pkg-config automake libtool autoconf gettext intltool gtk-doc asciidoc docbook-xsl portaudio cpanminus libxml2 + echo "export PATH=$(brew --prefix libxml2)/bin:$PATH" >> $GITHUB_PATH + echo "export PKG_CONFIG_PATH=$(brew --prefix libxml2)/lib/pkgconfig" >> $GITHUB_ENV + echo "export LDFLAGS=-L$(brew --prefix libxml2)/lib" >> $GITHUB_ENV + echo "export CPPFLAGS=-I$(brew --prefix libxml2)/include" >> $GITHUB_ENV - name: Install XML parser run: cpan XML::Parser @@ -199,19 +201,13 @@ jobs: export PERL_BAD_REGEX=0 chmod +x ./autogen.sh ./autogen.sh - chmod +x ./configure || true - ./configure - make -j$(sysctl -n hw.ncpu) --disable-docs + chmod +x ./configure + ./configure --disable-docs + make -j$(sysctl -n hw.ncpu) - name: Strip audiofile binary only run: strip ./audiofile || true - - name: Build Documentation - run: | - cd docs - make - shell: bash - - name: Upload macOS artifact uses: actions/upload-artifact@v4 with: From 3deb915e39a3597ef49023e394045241bc7565b3 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 18:20:47 -0300 Subject: [PATCH 48/50] ensure alsa and portaudio checks work everywhere --- configure.ac | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index de3447d..33fd41e 100644 --- a/configure.ac +++ b/configure.ac @@ -145,16 +145,22 @@ else fi AM_CONDITIONAL([HAVE_ALSA], [test "$have_alsa" = yes]) -dnl --- Check for PortAudio library (non-Linux) --- +dnl --- Check for PortAudio library (all platforms) --- + have_portaudio=no have_portaudio_lib=no have_portaudio_cond=no -if test "$host_os" != "linux-gnu"; then +dnl If cross-compiling, just assume PortAudio exists if user provides headers/libs +if test "$cross_compiling" = yes; then + AC_MSG_CHECKING([for PortAudio library (cross-compile)]) + AC_MSG_RESULT([using provided build]) + have_portaudio=yes + have_portaudio_lib=yes +else + dnl Normal build: check for portaudio.h and link with libportaudio AC_CHECK_HEADER([portaudio.h], [have_portaudio=yes], [have_portaudio=no]) - if test "$cross_compiling" == yes; then - AC_CHECK_LIB([portaudio], [Pa_Initialize], [have_portaudio_lib=yes], [have_portaudio_lib=no]) - fi + AC_CHECK_LIB([portaudio], [Pa_Initialize], [have_portaudio_lib=yes], [have_portaudio_lib=no]) fi if test "$have_portaudio" = yes && test "$have_portaudio_lib" = yes; then From 9f5456ed461d21aa59f03f9fe88a58a7a6ff2897 Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 18:29:36 -0300 Subject: [PATCH 49/50] can't build with more than one audio library --- examples/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/Makefile.am b/examples/Makefile.am index ed1a904..db3bd15 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -14,10 +14,12 @@ alsaplay_SOURCES = alsaplay.cpp alsaplay_LDADD = $(LIBAUDIOFILE) if HAVE_ALSA +alsaplay_LDADD -= -lportaudio alsaplay_LDADD += -lasound endif if HAVE_PORTAUDIO +alsaplay_LDADD -= -lasound alsaplay_LDADD += -lportaudio endif From e93bfe52a603d45235d450299b6e0831eab11fdb Mon Sep 17 00:00:00 2001 From: rawr51919 Date: Sat, 16 Aug 2025 18:38:52 -0300 Subject: [PATCH 50/50] ensure the ALSA/PortAudio filtering logic works correctly --- examples/Makefile.am | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/Makefile.am b/examples/Makefile.am index db3bd15..8c40a76 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -13,14 +13,16 @@ LIBAUDIOFILE = $(top_builddir)/libaudiofile/libaudiofile.la alsaplay_SOURCES = alsaplay.cpp alsaplay_LDADD = $(LIBAUDIOFILE) +# If ALSA is available, remove PortAudio and add ALSA if HAVE_ALSA -alsaplay_LDADD -= -lportaudio -alsaplay_LDADD += -lasound + alsaplay_LDADD := $(filter-out -lportaudio,$(alsaplay_LDADD)) + alsaplay_LDADD += -lasound endif +# If PortAudio is available, remove ALSA and add PortAudio if HAVE_PORTAUDIO -alsaplay_LDADD -= -lasound -alsaplay_LDADD += -lportaudio + alsaplay_LDADD := $(filter-out -lasound,$(alsaplay_LDADD)) + alsaplay_LDADD += -lportaudio endif irixread_SOURCES = irixread.c sgi.c sgi.h