@@ -446,102 +446,103 @@ class AutoMultipleChoice < Formula
446446 def install
447447 installed = { } # helps me avoid installing the same perl package twice
448448
449- ENV . prepend_create_path "PERL5LIB" , libexec /"lib/perl5"
450- ENV . prepend_path "PATH" , Formula [ "gettext" ] . bin # for msgfmt during build
451- ENV . prepend_path "PATH" , Formula [ "make" ] . libexec /"gnubin" # system's make (3.81) too old
452- ENV . prepend_path "PATH" , Formula [ "gobject-introspection" ] . bin
453- ENV . prepend_path "PKG_CONFIG_PATH" , "#{ Formula [ "libffi" ] . lib } /pkgconfig" # for Glib::Object::Introspection
454- ENV . prepend_path "PKG_CONFIG_PATH" , "#{ Formula [ "gobject-introspection" ] . lib } /pkgconfig" # Same
455- ENV . prepend_path "PKG_CONFIG_PATH" , "#{ Formula [ "pango" ] . lib } /pkgconfig" # for Pango & AMC-buildpdf
449+ cd "auto-multiple-choice-#{ version } " do
450+ ENV . prepend_create_path "PERL5LIB" , libexec /"lib/perl5"
451+ ENV . prepend_path "PATH" , Formula [ "gettext" ] . bin # for msgfmt during build
452+ ENV . prepend_path "PATH" , Formula [ "make" ] . libexec /"gnubin" # system's make (3.81) too old
453+ ENV . prepend_path "PATH" , Formula [ "gobject-introspection" ] . bin
454+ ENV . prepend_path "PKG_CONFIG_PATH" , "#{ Formula [ "libffi" ] . lib } /pkgconfig" # for Glib::Object::Introspection
455+ ENV . prepend_path "PKG_CONFIG_PATH" , "#{ Formula [ "gobject-introspection" ] . lib } /pkgconfig" # Same
456+ ENV . prepend_path "PKG_CONFIG_PATH" , "#{ Formula [ "pango" ] . lib } /pkgconfig" # for Pango & AMC-buildpdf
456457
457- ENV [ "OPENSSL_PREFIX" ] = Formula [ "openssl@3" ] . prefix . to_s
458- ENV [ "PERL_MM_OPT" ] = "INSTALL_BASE=#{ libexec } " # for cpan (Makefile.PL)
459- ENV [ "PERL_MB_OPT" ] = "--install_base '#{ libexec } '" # for cpan (Build.PL)
460- ENV [ "PERL_MM_USE_DEFAULT" ] = "1" # for always saying "yes" in Makefile.PL
458+ ENV [ "OPENSSL_PREFIX" ] = Formula [ "openssl@3" ] . prefix . to_s
459+ ENV [ "PERL_MM_OPT" ] = "INSTALL_BASE=#{ libexec } " # for cpan (Makefile.PL)
460+ ENV [ "PERL_MB_OPT" ] = "--install_base '#{ libexec } '" # for cpan (Build.PL)
461+ ENV [ "PERL_MM_USE_DEFAULT" ] = "1" # for always saying "yes" in Makefile.PL
461462
462- # The Libertine font provided by 'brew cask' is 'Linux Libertine' (no O)
463- inreplace [ "AMC-annotate.pl" , "AMC-perl/AMC/Annotate.pm" , "AMC-perl/AMC/Config.pm" ,
464- "AMC-perl/AMC/Filter/plain.pm" , "buildpdf.cc" ] , "Linux Libertine O" , "Linux Libertine"
463+ # The Libertine font provided by 'brew cask' is 'Linux Libertine' (no O)
464+ inreplace [ "AMC-annotate.pl" , "AMC-perl/AMC/Annotate.pm" , "AMC-perl/AMC/Config.pm" ,
465+ "AMC-perl/AMC/Filter/plain.pm" , "buildpdf.cc" ] , "Linux Libertine O" , "Linux Libertine"
465466
466- # When using 'sudo auto-multiple-choice latex-link', make sure that the
467- # symlink used in 'latex-link' is not version-hardcoded so that
468- # 'brew upgrade' won't require a 'latex-link' afterwards.
469- # Why? Because @/TEXDIR/@ is using #{prefix} which changes on each version.
470- inreplace "AMC-latex-link.pl.in" , "@/TEXDIR/@" , opt_share /"texmf-local/tex/latex/AMC"
467+ # When using 'sudo auto-multiple-choice latex-link', make sure that the
468+ # symlink used in 'latex-link' is not version-hardcoded so that
469+ # 'brew upgrade' won't require a 'latex-link' afterwards.
470+ # Why? Because @/TEXDIR/@ is using #{prefix} which changes on each version.
471+ inreplace "AMC-latex-link.pl.in" , "@/TEXDIR/@" , opt_share /"texmf-local/tex/latex/AMC"
471472
472- # These are needed because Homebrew moved to opencv4 on Dec. 28, 2018 and it
473- # broke things. Now c++11 is needed and I use pkg-config for conveniency.
474- # And since pkg-config is used, CFLAGS, CXXFLAGS and LDFLAGS aren't needed
475- # anymore.
476- inreplace "Makefile" , "opencv)" , "opencv4)"
477- inreplace "Makefile" , "$(GCC_OPENCV) $(GCC_OPENCV_LIBS)" , "$(GCC_OPENCV) $(GCC_OPENCV_LIBS) -std=c++11"
478- inreplace "Makefile-brew.conf" , /^GCC_.*/ , ""
479- inreplace "Makefile-brew.conf" , /^CFLAGS.*/ , ""
480- inreplace "Makefile-brew.conf" , /^CXXFLAGS.*/ , ""
481- inreplace "Makefile-brew.conf" , /^LDFLAGS.*/ , ""
473+ # These are needed because Homebrew moved to opencv4 on Dec. 28, 2018 and it
474+ # broke things. Now c++11 is needed and I use pkg-config for conveniency.
475+ # And since pkg-config is used, CFLAGS, CXXFLAGS and LDFLAGS aren't needed
476+ # anymore.
477+ inreplace "Makefile" , "opencv)" , "opencv4)"
478+ inreplace "Makefile" , "$(GCC_OPENCV) $(GCC_OPENCV_LIBS)" , "$(GCC_OPENCV) $(GCC_OPENCV_LIBS) -std=c++11"
479+ inreplace "Makefile-brew.conf" , /^GCC_.*/ , ""
480+ inreplace "Makefile-brew.conf" , /^CFLAGS.*/ , ""
481+ inreplace "Makefile-brew.conf" , /^CXXFLAGS.*/ , ""
482+ inreplace "Makefile-brew.conf" , /^LDFLAGS.*/ , ""
482483
483- # Override three variables that cannot be passed as make variables
484- # because they are reset in Makefile.conf.
485- ( buildpath /"Makefile-brew.conf" ) . append_lines <<~EOS
486- DOCBOOK_MAN_XSL = #{ Formula [ "docbook-xsl" ] . prefix } /docbook-xsl/manpages/docbook.xsl
487- DOCBOOK_XHTML_XSL = #{ Formula [ "docbook-xsl" ] . prefix } /docbook-xsl/xhtml/docbook.xsl
488- DOCBOOK_DTD = #{ Formula [ "docbook" ] . prefix } /docbook/xml/4.5/docbookx.dtd
489- PERLPATH=#{ Formula [ "perl" ] . bin } /perl
490- PERLDIR=#{ libexec } /lib/perl5
491- DESKTOPDIR=
492- METAINFODIR=
493- EOS
484+ # Override three variables that cannot be passed as make variables
485+ # because they are reset in Makefile.conf.
486+ ( buildpath /"Makefile-brew.conf" ) . append_lines <<~EOS
487+ DOCBOOK_MAN_XSL = #{ Formula [ "docbook-xsl" ] . prefix } /docbook-xsl/manpages/docbook.xsl
488+ DOCBOOK_XHTML_XSL = #{ Formula [ "docbook-xsl" ] . prefix } /docbook-xsl/xhtml/docbook.xsl
489+ DOCBOOK_DTD = #{ Formula [ "docbook" ] . prefix } /docbook/xml/4.5/docbookx.dtd
490+ PERLPATH=#{ Formula [ "perl" ] . bin } /perl
491+ PERLDIR=#{ libexec } /lib/perl5
492+ DESKTOPDIR=
493+ METAINFODIR=
494+ EOS
494495
495- # The actual build
496- make_opts = "AMCCONF=brew" , "PREFIX=#{ prefix } " , "LIBS_PREFIX=#{ HOMEBREW_PREFIX } "
497- system "make" , *make_opts
498- system "make" , "install_doc" , *make_opts
499- system "make" , "install_nodoc" , *make_opts
496+ # The actual build
497+ make_opts = "AMCCONF=brew" , "PREFIX=#{ prefix } " , "LIBS_PREFIX=#{ HOMEBREW_PREFIX } "
498+ system "make" , *make_opts
499+ system "make" , "install_doc" , *make_opts
500+ system "make" , "install_nodoc" , *make_opts
500501
501- mkdir_p libexec /"bin"
502- mv bin /"auto-multiple-choice" , libexec /"bin/auto-multiple-choice"
503- ( bin /"auto-multiple-choice" ) . write_env_script libexec /"bin/auto-multiple-choice" ,
504- PERL5LIB : ENV [ "PERL5LIB" ] ,
505- # netpbm, poppler and imagemagick@6 must be in the PATH
506- PATH : "#{ libexec } /bin:#{ Formula [ "qpdf" ] . bin } :#{ Formula [ "netpbm" ] . bin } " \
507- ":#{ Formula [ "poppler" ] . bin } :#{ Formula [ "imagemagick@6" ] . bin } " \
508- ":#{ Formula [ "gobject-introspection" ] . bin } :$PATH" ,
509- AMCBASEDIR : prefix
502+ mkdir_p libexec /"bin"
503+ mv bin /"auto-multiple-choice" , libexec /"bin/auto-multiple-choice"
504+ ( bin /"auto-multiple-choice" ) . write_env_script libexec /"bin/auto-multiple-choice" ,
505+ PERL5LIB : ENV [ "PERL5LIB" ] ,
506+ # netpbm, poppler and imagemagick@6 must be in the PATH
507+ PATH : "#{ libexec } /bin:#{ Formula [ "qpdf" ] . bin } :#{ Formula [ "netpbm" ] . bin } " \
508+ ":#{ Formula [ "poppler" ] . bin } :#{ Formula [ "imagemagick@6" ] . bin } " \
509+ ":#{ Formula [ "gobject-introspection" ] . bin } :$PATH" ,
510+ AMCBASEDIR : prefix
510511
511- # Here are all the perl dependencies that we will vendor (= install locally
512- # only for this recipe):
513- # - Archive::Zip
514- # - Clone
515- # - DBD::SQLite
516- # - Digest::MD5
517- # - Email::MIME
518- # - Email::Sender
519- # - File::BaseDir
520- # - File::MimeInfo
521- # - Glib::Object::Introspection
522- # - Gtk3
523- # - Locale::Gettext
524- # - Module::Load::Conditional
525- # - OpenOffice::OODoc
526- # - Image::Magick
527- # - Text::CSV
528- # - XML::Simple
529- # - XML::Writer
512+ # Here are all the perl dependencies that we will vendor (= install locally
513+ # only for this recipe):
514+ # - Archive::Zip
515+ # - Clone
516+ # - DBD::SQLite
517+ # - Digest::MD5
518+ # - Email::MIME
519+ # - Email::Sender
520+ # - File::BaseDir
521+ # - File::MimeInfo
522+ # - Glib::Object::Introspection
523+ # - Gtk3
524+ # - Locale::Gettext
525+ # - Module::Load::Conditional
526+ # - OpenOffice::OODoc
527+ # - Image::Magick
528+ # - Text::CSV
529+ # - XML::Simple
530+ # - XML::Writer
530531
531- # 1) To create the following array with a hierarchy-like indentation,
532- # I went to http://deps.cpantesters.org for each package and copied
533- # the resulting table with the dependency hierarchy and used:
534- # cat deps_archive_zip | sed 's/-\t//g' | sed '/^.*Core module.*$/d' | \
535- # sed 's/^\(.*\) Bugreports.*$/\1/g' | sed 's/[ \t]*$//g' | \
536- # sed 's/^\( *\)\([^ ]*\)$/\1"\2",/g' | sed 's/ "/"/g' | sed 's/ / /g'
532+ # 1) To create the following array with a hierarchy-like indentation,
533+ # I went to http://deps.cpantesters.org for each package and copied
534+ # the resulting table with the dependency hierarchy and used:
535+ # cat deps_archive_zip | sed 's/-\t//g' | sed '/^.*Core module.*$/d' | \
536+ # sed 's/^\(.*\) Bugreports.*$/\1/g' | sed 's/[ \t]*$//g' | \
537+ # sed 's/^\( *\)\([^ ]*\)$/\1"\2",/g' | sed 's/ "/"/g' | sed 's/ / /g'
537538
538- # 2) From this array, I create the 'resource ... do ... end' using:
539- # ./list_to_resources.pl < ruby_list > resources
540- # The code of "list_to_resources.pl" is showed at the end of this file.
539+ # 2) From this array, I create the 'resource ... do ... end' using:
540+ # ./list_to_resources.pl < ruby_list > resources
541+ # The code of "list_to_resources.pl" is showed at the end of this file.
541542
542- # Note that duplicates are allowed; only the first package from the
543- # bottom will be installed.
544- "
543+ # Note that duplicates are allowed; only the first package from the
544+ # bottom will be installed.
545+ "
545546 Pango
546547 ExtUtils::Depends
547548 Glib
@@ -663,7 +664,8 @@ def install
663664 File::Remove
664665 YAML::Tiny
665666 " . each_line . reverse_each . map ( &:strip ) . reject ( &:empty? ) . each do |package |
666- install_perl_package ( package , installed )
667+ install_perl_package ( package , installed )
668+ end
667669 end
668670 end
669671
0 commit comments