diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 061acfd..1c52b82 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,15 +1,26 @@ name: brew pr-pull + on: pull_request_target: types: - labeled + jobs: pr-pull: if: contains(github.event.pull_request.labels.*.name, 'pr-pull') - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 + permissions: + actions: read + checks: read + contents: write + issues: read + packages: write + pull-requests: write steps: - name: Set up Homebrew uses: Homebrew/actions/setup-homebrew@master + with: + token: ${{ github.token }} - name: Set up git uses: Homebrew/actions/git-user-config@master @@ -17,17 +28,18 @@ jobs: - name: Pull bottles env: HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }} + HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{ github.token }} + HOMEBREW_GITHUB_PACKAGES_USER: ${{ github.repository_owner }} PULL_REQUEST: ${{ github.event.pull_request.number }} - run: brew pr-pull --debug --tap=$GITHUB_REPOSITORY $PULL_REQUEST + run: brew pr-pull --debug --tap="$GITHUB_REPOSITORY" "$PULL_REQUEST" - name: Push commits uses: Homebrew/actions/git-try-push@master with: - token: ${{ github.token }} branch: main - name: Delete branch if: github.event.pull_request.head.repo.fork == false env: BRANCH: ${{ github.event.pull_request.head.ref }} - run: git push --delete origin $BRANCH + run: git push --delete origin "$BRANCH" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c2c756f..6c4e37c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,57 +1,63 @@ name: brew test-bot + on: push: branches: - main pull_request: + jobs: test-bot: strategy: matrix: + # I gave up on Linux Bottles because it was taking over 2 hours to build + # a bottle on Ubuntu 24.04. os: - # auto-multiple-choice: Re-enable Linux as soon as the qt@5 formula - # gets a bootle: https://github.com/Homebrew/linuxbrew-core/pull/23174 - # - # amc-pango: installation fails on linux with the error: - # /usr/bin/ld: cannot find -lintl - # collect2: error: ld returned 1 exit status - # Remember to re-enable it one day. - # - # - ubuntu-latest - - # https://github.com/actions/virtual-environments/#available-environments - - macos-11 - - macos-10.15 + - macos-14 + - macos-15 runs-on: ${{ matrix.os }} + permissions: + actions: read + checks: read + contents: read + packages: read + pull-requests: read steps: - name: Set up Homebrew id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@master + with: + token: ${{ github.token }} - name: Cache Homebrew Bundler RubyGems - id: cache - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ${{ steps.set-up-homebrew.outputs.gems-path }} - key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} - restore-keys: ${{ runner.os }}-rubygems- - - - name: Install Homebrew Bundler RubyGems - if: steps.cache.outputs.cache-hit != 'true' - run: brew install-bundler-gems + key: ${{ matrix.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} + restore-keys: ${{ matrix.os }}-rubygems- - run: brew test-bot --only-cleanup-before - run: brew test-bot --only-setup - run: brew test-bot --only-tap-syntax - - - run: brew test-bot --only-formulae + - name: Base64-encode GITHUB_TOKEN for HOMEBREW_DOCKER_REGISTRY_TOKEN + id: base64-encode + if: github.event_name == 'pull_request' + env: + TOKEN: ${{ github.token }} + run: | + base64_token=$(echo -n "${TOKEN}" | base64 | tr -d "\n") + echo "::add-mask::${base64_token}" + echo "token=${base64_token}" >> "${GITHUB_OUTPUT}" + - run: brew test-bot --only-formulae --root-url='https://ghcr.io/v2/${{ github.repository }}' if: github.event_name == 'pull_request' + env: + HOMEBREW_DOCKER_REGISTRY_TOKEN: ${{ steps.base64-encode.outputs.token }} - name: Upload bottles as artifact if: always() && github.event_name == 'pull_request' - uses: actions/upload-artifact@main + uses: actions/upload-artifact@v4 with: - name: bottles + name: bottles_${{ matrix.os }} path: "*.bottle.*" diff --git a/auto-multiple-choice.rb b/Formula/auto-multiple-choice.rb similarity index 95% rename from auto-multiple-choice.rb rename to Formula/auto-multiple-choice.rb index 7c028f9..7d5d055 100644 --- a/auto-multiple-choice.rb +++ b/Formula/auto-multiple-choice.rb @@ -1,9 +1,8 @@ class AutoMultipleChoice < Formula desc "Printable tests for students with OCR marking" homepage "https://www.auto-multiple-choice.net" - url "https://gitlab.com/jojo_boulix/auto-multiple-choice/uploads/3262cbab3161e5e63239a281e9a2ce23/auto-multiple-choice_1.5.0_dist.tar.gz" - sha256 "2e48ebb11a215c7882212c46f31d9013bb488c32899104008b0840e67f716948" - revision 0 + url "https://download.auto-multiple-choice.net/amc_1.7.0_dist.tar.gz" + sha256 "dfb916aa076f668a6f35253a2c0fc5998db07d2273deb45295a405d8749b7660" bottle do root_url "https://github.com/maelvls/homebrew-amc/releases/download/auto-multiple-choice-1.5.0" @@ -22,9 +21,10 @@ class AutoMultipleChoice < Formula # to remove the original PATH of the user so that the latex binaries can be # found. + depends_on "libpthread-stubs" => :build depends_on "librsvg" => :build depends_on "make" => :build # macOS system make (3.81) breaks vars-subs.pl - + # Although libpthread-stubs isn't actually needed on macOS, libxcb # used to require lib libpthread-stubs. Because Homebrew doesn't # systematically upgrade dependencies anymore, users may hit the @@ -38,22 +38,23 @@ class AutoMultipleChoice < Formula # to install auto-multiple-choice. We can remove this hack in # a few months. # See: https://github.com/maelvls/homebrew-amc/issues/82#issuecomment-1383690536 - depends_on "libpthread-stubs" => :build - + depends_on "adwaita-icon-theme" - depends_on "amc-pango" depends_on "cairo" + depends_on "expat" depends_on "freetype" depends_on "gettext" depends_on "glib" depends_on "gobject-introspection" depends_on "gtk+3" + depends_on "harfbuzz" depends_on "imagemagick@6" depends_on "libffi" depends_on "libx11" depends_on "netpbm" - depends_on "opencv" # vendored Pango, stuck at v1.42.4 + depends_on "opencv" depends_on "openssl@3" # required by Net::SSLeay + depends_on "pango" depends_on "perl" depends_on "poppler" depends_on "qpdf" @@ -420,14 +421,8 @@ class AutoMultipleChoice < Formula sha256 "40da40948ecc9c787ed39c95715872679eebfd54243721174993a2003e32ab0a" end resource "Net::SSLeay" do - url "https://cpan.metacpan.org/authors/id/C/CH/CHRISN/Net-SSLeay-1.90.tar.gz" - sha256 "f8696cfaca98234679efeedc288a9398fcf77176f1f515dbc589ada7c650dc93" - patch do - # To be removed as soon as Net::SSLeay is patched with a fix. See: - # https://trac.macports.org/ticket/63415 - url "https://gist.githubusercontent.com/maelvls/9a4890e7c5adf2309a453d0cdbffaa19/raw/e32a76eb40321de66bc40d5adff491267a907a0a/net-ssleay-1.90.diff" - sha256 "d4db9007ac4551a9f618e42e86d4b3484f8eca871bbf803668eb99a7ac0c1cdb" - end + url "https://cpan.metacpan.org/authors/id/C/CH/CHRISN/Net-SSLeay-1.94.tar.gz" + sha256 "9d7be8a56d1bedda05c425306cc504ba134307e0c09bda4a788c98744ebcd95d" end resource "Mozilla::CA" do url "https://cpan.metacpan.org/authors/id/A/AB/ABH/Mozilla-CA-20200520.tar.gz" @@ -457,6 +452,14 @@ class AutoMultipleChoice < Formula url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/YAML-Tiny-1.73.tar.gz" sha256 "bc315fa12e8f1e3ee5e2f430d90b708a5dc7e47c867dba8dce3a6b8fbe257744" end + resource "Hash::Merge" do + url "https://cpan.metacpan.org/authors/id/H/HE/HERMES/Hash-Merge-0.302.tar.gz" + sha256 "ae0522f76539608b61dde14670e79677e0f391036832f70a21f31adde2538644" + end + resource "Clone::Choose" do + url "https://cpan.metacpan.org/authors/id/H/HE/HERMES/Clone-Choose-0.010.tar.gz" + sha256 "5623481f58cee8edb96cd202aad0df5622d427e5f748b253851dfd62e5123632" + end def install installed = {} # helps me avoid installing the same perl package twice @@ -467,15 +470,15 @@ def install ENV.prepend_path "PATH", Formula["gobject-introspection"].bin ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["libffi"].lib}/pkgconfig" # for Glib::Object::Introspection ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["gobject-introspection"].lib}/pkgconfig" # Same - ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["amc-pango"].lib}/pkgconfig" # for Pango & AMC-buildpdf + ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["pango"].lib}/pkgconfig" # for Pango & AMC-buildpdf - ENV["OPENSSL_PREFIX"] = Formula["openssl@1.1"].prefix.to_s + ENV["OPENSSL_PREFIX"] = Formula["openssl@3"].prefix.to_s ENV["PERL_MM_OPT"] = "INSTALL_BASE=#{libexec}" # for cpan (Makefile.PL) ENV["PERL_MB_OPT"] = "--install_base '#{libexec}'" # for cpan (Build.PL) ENV["PERL_MM_USE_DEFAULT"] = "1" # for always saying "yes" in Makefile.PL # The Libertine font provided by 'brew cask' is 'Linux Libertine' (no O) - inreplace ["AMC-annotate.pl", "AMC-perl/AMC/Annotate.pm", "AMC-perl/AMC/Config.pm", + inreplace ["AMC-annotate.pl.in", "AMC-perl/AMC/Annotate.pm", "AMC-perl/AMC/Config.pm", "AMC-perl/AMC/Filter/plain.pm", "buildpdf.cc"], "Linux Libertine O", "Linux Libertine" # When using 'sudo auto-multiple-choice latex-link', make sure that the @@ -488,15 +491,18 @@ def install # broke things. Now c++11 is needed and I use pkg-config for conveniency. # And since pkg-config is used, CFLAGS, CXXFLAGS and LDFLAGS aren't needed # anymore. - inreplace "Makefile", "opencv\)", "opencv4)" + inreplace "Makefile", "opencv)", "opencv4)" inreplace "Makefile", "$(GCC_OPENCV) $(GCC_OPENCV_LIBS)", "$(GCC_OPENCV) $(GCC_OPENCV_LIBS) -std=c++11" inreplace "Makefile-brew.conf", /^GCC_.*/, "" inreplace "Makefile-brew.conf", /^CFLAGS.*/, "" inreplace "Makefile-brew.conf", /^CXXFLAGS.*/, "" inreplace "Makefile-brew.conf", /^LDFLAGS.*/, "" - # Override three variables that cannot be passed as make variables - # because they are reset in Makefile.conf. + # Override three variables that cannot be passed as make variables because + # they are reset in Makefile.conf. + # + # The CSSDIR should have been added directly to Makefile-brew.conf upstream + # before the 1.7.0 release. But since it wasn't, let's just set it here. (buildpath/"Makefile-brew.conf").append_lines <<~EOS DOCBOOK_MAN_XSL = #{Formula["docbook-xsl"].prefix}/docbook-xsl/manpages/docbook.xsl DOCBOOK_XHTML_XSL = #{Formula["docbook-xsl"].prefix}/docbook-xsl/xhtml/docbook.xsl @@ -505,6 +511,7 @@ def install PERLDIR=#{libexec}/lib/perl5 DESKTOPDIR= METAINFODIR= + CSSDIR=#{prefix}/share/auto-multiple-choice/gtk EOS # The actual build @@ -518,8 +525,8 @@ def install (bin/"auto-multiple-choice").write_env_script libexec/"bin/auto-multiple-choice", PERL5LIB: ENV["PERL5LIB"], # netpbm, poppler and imagemagick@6 must be in the PATH - PATH: "#{libexec}/bin:#{Formula["qpdf"].bin}:#{Formula["netpbm"].bin}"\ - ":#{Formula["poppler"].bin}:#{Formula["imagemagick@6"].bin}"\ + PATH: "#{libexec}/bin:#{Formula["qpdf"].bin}:#{Formula["netpbm"].bin}" \ + ":#{Formula["poppler"].bin}:#{Formula["imagemagick@6"].bin}" \ ":#{Formula["gobject-introspection"].bin}:$PATH", AMCBASEDIR: prefix @@ -625,6 +632,8 @@ def install Glib ExtUtils::PkgConfig ExtUtils::Depends + Hash::Merge + Clone::Choose Locale::gettext Module::Load::Conditional OpenOffice::OODoc @@ -762,12 +771,12 @@ def caveats <<~EOS If you don't have Mactex installed, you will need it: - brew install homebrew/cask/mactex + brew install mactex Where is automultiplechoice.sty? After installing, run: - sudo auto-multiple-choice latex-link remove - sudo auto-multiple-choice latex-link + sudo env PATH="$PATH" auto-multiple-choice latex-link remove + sudo env PATH="$PATH" auto-multiple-choice latex-link If you have any problem/remark regarding this formula, you can submit an issue to https://github.com/maelvls/homebrew-amc. diff --git a/README.md b/README.md index 52581f7..27b0f8d 100644 --- a/README.md +++ b/README.md @@ -7,16 +7,20 @@ | Install | Version | | ----------------------------------------------- | :-----: | -| `brew install maelvls/amc/auto-multiple-choice` | 1.5.0 | +| `brew install maelvls/amc/auto-multiple-choice` | 1.7.0 | -| macOS version | Support | Prebuilt binaries (bottles) | -|-----------------------------------|:-------:|:---------------------------:| -| macOS 12 Monterey (Intel) | ✔️ | ❌ | -| macOS 12 Monterey (Apple Silicon) | ✔️ | ❌ | -| macOS 11 Big Sur (Intel) | ✔️ | ✔️ | -| macOS 11 Big Sur (Apple Silicon) | ✔️ | ❌ | -| macOS 10 catalina (Intel) | ✔️ | ✔️ | -| linux (x86_64) | ❌ | ❌ | +| macOS version | Build from source | Bottle (Intel)\* | Bottle (Apple Silicon)\* | +|-------------------|:-----------------:|:----------------:|:------------------------:| +| macOS 15 Sequoia | ✔️ | ❌ | ❌ | +| macOS 14 Sonoma | ✔️ | ❌ | ✔️ | +| macOS 13 Ventura | ✔️ | ❌ | ❌ | +| macOS 12 Monterey | ✔️ | ❌ | ❌ | +| macOS 11 Big Sur | ✔️ | ❌ | ❌ | +| macOS 10 catalina | ✔️ | ❌ | ❌ | + +Regarding Linux, bottles are built for x86_64, but not for arm64. + +> \*Bottles are precompiled binaries that are faster to install. - **To run it**: open [terminal](https://www.iterm2.com) and run `auto-multiple-choice`. @@ -35,6 +39,17 @@ using GitHub Actions. The bottles are uploaded to GitHub Packages. ## News +### May 9, 2025: 1.7.0 released! + +The new version of `auto-multiple-choice` is out! Bottles are now available for +macOS 14 Sonoma (Apple Silicon only). Bottles for macOS 15 Sequoia will come +soon ([as soon as opencv gets a bottle for +Sequoia](https://github.com/maelvls/homebrew-amc/pull/96)). + +Looking at the analytics, the number of installations went down to 570 for the +past year, which makes sense since I haven't been keeping up with issues and +releases. + ### Dec 4, 2021: M1 support, 1083 installations in 2021! The formula finally supports M1 macs! Note that prebuilt bottles (= faster install time) are not available since it would require renting an M1 mac. I have enable GitHub sponsoring for that reason. @@ -390,7 +405,7 @@ think the whole idea of a formula that vendors everything is insane. I went to and I copy-pasted the tree of dependencies (except for 'Core modules') into a Ruby array. For example: -```ruby +```text "XML::Simple", "XML::SAX", "XML::NamespaceSupport", @@ -400,9 +415,14 @@ I went to and I copy-pasted the tree of dependenci I then gather all the ruby array with all dependencies (for example the previous example) into a file `list_of_deps`. -Then I run +Then I run: - ./list_to_resources.pl < list_of_deps > resources +```bash +# Without tests +brew install cpanm +cpanm --notest MetaCPAN::Client +./list_to_resources.pl < list_of_deps > resources +``` and I copy everything in `resources` to the formula. diff --git a/amc-pango.rb b/amc-pango.rb deleted file mode 100644 index 2834d0e..0000000 --- a/amc-pango.rb +++ /dev/null @@ -1,97 +0,0 @@ -# Vendor Pango because of a 'bug' unidentified. -# https://github.com/maelvls/homebrew-amc/issues/33 -# https://project.auto-multiple-choice.net/boards/4/topics/8855?r=8904#message-8904 -class AmcPango < Formula - desc "(vendored) Framework for layout and rendering of i18n text" - homepage "https://www.pango.org/" - url "https://download.gnome.org/sources/pango/1.42/pango-1.42.4.tar.xz" - sha256 "1d2b74cd63e8bd41961f2f8d952355aa0f9be6002b52c8aa7699d9f5da597c9d" - revision 2 - - bottle do - root_url "https://github.com/maelvls/homebrew-amc/releases/download/amc-pango-1.42.4_2" - sha256 big_sur: "f368cc6c6e45310d77104f6ea070dfef663a08a8de2fde0ed203d25f5e24b1bc" - sha256 catalina: "e44ae5b473c17c5ecbfabb38aa6c8648f3d81938eddddaf9b0728d92de685038" - end - - head do - url "https://gitlab.gnome.org/GNOME/pango.git" - - depends_on "autoconf" => :build - depends_on "automake" => :build - depends_on "gtk-doc" => :build - depends_on "libtool" => :build - end - - keg_only "vendored version of Homebrew's pango" - - depends_on "gobject-introspection" => :build - depends_on "pkg-config" => :build - depends_on "cairo" - depends_on "fontconfig" - depends_on "fribidi" - depends_on "glib" - depends_on "harfbuzz" - - def install - system "./autogen.sh" if build.head? - system "./configure", "--disable-dependency-tracking", - "--disable-silent-rules", - "--prefix=#{prefix}", - "--with-html-dir=#{share}/doc", - "--enable-introspection=yes", - "--enable-static", - "--without-xft" - - system "make" - system "make", "install" - end - - test do - system "#{bin}/pango-view", "--version" - (testpath/"test.c").write <<~EOS - #include - - int main(int argc, char *argv[]) { - PangoFontMap *fontmap; - int n_families; - PangoFontFamily **families; - fontmap = pango_cairo_font_map_get_default(); - pango_font_map_list_families (fontmap, &families, &n_families); - g_free(families); - return 0; - } - EOS - cairo = Formula["cairo"] - fontconfig = Formula["fontconfig"] - freetype = Formula["freetype"] - gettext = Formula["gettext"] - glib = Formula["glib"] - libpng = Formula["libpng"] - pixman = Formula["pixman"] - flags = %W[ - -I#{cairo.opt_include}/cairo - -I#{fontconfig.opt_include} - -I#{freetype.opt_include}/freetype2 - -I#{gettext.opt_include} - -I#{glib.opt_include}/glib-2.0 - -I#{glib.opt_lib}/glib-2.0/include - -I#{include}/pango-1.0 - -I#{libpng.opt_include}/libpng16 - -I#{pixman.opt_include}/pixman-1 - -D_REENTRANT - -L#{cairo.opt_lib} - -L#{gettext.opt_lib} - -L#{glib.opt_lib} - -L#{lib} - -lcairo - -lglib-2.0 - -lgobject-2.0 - -lintl - -lpango-1.0 - -lpangocairo-1.0 - ] - system ENV.cc, "test.c", "-o", "test", *flags - system "./test" - end -end