Skip to content

Instantly share code, notes, and snippets.

@munepi
Last active April 12, 2020 19:33
Show Gist options
  • Save munepi/d55b5c8441427ff6f47e682c44d185cc to your computer and use it in GitHub Desktop.
Save munepi/d55b5c8441427ff6f47e682c44d185cc to your computer and use it in GitHub Desktop.
Unofficial Homebrew Formula for po4a https://po4a.org/
class Po4a < Formula
desc "Tools to ease the translation of documentation"
homepage "https://po4a.org/"
url "http://ftp.debian.org/debian/pool/main/p/po4a/po4a_0.54.orig.tar.gz"
mirror "https://github.com/mquinson/po4a/releases/download/v0.54/po4a-0.54.tar.gz"
sha256 "596f7621697f9dd12709958c229e256b56683d25997ac73c9625a2cc0c603d51"
head "https://github.com/mquinson/po4a.git"
depends_on "libxslt"
depends_on "docbook"
depends_on "docbook-xsl"
depends_on "open-sp"
depends_on "perl" => :build
# brew uninstall --ignore-dependencies --force gettext
# brew install gettext
# brew link gettext --force
depends_on "gettext" => :build
resource "Data::Dumper" do
url "https://cpan.metacpan.org/authors/id/X/XS/XSAWYERX/Data-Dumper-2.172.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/X/XS/XSAWYERX/Data-Dumper-2.172.tar.gz"
sha256 "a95a3037163817221021ac145500968be44dc155c261f4097136392c0a9fecd9"
end
resource "ExtUtils::Manifest" do
url "https://cpan.metacpan.org/authors/id/B/BI/BINGOS/ExtUtils-Manifest-1.71.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/B/BI/BINGOS/ExtUtils-Manifest-1.71.tar.gz"
sha256 "00671b88ece23de3633a554cf3432d4b8351a598c55a79bfdb7ea1e3219747e1"
end
resource "File::Path" do
url "https://cpan.metacpan.org/authors/id/J/JK/JKEENAN/File-Path-2.16.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/J/JK/JKEENAN/File-Path-2.16.tar.gz"
sha256 "21f7d69b59c381f459c5f0bf697d512109bd911f12ca33270b70ca9a9ef6fa05"
end
resource "File::Path" do
url "https://cpan.metacpan.org/authors/id/J/JV/JV/Getopt-Long-2.50.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/J/JV/JV/Getopt-Long-2.50.tar.gz"
sha256 "20881adb2b73e83825f9a0a3b141db11b3a555e1d3775b13d81d0481623e4b67"
end
resource "HTML::Parser" do
url "https://cpan.metacpan.org/authors/id/G/GA/GAAS/HTML-Parser-3.72.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/G/GA/GAAS/HTML-Parser-3.72.tar.gz"
sha256 "ec28c7e1d9e67c45eca197077f7cdc41ead1bb4c538c7f02a3296a4bb92f608b"
end
resource "parent" do
url "https://cpan.metacpan.org/authors/id/C/CO/CORION/parent-0.237.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/C/CO/CORION/parent-0.237.tar.gz"
sha256 "1089d9648565c1d1e655fa4cb603272d3126747b7b5f836ffee685e27e53caae"
end
resource "PathTools" do
url "https://cpan.metacpan.org/authors/id/X/XS/XSAWYERX/PathTools-3.75.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/X/XS/XSAWYERX/PathTools-3.75.tar.gz"
sha256 "a558503aa6b1f8c727c0073339081a77888606aa701ada1ad62dd9d8c3f945a2"
end
resource "Text::ParseWords" do
url "https://cpan.metacpan.org/authors/id/C/CH/CHORNY/Text-ParseWords-3.30.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/C/CH/CHORNY/Text-ParseWords-3.30.tar.gz"
sha256 "85e0238179dd43997e58c66bd51611182bc7d533505029a2db0d3232edaff5e8"
end
# * Locale::gettext (v1.01)
# resource "Locale::Gettext" do
# url "http://search.cpan.org/CPAN/authors/id/P/PV/PVANDRY/gettext-1.01.tar.gz"
# mirror "http://search.mcpan.org/CPAN/authors/id/P/PV/PVANDRY/gettext-1.01.tar.gz"
# sha256 "529309e8bb70d2e4fd47cbe8519d9571cc1a50de187f311c7159fd3ed8deb9e0"
# end
resource "Locale::Gettext" do
url "http://search.cpan.org/CPAN/authors/id/P/PV/PVANDRY/gettext-1.07.tar.gz"
mirror "http://search.mcpan.org/CPAN/authors/id/P/PV/PVANDRY/gettext-1.07.tar.gz"
sha256 "909d47954697e7c04218f972915b787bd1244d75e3bd01620bc167d5bbc49c15"
end
resource "Module::Build" do
url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4224.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-0.4224.tar.gz"
sha256 "a6ca15d78244a7b50fdbf27f85c85f4035aa799ce7dd018a0d98b358ef7bc782"
end
# * SGMLS (1.03ii)
resource "SGMLS" do
url "https://cpan.metacpan.org/authors/id/R/RA/RAAB/SGMLSpm-1.1.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/R/RA/RAAB/SGMLSpm-1.1.tar.gz"
sha256 "550c9245291c8df2242f7e88f7921a0f636c7eec92c644418e7d89cfea70b2bd"
end
# * opensp (1.5.2)
resource "Term::ReadKey" do
url "https://cpan.metacpan.org/authors/id/J/JS/JSTOWE/TermReadKey-2.37.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/J/JS/JSTOWE/TermReadKey-2.37.tar.gz"
sha256 "4a9383cf2e0e0194668fe2bd546e894ffad41d556b41d2f2f577c8db682db241"
end
resource "Text::WrapI18N" do
url "http://search.cpan.org/CPAN/authors/id/K/KU/KUBOTA/Text-WrapI18N-0.06.tar.gz"
mirror "http://search.mcpan.org/CPAN/authors/id/K/KU/KUBOTA/Text-WrapI18N-0.06.tar.gz"
sha256 "4bd29a17f0c2c792d12c1005b3c276f2ab0fae39c00859ae1741d7941846a488"
end
resource "Unicode::GCString" do
url "http://search.cpan.org/CPAN/authors/id/N/NE/NEZUMI/Unicode-LineBreak-2018.003.tar.gz"
mirror "http://search.mcpan.org/CPAN/authors/id/N/NE/NEZUMI/Unicode-LineBreak-2018.003.tar.gz"
sha256 "860c92ff3e710f0a1ca3e7067dba3734540dfb5cb932936536225f7ffca571b1"
end
# * YAML::Tiny
resource "YAML::Tiny" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/YAML-Tiny-1.73.tar.gz"
mirror "https://cpan.metacpan.org/authors/id/E/ET/ETHER/YAML-Tiny-1.73.tar.gz"
sha256 "bc315fa12e8f1e3ee5e2f430d90b708a5dc7e47c867dba8dce3a6b8fbe257744"
end
def install
ENV.prepend_create_path "PERL5LIB", libexec+"lib/perl5"
## pass to test for po4a
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog"
# ENV.prepend_create_path "XML_CATALOG_FILES", "#{etc}/xml/catalog"
ENV["LDFLAGS"] = "-L#{Formula["gettext"].opt_lib} -lintl -pthread"
ENV["CFLAGS"] = "-I#{Formula["gettext"].opt_include}"
ENV["CPPFLAGS"] = "-I#{Formula["gettext"].opt_include}"
resources.each do |r|
r.stage do
system "chmod", "-R", "u+rwX,g+rx,o+rx", "." #<= FIXME
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make", "install"
end
end
%w[po4a po4a-gettextize po4a-normalize po4a-translate po4a-updatepo].each do |f|
chmod 0644, f # FIXME
inreplace f, "use warnings", "use warnings;\nuse lib '#{lib}/perl5/site_perl';"
end
system "perl", "Build.PL", "--prefix", prefix
system "./Build"
system "./Build", "install"
bin.env_script_all_files(libexec+"bin", "PERL5LIB" => ENV["PERL5LIB"])
end
test do
system bin/"po4a", "--version"
system bin/"po4a-build", "--version"
system bin/"po4a-gettextize", "--version"
system bin/"po4a-normalize", "--version"
system bin/"po4a-translate", "--version"
system bin/"po4a-updatepo", "--version"
system bin/"po4aman-display-po", "-h"
system bin/"po4apod-display-po", "-h"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment