Compare commits
39
Commits
gcc_fix_g5
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5ed5a851e | ||
|
|
302295537d | ||
|
|
2b3f9c7b25 | ||
|
|
2fa0b4d8b0 | ||
|
|
22f34dd7db | ||
|
|
f8eb7ddd35 | ||
|
|
82e130df9f | ||
|
|
f0e8417be4 | ||
|
|
431181406f | ||
|
|
e8217afe1b | ||
|
|
63d275701b | ||
|
|
d387bb74ea | ||
|
|
ff986520d1 | ||
|
|
20f97682ac | ||
|
|
f447a8a640 | ||
|
|
37491333e6 | ||
|
|
1e620f5e7d | ||
|
|
e0daa8cb68 | ||
|
|
a2bdd1c804 | ||
|
|
b48d6bd5af | ||
|
|
36827d7637 | ||
|
|
e6522ee54e | ||
|
|
da9c583c2d | ||
|
|
d0625075ea | ||
|
|
458e371515 | ||
|
|
02c724dd21 | ||
|
|
03f7f8cbd2 | ||
|
|
975edee3a7 | ||
|
|
4b379beae2 | ||
|
|
acb6c9febe | ||
|
|
421a659181 | ||
|
|
a400253621 | ||
|
|
a11591ba69 | ||
|
|
9e81b8295b | ||
|
|
e1334e7b95 | ||
|
|
edf2aa9573 | ||
|
|
2ba239c9ab | ||
|
|
cff044e22e | ||
|
|
78661fd581 |
No files matched your search
+1
-1
@@ -157,7 +157,7 @@ class Cmd
|
||||
"-fuse-linker-plugin"
|
||||
# clang doesn't support these flags
|
||||
args << arg unless tool =~ /^clang/
|
||||
when "-Wno-deprecated-register"
|
||||
when "-Wno-deprecated-register", "-Wno-implicit-fallthrough"
|
||||
# older gccs don't support these flags
|
||||
args << arg unless tool =~ /^g..-4.[02]/
|
||||
when /^-W[alp],/, /^-Wno-/
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
class Coreutils < Formula
|
||||
desc "GNU File, Shell, and Text utilities"
|
||||
homepage "https://www.gnu.org/software/coreutils"
|
||||
url "https://ftpmirror.gnu.org/coreutils/coreutils-8.25.tar.xz"
|
||||
mirror "https://ftp.gnu.org/gnu/coreutils/coreutils-8.25.tar.xz"
|
||||
sha256 "31e67c057a5b32a582f26408c789e11c2e8d676593324849dcf5779296cdce87"
|
||||
url "https://ftp.gnu.org/gnu/coreutils/coreutils-8.30.tar.xz"
|
||||
mirror "https://ftpmirror.gnu.org/coreutils/coreutils-8.30.tar.xz"
|
||||
sha256 "e831b3a86091496cdba720411f9748de81507798f6130adeaef872d206e1b057"
|
||||
|
||||
bottle do
|
||||
sha256 "1714a4893ba37f9fb1a908e5bd79e45594034daa3ff08d8273713030498d5c1b" => :sierra
|
||||
sha256 "3b278ce91252784e43d2f16fc813e72a7bd04e637627bf2916c9f847ef600d89" => :el_capitan
|
||||
sha256 "dadb2d672a6b412d03b2470459d0ccb229bf7aa1c587b04809e7f19a439a640e" => :yosemite
|
||||
sha256 "1b68974d496006908a2f538a6a7e35b3bee7eba2247afec4e1568b28d0d83c5c" => :mavericks
|
||||
sha256 "45157fb067a46c953bdfcba90de688903b7b3c8fcb39afa1e0b2fef2819eedc5" => :mojave
|
||||
sha256 "77b09dbe66f3d5098998da6babf953e01e828742b8a740a831cc3f3a1f713df7" => :high_sierra
|
||||
sha256 "94844581b7e08ae2d1dc6c77acfd6e95021283cc8b7c1228fed32a423ae826cc" => :sierra
|
||||
sha256 "a5145f88de2525d168ef998f8310d5c0abcead9efee9108fb61c30de91a4869c" => :el_capitan
|
||||
end
|
||||
|
||||
conflicts_with "ganglia", :because => "both install `gstat` binaries"
|
||||
conflicts_with "idutils", :because => "both install `gid` and `gid.1`"
|
||||
conflicts_with "aardvark_shell_utils", :because => "both install `realpath` binaries"
|
||||
|
||||
head do
|
||||
url "git://git.sv.gnu.org/coreutils"
|
||||
url "https://git.savannah.gnu.org/git/coreutils.git"
|
||||
|
||||
depends_on "autoconf" => :build
|
||||
depends_on "automake" => :build
|
||||
@@ -30,18 +26,28 @@ class Coreutils < Formula
|
||||
|
||||
depends_on "gmp" => :optional
|
||||
|
||||
conflicts_with "ganglia", :because => "both install `gstat` binaries"
|
||||
conflicts_with "gegl", :because => "both install `gcut` binaries"
|
||||
conflicts_with "idutils", :because => "both install `gid` and `gid.1`"
|
||||
conflicts_with "aardvark_shell_utils", :because => "both install `realpath` binaries"
|
||||
|
||||
def install
|
||||
# Work around unremovable, nested dirs bug that affects lots of
|
||||
# GNU projects. See:
|
||||
# https://github.com/Homebrew/homebrew/issues/45273
|
||||
# https://github.com/Homebrew/homebrew/issues/44993
|
||||
# This is thought to be an el_capitan bug:
|
||||
# https://lists.gnu.org/archive/html/bug-tar/2015-10/msg00017.html
|
||||
if MacOS.version == :el_capitan
|
||||
# Work around unremovable, nested dirs bug that affects lots of
|
||||
# GNU projects. See:
|
||||
# https://github.com/Homebrew/homebrew/issues/45273
|
||||
# https://github.com/Homebrew/homebrew/issues/44993
|
||||
# This is thought to be an el_capitan bug:
|
||||
# https://lists.gnu.org/archive/html/bug-tar/2015-10/msg00017.html
|
||||
ENV["gl_cv_func_getcwd_abort_bug"] = "no"
|
||||
|
||||
# renameatx_np and RENAME_EXCL are available at compile time from Xcode 8
|
||||
# (10.12 SDK), but the former is not available at runtime.
|
||||
inreplace "lib/renameat2.c", "defined RENAME_EXCL", "defined UNDEFINED_GIBBERISH"
|
||||
end
|
||||
|
||||
system "./bootstrap" if build.head?
|
||||
|
||||
args = %W[
|
||||
--prefix=#{prefix}
|
||||
--program-prefix=g
|
||||
@@ -64,20 +70,15 @@ class Coreutils < Formula
|
||||
man1.install_symlink "grealpath.1" => "realpath.1"
|
||||
end
|
||||
|
||||
def caveats; <<-EOS.undent
|
||||
def caveats; <<~EOS
|
||||
All commands have been installed with the prefix 'g'.
|
||||
|
||||
If you really need to use these commands with their normal names, you
|
||||
can add a "gnubin" directory to your PATH from your bashrc like:
|
||||
|
||||
PATH="#{opt_libexec}/gnubin:$PATH"
|
||||
|
||||
Additionally, you can access their man pages with normal names if you add
|
||||
the "gnuman" directory to your MANPATH from your bashrc as well:
|
||||
|
||||
MANPATH="#{opt_libexec}/gnuman:$MANPATH"
|
||||
|
||||
EOS
|
||||
EOS
|
||||
end
|
||||
|
||||
def coreutils_filenames(dir)
|
||||
@@ -92,6 +93,7 @@ class Coreutils < Formula
|
||||
test do
|
||||
(testpath/"test").write("test")
|
||||
(testpath/"test.sha1").write("a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 test")
|
||||
system "#{bin}/gsha1sum", "-c", "test.sha1"
|
||||
system bin/"gsha1sum", "-c", "test.sha1"
|
||||
system bin/"gln", "-f", "test", "test.sha1"
|
||||
end
|
||||
end
|
||||
@@ -1,8 +1,8 @@
|
||||
class Dpkg < Formula
|
||||
desc "Debian package management system"
|
||||
homepage "https://wiki.debian.org/Teams/Dpkg"
|
||||
url "https://mirrors.kernel.org/debian/pool/main/d/dpkg/dpkg_1.18.2.tar.xz"
|
||||
mirror "https://mirrors.ocf.berkeley.edu/debian/pool/main/d/dpkg/dpkg_1.18.2.tar.xz"
|
||||
url "https://mirrors.kernel.org/debian/pool/main/d/dpkg/dpkg_1.18.24.tar.xz"
|
||||
mirror "https://mirrors.ocf.berkeley.edu/debian/pool/main/d/dpkg/dpkg_1.18.24.tar.xz"
|
||||
sha256 "11484f2a73d027d696e720a60380db71978bb5c06cd88fe30c291e069ac457a4"
|
||||
|
||||
bottle do
|
||||
|
||||
@@ -5,6 +5,9 @@ class Fish < Formula
|
||||
sha256 "e42bb19c7586356905a58578190be792df960fa81de35effb1ca5a5a981f0c5a"
|
||||
|
||||
bottle do
|
||||
sha256 "12616d6225eb804b40cdd12ecc8722252a9d28d0275af61f9afc59ef12a55f87" => :tiger_g3
|
||||
sha256 "0339873032336e84bd169f49b4a9745bcb6ee4e21cfc3cf7a99b05423405498e" => :tiger_altivec
|
||||
sha256 "6b02140be2753196951031ef7836d1297e752270c3cbda8915c6dae7dd948766" => :tiger_g5
|
||||
end
|
||||
|
||||
head do
|
||||
@@ -21,6 +24,8 @@ class Fish < Formula
|
||||
|
||||
def install
|
||||
system "autoreconf", "--no-recursive" if build.head?
|
||||
# Necessary to get the standard signature of ttyname_r()
|
||||
ENV.append_to_cflags "-D__DARWIN_UNIX03" if MacOS.version < :leopard
|
||||
|
||||
# In Homebrew's 'superenv' sed's path will be incompatible, so
|
||||
# the correct path is passed into configure here.
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
class Grip < Formula
|
||||
desc "GitHub Markdown previewer"
|
||||
homepage "https://github.com/joeyespo/grip"
|
||||
url "https://files.pythonhosted.org/packages/3c/ea/2a475ed37e1b6476182e71223c98667f51704bdbc919608372b203c7ea04/grip-4.5.2.tar.gz"
|
||||
sha256 "048b7e5c738ed80bee345bd10840f27eb31687eb67132b40f2473dc1cf67aa0f"
|
||||
|
||||
bottle do
|
||||
cellar :any_skip_relocation
|
||||
sha256 "1d4b1cbd24fd7e087f13f947510fbf886bb1eccbd0bc7c45f23c4a5eebec678e" => :tiger_g3
|
||||
sha256 "cd904541d7370920a24f07abe782cc68f947dc26e820eb7000f9c0edceb9e8e2" => :tiger_g4
|
||||
sha256 "69934d0ea8e23b288a28e5dbbe429415d0b0e9df7d3bdb3c338b3bf0acd12121" => :tiger_g4e
|
||||
sha256 "0fabed73fb8cb3072f4b849e47ca2ebab0d6c8300652755866a354e49d146024" => :tiger_g5
|
||||
end
|
||||
|
||||
depends_on "python"
|
||||
|
||||
resource "certifi" do
|
||||
url "https://files.pythonhosted.org/packages/15/d4/2f888fc463d516ff7bf2379a4e9a552fef7f22a94147655d9b1097108248/certifi-2018.1.18.tar.gz"
|
||||
sha256 "edbc3f203427eef571f79a7692bb160a2b0f7ccaa31953e99bd17e307cf63f7d"
|
||||
end
|
||||
|
||||
resource "chardet" do
|
||||
url "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz"
|
||||
sha256 "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"
|
||||
end
|
||||
|
||||
resource "click" do
|
||||
url "https://files.pythonhosted.org/packages/95/d9/c3336b6b5711c3ab9d1d3a80f1a3e2afeb9d8c02a7166462f6cc96570897/click-6.7.tar.gz"
|
||||
sha256 "f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b"
|
||||
end
|
||||
|
||||
resource "docopt" do
|
||||
url "https://files.pythonhosted.org/packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz"
|
||||
sha256 "49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"
|
||||
end
|
||||
|
||||
resource "Flask" do
|
||||
url "https://files.pythonhosted.org/packages/eb/12/1c7bd06fcbd08ba544f25bf2c6612e305a70ea51ca0eda8007344ec3f123/Flask-0.12.2.tar.gz"
|
||||
sha256 "49f44461237b69ecd901cc7ce66feea0319b9158743dd27a2899962ab214dac1"
|
||||
end
|
||||
|
||||
resource "idna" do
|
||||
url "https://files.pythonhosted.org/packages/f4/bd/0467d62790828c23c47fc1dfa1b1f052b24efdf5290f071c7a91d0d82fd3/idna-2.6.tar.gz"
|
||||
sha256 "2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f"
|
||||
end
|
||||
|
||||
resource "itsdangerous" do
|
||||
url "https://files.pythonhosted.org/packages/dc/b4/a60bcdba945c00f6d608d8975131ab3f25b22f2bcfe1dab221165194b2d4/itsdangerous-0.24.tar.gz"
|
||||
sha256 "cbb3fcf8d3e33df861709ecaf89d9e6629cff0a217bc2848f1b41cd30d360519"
|
||||
end
|
||||
|
||||
resource "Jinja2" do
|
||||
url "https://files.pythonhosted.org/packages/56/e6/332789f295cf22308386cf5bbd1f4e00ed11484299c5d7383378cf48ba47/Jinja2-2.10.tar.gz"
|
||||
sha256 "f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4"
|
||||
end
|
||||
|
||||
resource "Markdown" do
|
||||
url "https://files.pythonhosted.org/packages/b3/73/fc5c850f44af5889192dff783b7b0d8f3fe8d30b65c8e3f78f8f0265fecf/Markdown-2.6.11.tar.gz"
|
||||
sha256 "a856869c7ff079ad84a3e19cd87a64998350c2b94e9e08e44270faef33400f81"
|
||||
end
|
||||
|
||||
resource "MarkupSafe" do
|
||||
url "https://files.pythonhosted.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz"
|
||||
sha256 "a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665"
|
||||
end
|
||||
|
||||
resource "path-and-address" do
|
||||
url "https://files.pythonhosted.org/packages/2b/b5/749fab14d9e84257f3b0583eedb54e013422b6c240491a4ae48d9ea5e44f/path-and-address-2.0.1.zip"
|
||||
sha256 "e96363d982b3a2de8531f4cd5f086b51d0248b58527227d43cf5014d045371b7"
|
||||
end
|
||||
|
||||
resource "Pygments" do
|
||||
url "https://files.pythonhosted.org/packages/71/2a/2e4e77803a8bd6408a2903340ac498cb0a2181811af7c9ec92cb70b0308a/Pygments-2.2.0.tar.gz"
|
||||
sha256 "dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc"
|
||||
end
|
||||
|
||||
resource "requests" do
|
||||
url "https://files.pythonhosted.org/packages/b0/e1/eab4fc3752e3d240468a8c0b284607899d2fbfb236a56b7377a329aa8d09/requests-2.18.4.tar.gz"
|
||||
sha256 "9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e"
|
||||
end
|
||||
|
||||
resource "urllib3" do
|
||||
url "https://files.pythonhosted.org/packages/ee/11/7c59620aceedcc1ef65e156cc5ce5a24ef87be4107c2b74458464e437a5d/urllib3-1.22.tar.gz"
|
||||
sha256 "cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f"
|
||||
end
|
||||
|
||||
resource "Werkzeug" do
|
||||
url "https://files.pythonhosted.org/packages/9f/08/a3bb1c045ec602dc680906fc0261c267bed6b3bb4609430aff92c3888ec8/Werkzeug-0.14.1.tar.gz"
|
||||
sha256 "c3fd7a7d41976d9f44db327260e263132466836cef6f91512889ed60ad26557c"
|
||||
end
|
||||
|
||||
def install
|
||||
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages"
|
||||
resources.each do |r|
|
||||
r.stage do
|
||||
system "python", *Language::Python.setup_install_args(libexec/"vendor")
|
||||
end
|
||||
end
|
||||
|
||||
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python2.7/site-packages"
|
||||
system "python", *Language::Python.setup_install_args(libexec)
|
||||
|
||||
bin.install Dir[libexec/"bin/*"]
|
||||
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
|
||||
end
|
||||
|
||||
test do
|
||||
assert_match "<strong>Homebrew</strong> is awesome",
|
||||
pipe_output("#{bin}/grip - --export -", "**Homebrew** is awesome.")
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,6 @@
|
||||
class Libid3tag < Formula
|
||||
desc "ID3 tag manipulation library"
|
||||
homepage "http://www.underbit.com/products/mad/"
|
||||
homepage "https://www.underbit.com/products/mad/"
|
||||
url "https://downloads.sourceforge.net/project/mad/libid3tag/0.15.1b/libid3tag-0.15.1b.tar.gz"
|
||||
sha256 "63da4f6e7997278f8a3fef4c6a372d342f705051d1eeb6a46a86b03610e26151"
|
||||
|
||||
@@ -15,32 +15,32 @@ class Libid3tag < Formula
|
||||
|
||||
# patch for utf-16 (memory leaks), see https://bugs.launchpad.net/mixxx/+bug/403586
|
||||
{
|
||||
"utf16.patchlibid3tag-0.15.1b-utf16" => "daf621e8123530fdab5193099031074666fc7330",
|
||||
"unknown-encoding" => "093def535edb3d2f5be6b173eedf0f93a1c0314c",
|
||||
"compat" => "8c179b10bf49385e4334aab141e4cf270cb02182",
|
||||
"file-write" => "b7baae1c87f90aac64a4d17725b2eaad521e42af"
|
||||
"utf16.patchlibid3tag-0.15.1b-utf16" => "487d0c531f3653f8e754d720729cf1cec1bce6e897b845fa61adaaf2668d1568",
|
||||
"unknown-encoding" => "8b695c9c05e3885655b2e798326b804011615bc6c831cd55cdbacc456a6b9494",
|
||||
"compat" => "88f486c3d263a4dd5bb556232dcfe2fba175b5124bcdd72aa6c30f562fc87d53",
|
||||
"file-write" => "eff855cabd8a51866a29246a1b257da64f46aab72d4b8e163e2a4c0d15165bf1",
|
||||
}.each do |name, sha|
|
||||
patch do
|
||||
url "http://mirror.ovh.net/gentoo-portage/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-#{name}.patch"
|
||||
sha1 sha
|
||||
url "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-#{name}.patch?id=56bd759df1d0"
|
||||
sha256 sha
|
||||
end
|
||||
end
|
||||
|
||||
# typedef for 64-bit long + buffer overflow
|
||||
{
|
||||
"64bit-long" => "f9778590811a050384b9bf8827345b61999f0da3",
|
||||
"fix_overflow" => "ed80bc74bd81caa225952f72a1a28d54300e43e3",
|
||||
"tag" => "b7ef9a41a31a37b8bb6d8e064b0c0ba618d3fa03"
|
||||
"64bit-long" => "5f8b3d3419addf90977832b0a6e563acc2c8e243bb826ebb6d0ec573ec122e1b",
|
||||
"fix_overflow" => "43ea3e0b324fb25802dae6410564c947ce1982243c781ef54b023f060c3b0ac4",
|
||||
"tag" => "ca7262ddad158ab0be804429d705f8c6a1bb120371dec593323fa4876c1b277f",
|
||||
}.each do |name, sha|
|
||||
patch :p0 do
|
||||
url "http://mirror.ovh.net/gentoo-portage/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-#{name}.patch"
|
||||
sha1 sha
|
||||
url "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-#{name}.patch?id=56bd759df1d0"
|
||||
sha256 sha
|
||||
end
|
||||
end
|
||||
|
||||
# corrects "a cappella" typo
|
||||
patch :p2 do
|
||||
url "http://mirror.ovh.net/gentoo-portage/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-a_capella.patch"
|
||||
url "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/libid3tag/files/0.15.1b/libid3tag-0.15.1b-a_capella.patch?id=56bd759df1d0"
|
||||
sha256 "5e86270ebb179d82acee686700d203e90f42e82beeed455b0163d8611657d395"
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
class Mgba < Formula
|
||||
desc "Game Boy Advance emulator"
|
||||
homepage "https://mgba.io/"
|
||||
url "https://github.com/mgba-emu/mgba/archive/0.6.3.tar.gz"
|
||||
sha256 "35c8906c01206adae714fee9c2bc39698c514a4adb32c9c4a5a3fa58b2d10f9a"
|
||||
head "https://github.com/mgba-emu/mgba.git"
|
||||
|
||||
depends_on :ld64 # fixes a linktime error on Tiger
|
||||
depends_on "cmake" => :build
|
||||
depends_on "pkg-config" => :build
|
||||
depends_on "libepoxy"
|
||||
depends_on "libpng"
|
||||
depends_on "libzip"
|
||||
depends_on "sdl2"
|
||||
|
||||
# error: stdarg.h: No such file or directory
|
||||
fails_with :gcc if MacOS.version == :tiger
|
||||
|
||||
def install
|
||||
# Qt is still broken on 10.4, so build with it off by default.
|
||||
# FFmpeg introduces a VideoDecodeAcceleration framework requirement,
|
||||
# which isn't available on older OS Xs.
|
||||
# Imagemagick fails to link due to some strange path lookup issues.
|
||||
# The Sqlite feature isn't exposed in the SDL build, so no reason to enable it.
|
||||
args = ["-DBUILD_QT=OFF", "-DUSE_FFMPEG=OFF", "-DUSE_MAGICK=OFF", "-DUSE_SQLITE3=OFF"]
|
||||
|
||||
# GCC 4.0 and 4.2 don't support -flto
|
||||
# The buildsystem will detect this in the next stable release.
|
||||
# GCC also doesn't enable LTO on Tiger.
|
||||
if MacOS.version < :leopard || [:gcc, :gcc_4_0].include?(ENV.compiler)
|
||||
args << "-DBUILD_LTO=OFF"
|
||||
end
|
||||
|
||||
system "cmake", ".", *(std_cmake_args + args)
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
test do
|
||||
assert_match version.to_s, shell_output("#{bin}/mGBA --version")
|
||||
end
|
||||
end
|
||||
@@ -8,10 +8,9 @@ class Pcre2 < Formula
|
||||
|
||||
bottle do
|
||||
cellar :any
|
||||
sha256 "df6f0855251cd664b41896e72262d28ed73b82b585b09d5df1a8d54783c8583c" => :el_capitan
|
||||
sha256 "acd343182f0033d61a8b9266909a1c3a609d9a450d1cf28fe30fefa9c54c36e3" => :yosemite
|
||||
sha256 "febc1cf22e5da7f4f873dadda0d88a158602d99b49d61ed51441d82083a9b924" => :mavericks
|
||||
sha256 "5258f37a0149806a78d777c6c311ff9c53eff4d4ae3d14c47825f4c279eed298" => :mountain_lion
|
||||
sha256 "bd0d09c9849ec4ce62bff6bf422cf8c42dfa7d39e684c0d7e7d3d176a749ab76" => :tiger_g3
|
||||
sha256 "032c6cc3f59a97be735e385714da097201d03afb5ecc1ee943d0f5ebf8f06d52" => :tiger_altivec
|
||||
sha256 "23e8ed207c87f4a77e01b49d1972de94795e398ab00e4fe1d2260f1c905306f7" => :tiger_g5
|
||||
end
|
||||
|
||||
option :universal
|
||||
|
||||
+40
-101
@@ -1,24 +1,19 @@
|
||||
class Python < Formula
|
||||
desc "Interpreted, interactive, object-oriented programming language"
|
||||
homepage "https://www.python.org"
|
||||
url "https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz"
|
||||
sha256 "d7837121dd5652a05fef807c361909d255d173280c4e1a4ded94d73d80a1f978"
|
||||
revision 3
|
||||
|
||||
head "https://hg.python.org/cpython", :using => :hg, :branch => "2.7"
|
||||
url "https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tar.xz"
|
||||
sha256 "22d9b1ac5b26135ad2b8c2901a9413537e08749a753356ee913c84dbd2df5574"
|
||||
head "https://github.com/python/cpython.git", :branch => "2.7"
|
||||
|
||||
bottle do
|
||||
sha256 "2ac20b04ff599f02e950431622943f2c92e70e85c097f645265adaf4dd8c6a31" => :sierra
|
||||
sha256 "ed692ad5e13437a751dce19865989ce7e3344402aa38496db3e78ab179121197" => :el_capitan
|
||||
sha256 "834c7ac3ce19df12cb4fb9cbb1cae0c7fbdcaf33a9141dc1c3791ab801df27f0" => :yosemite
|
||||
sha256 "8dc69c4e1f6f1ebaa59033ea30bf96f924d496ba0d0a7d698e5b9ed20369a657" => :tiger_g3
|
||||
sha256 "5aa18fb91dc3b1b3bc810171b78b0a30b68de878457666addd9c08bd2873692d" => :tiger_altivec
|
||||
end
|
||||
|
||||
# Please don't add a wide/ucs4 option as it won't be accepted.
|
||||
# More details in: https://github.com/Homebrew/homebrew/pull/32368
|
||||
option :universal
|
||||
option "with-quicktest", "Run `make quicktest` after the build (for devs; may fail)"
|
||||
option "with-tcl-tk", "Use Tigerbrew's Tk instead of OS X Tk (has optional Cocoa and threads support)"
|
||||
option "with-poll", "Enable select.poll, which is not fully implemented on OS X (https://bugs.python.org/issue5154)"
|
||||
|
||||
# sphinx-doc depends on python, but on 10.6 or earlier python is fulfilled by
|
||||
# brew, which would lead to circular dependency.
|
||||
@@ -43,30 +38,27 @@ class Python < Formula
|
||||
skip_clean "bin/easy_install", "bin/easy_install-2.7"
|
||||
|
||||
resource "setuptools" do
|
||||
url "https://files.pythonhosted.org/packages/9f/7c/0a33c528164f1b7ff8cf0684cf88c2e733c8ae0119ceca4a3955c7fc059d/setuptools-23.1.0.tar.gz"
|
||||
sha256 "4e269d36ba2313e6236f384b36eb97b3433cf99a16b94c74cca7eee2b311f2be"
|
||||
url "https://files.pythonhosted.org/packages/1a/04/d6f1159feaccdfc508517dba1929eb93a2854de729fa68da9d5c6b48fa00/setuptools-39.2.0.zip"
|
||||
sha256 "f7cddbb5f5c640311eb00eab6e849f7701fa70bf6a183fc8a2c33dd1d1672fb2"
|
||||
end
|
||||
|
||||
resource "pip" do
|
||||
url "https://files.pythonhosted.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz"
|
||||
sha256 "4d24b03ffa67638a3fa931c09fd9e0273ffa904e95ebebe7d4b1a54c93d7b732"
|
||||
url "https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz"
|
||||
sha256 "f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68"
|
||||
end
|
||||
|
||||
resource "wheel" do
|
||||
url "https://files.pythonhosted.org/packages/c9/1d/bd19e691fd4cfe908c76c429fe6e4436c9e83583c4414b54f6c85471954a/wheel-0.29.0.tar.gz"
|
||||
sha256 "1ebb8ad7e26b448e9caa4773d2357849bf80ff9e313964bcaf79cbf0201a1648"
|
||||
url "https://files.pythonhosted.org/packages/2a/fb/aefe5d5dbc3f4fe1e815bcdb05cbaab19744d201bbc9b59cfa06ec7fc789/wheel-0.31.1.tar.gz"
|
||||
sha256 "0a2e54558a0628f2145d2fc822137e322412115173e8a2ddbe1c9024338ae83c"
|
||||
end
|
||||
|
||||
# Patch to disable the search for Tk.framework, since Homebrew's Tk is
|
||||
# a plain unix build. Remove `-lX11`, too because our Tk is "AquaTk".
|
||||
patch :DATA if build.with? "tcl-tk"
|
||||
|
||||
# Patch for pyport.h macro issue
|
||||
# https://bugs.python.org/issue10910
|
||||
# https://trac.macports.org/ticket/44288
|
||||
patch do
|
||||
url "https://bugs.python.org/file30805/issue10910-workaround.txt"
|
||||
sha256 "c075353337f9ff3ccf8091693d278782fcdff62c113245d8de43c5c7acc57daf"
|
||||
if build.with? "tcl-tk"
|
||||
patch do
|
||||
url "https://raw.githubusercontent.com/Homebrew/patches/42fcf22/python/brewed-tk-patch.diff"
|
||||
sha256 "15c153bdfe51a98efe48f8e8379f5d9b5c6c4015e53d3f9364d23c8689857f09"
|
||||
end
|
||||
end
|
||||
|
||||
def lib_cellar
|
||||
@@ -85,19 +77,15 @@ class Python < Formula
|
||||
# setuptools remembers the build flags python is built with and uses them to
|
||||
# build packages later. Xcode-only systems need different flags.
|
||||
def pour_bottle
|
||||
reason <<-EOS.undent
|
||||
The bottle needs the Apple Command Line Tools to be installed.
|
||||
You can install them, if desired, with:
|
||||
xcode-select --install
|
||||
reason <<~EOS
|
||||
The bottle needs the Apple Command Line Tools to be installed.
|
||||
You can install them, if desired, with:
|
||||
xcode-select --install
|
||||
EOS
|
||||
satisfy { MacOS::CLT.installed? }
|
||||
end
|
||||
|
||||
def install
|
||||
if build.with? "poll"
|
||||
opoo "The given option --with-poll enables a somewhat broken poll() on OS X (https://bugs.python.org/issue5154)."
|
||||
end
|
||||
|
||||
# Unset these so that installing pip and setuptools puts them where we want
|
||||
# and not into some other Python the user has installed.
|
||||
ENV["PYTHONHOME"] = nil
|
||||
@@ -178,18 +166,7 @@ class Python < Formula
|
||||
args << "CPPFLAGS=#{cppflags.join(" ")}" unless cppflags.empty?
|
||||
|
||||
system "./configure", *args
|
||||
|
||||
# HAVE_POLL is "broken" on OS X. See:
|
||||
# https://trac.macports.org/ticket/18376
|
||||
# https://bugs.python.org/issue5154
|
||||
if build.without? "poll"
|
||||
inreplace "pyconfig.h", /.*?(HAVE_POLL[_A-Z]*).*/, '#undef \1'
|
||||
end
|
||||
|
||||
system "make"
|
||||
if build.with?("quicktest") || build.bottle?
|
||||
system "make", "quicktest", "TESTPYTHONOPTS=-s", "TESTOPTS=-j#{ENV.make_jobs} -w"
|
||||
end
|
||||
|
||||
ENV.deparallelize do
|
||||
# Tell Python not to install into /Applications
|
||||
@@ -214,6 +191,9 @@ class Python < Formula
|
||||
# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.
|
||||
(lib/"pkgconfig").install_symlink Dir["#{frameworks}/Python.framework/Versions/Current/lib/pkgconfig/*"]
|
||||
|
||||
# Remove 2to3 because Python 3 also installs it
|
||||
rm bin/"2to3"
|
||||
|
||||
# Remove the site-packages that Python created in its Cellar.
|
||||
site_packages_cellar.rmtree
|
||||
|
||||
@@ -230,6 +210,13 @@ class Python < Formula
|
||||
end
|
||||
|
||||
def post_install
|
||||
# Avoid conflicts with lingering unversioned files from Python 3
|
||||
rm_f %W[
|
||||
#{HOMEBREW_PREFIX}/bin/easy_install
|
||||
#{HOMEBREW_PREFIX}/bin/pip
|
||||
#{HOMEBREW_PREFIX}/bin/wheel
|
||||
]
|
||||
|
||||
# Fix up the site-packages so that user-installed Python software survives
|
||||
# minor updates, such as going from 2.7.0 to 2.7.1:
|
||||
|
||||
@@ -250,7 +237,7 @@ class Python < Formula
|
||||
# setuptools-0.9.5-py3.3.egg
|
||||
rm_rf Dir["#{site_packages}/setuptools*"]
|
||||
rm_rf Dir["#{site_packages}/distribute*"]
|
||||
rm_rf (Dir["#{site_packages}/pip[-_.][0-9]*"] + Dir["#{site_packages}/pip"])
|
||||
rm_rf Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"]
|
||||
|
||||
setup_args = ["-s", "setup.py", "--no-user-cfg", "install", "--force",
|
||||
"--verbose",
|
||||
@@ -284,21 +271,21 @@ class Python < Formula
|
||||
end
|
||||
|
||||
cfg = lib_cellar/"distutils/distutils.cfg"
|
||||
cfg.atomic_write <<-EOF.undent
|
||||
cfg.atomic_write <<~EOS
|
||||
[install]
|
||||
prefix=#{HOMEBREW_PREFIX}
|
||||
|
||||
[build_ext]
|
||||
include_dirs=#{include_dirs.join ":"}
|
||||
library_dirs=#{library_dirs.join ":"}
|
||||
EOF
|
||||
EOS
|
||||
end
|
||||
|
||||
def sitecustomize
|
||||
<<-EOF.undent
|
||||
<<~EOS
|
||||
# This file is created by Homebrew and is executed on each python startup.
|
||||
# Don't print from here, or else python command line scripts may fail!
|
||||
# <https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Homebrew-and-Python.md>
|
||||
# <https://docs.brew.sh/Homebrew-and-Python>
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
@@ -341,10 +328,10 @@ class Python < Formula
|
||||
|
||||
# Set the sys.executable to use the opt_prefix
|
||||
sys.executable = '#{opt_bin}/python2.7'
|
||||
EOF
|
||||
EOS
|
||||
end
|
||||
|
||||
def caveats; <<-EOS.undent
|
||||
def caveats; <<~EOS
|
||||
Pip and setuptools have been installed. To update them
|
||||
pip install --upgrade pip setuptools
|
||||
|
||||
@@ -354,8 +341,8 @@ class Python < Formula
|
||||
They will install into the site-package directory
|
||||
#{site_packages}
|
||||
|
||||
See: https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Homebrew-and-Python.md
|
||||
EOS
|
||||
See: https://docs.brew.sh/Homebrew-and-Python
|
||||
EOS
|
||||
end
|
||||
|
||||
test do
|
||||
@@ -364,54 +351,6 @@ class Python < Formula
|
||||
system "#{bin}/python", "-c", "import sqlite3"
|
||||
# Check if some other modules import. Then the linked libs are working.
|
||||
system "#{bin}/python", "-c", "import Tkinter; root = Tkinter.Tk()"
|
||||
system bin/"pip", "list"
|
||||
system bin/"pip", "list", "--format=columns"
|
||||
end
|
||||
end
|
||||
|
||||
__END__
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 716f08e..66114ef 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -1810,9 +1810,6 @@ class PyBuildExt(build_ext):
|
||||
# Rather than complicate the code below, detecting and building
|
||||
# AquaTk is a separate method. Only one Tkinter will be built on
|
||||
# Darwin - either AquaTk, if it is found, or X11 based Tk.
|
||||
- if (host_platform == 'darwin' and
|
||||
- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
|
||||
- return
|
||||
|
||||
# Assume we haven't found any of the libraries or include files
|
||||
# The versions with dots are used on Unix, and the versions without
|
||||
@@ -1858,21 +1855,6 @@ class PyBuildExt(build_ext):
|
||||
if dir not in include_dirs:
|
||||
include_dirs.append(dir)
|
||||
|
||||
- # Check for various platform-specific directories
|
||||
- if host_platform == 'sunos5':
|
||||
- include_dirs.append('/usr/openwin/include')
|
||||
- added_lib_dirs.append('/usr/openwin/lib')
|
||||
- elif os.path.exists('/usr/X11R6/include'):
|
||||
- include_dirs.append('/usr/X11R6/include')
|
||||
- added_lib_dirs.append('/usr/X11R6/lib64')
|
||||
- added_lib_dirs.append('/usr/X11R6/lib')
|
||||
- elif os.path.exists('/usr/X11R5/include'):
|
||||
- include_dirs.append('/usr/X11R5/include')
|
||||
- added_lib_dirs.append('/usr/X11R5/lib')
|
||||
- else:
|
||||
- # Assume default location for X11
|
||||
- include_dirs.append('/usr/X11/include')
|
||||
- added_lib_dirs.append('/usr/X11/lib')
|
||||
|
||||
# If Cygwin, then verify that X is installed before proceeding
|
||||
if host_platform == 'cygwin':
|
||||
@@ -1897,9 +1879,6 @@ class PyBuildExt(build_ext):
|
||||
if host_platform in ['aix3', 'aix4']:
|
||||
libs.append('ld')
|
||||
|
||||
- # Finally, link with the X11 libraries (not appropriate on cygwin)
|
||||
- if host_platform != "cygwin":
|
||||
- libs.append('X11')
|
||||
|
||||
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
|
||||
define_macros=[('WITH_APPINIT', 1)] + defs,
|
||||
+127
-91
@@ -1,51 +1,54 @@
|
||||
class Python3 < Formula
|
||||
desc "Interpreted, interactive, object-oriented programming language"
|
||||
homepage "https://www.python.org/"
|
||||
url "https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tar.xz"
|
||||
sha256 "d6d7aa1634a5eeeca6ed4fca266982a04f84bd8f3945a9179e20b24ad2e2be91"
|
||||
revision 1
|
||||
url "https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz"
|
||||
sha256 "0382996d1ee6aafe59763426cf0139ffebe36984474d0ec4126dd1c40a8b3549"
|
||||
|
||||
bottle do
|
||||
revision 3
|
||||
sha256 "5a955a6800431f4b38f7dcc4910deaf3c9e3a47f68b5a4b2117527c57290c4dd" => :el_capitan
|
||||
sha256 "956b2bfe8289da7584089768e6143f852b9586ffd552d9b1e4c5e116f7c52587" => :yosemite
|
||||
sha256 "98e2f771b7bc6e33f5eae068788b9197619eb037f043a292790482aa82577528" => :mavericks
|
||||
sha256 "2caf6b1d5c9166e4135392905adbb342d9abff35377762fc101278ba367089a3" => :tiger_g3
|
||||
sha256 "b5bbf6517590aae2a173d4dc2b586525b110d5188a4b5b2f465e41bfcf73f495" => :tiger_altivec
|
||||
end
|
||||
|
||||
head "https://hg.python.org/cpython", :using => :hg
|
||||
head do
|
||||
url "https://github.com/python/cpython.git"
|
||||
|
||||
resource "blurb" do
|
||||
url "https://files.pythonhosted.org/packages/f2/2d/541cf1d8054dbb320aca5e9dcce5d66efb227be9adb75d2697ee45d1f742/blurb-1.0.6.tar.gz"
|
||||
sha256 "90c7d2e5d141d7d1fc6ca0fe660025317ac81ca078e6045c46b1bc5a675ce5d1"
|
||||
end
|
||||
end
|
||||
|
||||
option :universal
|
||||
option "with-tcl-tk", "Use Tigerbrew's Tk instead of OS X Tk (has optional Cocoa and threads support)"
|
||||
option "with-quicktest", "Run `make quicktest` after the build"
|
||||
|
||||
deprecated_option "quicktest" => "with-quicktest"
|
||||
deprecated_option "with-brewed-tk" => "with-tcl-tk"
|
||||
|
||||
depends_on "pkg-config" => :build
|
||||
depends_on "sphinx-doc" => :build if MacOS.version > :snow_leopard
|
||||
depends_on "readline" => :recommended
|
||||
depends_on "sqlite" => :recommended
|
||||
depends_on "sqlite"
|
||||
depends_on "gdbm" => :recommended
|
||||
depends_on "openssl"
|
||||
depends_on "xz" => :recommended # for the lzma module added in 3.3
|
||||
depends_on "tcl-tk" => :optional
|
||||
depends_on :x11 if build.with?("tcl-tk") && Tab.for_name("tcl-tk").with?("x11")
|
||||
|
||||
skip_clean "bin/pip3", "bin/pip-3.4", "bin/pip-3.5"
|
||||
skip_clean "bin/easy_install3", "bin/easy_install-3.4", "bin/easy_install-3.5"
|
||||
skip_clean "bin/pip3", "bin/pip-3.4", "bin/pip-3.5", "bin/pip-3.6", "bin/pip-3.7"
|
||||
skip_clean "bin/easy_install3", "bin/easy_install-3.4", "bin/easy_install-3.5", "bin/easy_install-3.6", "bin/easy_install-3.7"
|
||||
|
||||
resource "setuptools" do
|
||||
url "https://pypi.python.org/packages/source/s/setuptools/setuptools-18.3.1.tar.gz"
|
||||
sha256 "2fa230727104b07e522deec17929e84e041c9047e392c055347a02b0d5ca874d"
|
||||
url "https://files.pythonhosted.org/packages/1a/04/d6f1159feaccdfc508517dba1929eb93a2854de729fa68da9d5c6b48fa00/setuptools-39.2.0.zip"
|
||||
sha256 "f7cddbb5f5c640311eb00eab6e849f7701fa70bf6a183fc8a2c33dd1d1672fb2"
|
||||
end
|
||||
|
||||
resource "pip" do
|
||||
url "https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz"
|
||||
sha256 "ca047986f0528cfa975a14fb9f7f106271d4e0c3fe1ddced6c1db2e7ae57a477"
|
||||
url "https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz"
|
||||
sha256 "f2bd08e0cd1b06e10218feaf6fef299f473ba706582eb3bd9d52203fdbd7ee68"
|
||||
end
|
||||
|
||||
resource "wheel" do
|
||||
url "https://pypi.python.org/packages/source/w/wheel/wheel-0.26.0.tar.gz"
|
||||
sha256 "eaad353805c180a47545a256e6508835b65a8e830ba1093ed8162f19a50a530c"
|
||||
url "https://files.pythonhosted.org/packages/2a/fb/aefe5d5dbc3f4fe1e815bcdb05cbaab19744d201bbc9b59cfa06ec7fc789/wheel-0.31.1.tar.gz"
|
||||
sha256 "0a2e54558a0628f2145d2fc822137e322412115173e8a2ddbe1c9024338ae83c"
|
||||
end
|
||||
|
||||
# Homebrew's tcl-tk is built in a standard unix fashion (due to link errors)
|
||||
@@ -53,27 +56,6 @@ class Python3 < Formula
|
||||
# X11.
|
||||
patch :DATA if build.with? "tcl-tk"
|
||||
|
||||
# Fix extension module builds against Xcode 7 SDKs
|
||||
# https://github.com/Homebrew/homebrew/issues/41085
|
||||
# https://bugs.python.org/issue25136
|
||||
patch do
|
||||
url "https://bugs.python.org/file40478/xcode-stubs.diff"
|
||||
sha256 "029cc0dc72b1bcf4ddc5f913cc4a3fd970378073c6355921891f041aca2f8b12"
|
||||
end
|
||||
|
||||
def lib_cellar
|
||||
prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}"
|
||||
end
|
||||
|
||||
def site_packages_cellar
|
||||
lib_cellar/"site-packages"
|
||||
end
|
||||
|
||||
# The HOMEBREW_PREFIX location of site-packages.
|
||||
def site_packages
|
||||
HOMEBREW_PREFIX/"lib/python#{xy}/site-packages"
|
||||
end
|
||||
|
||||
fails_with :llvm do
|
||||
build 2336
|
||||
cause <<-EOS.undent
|
||||
@@ -99,38 +81,50 @@ class Python3 < Formula
|
||||
ENV["PYTHONHOME"] = nil
|
||||
ENV["PYTHONPATH"] = nil
|
||||
|
||||
xy = (buildpath/"configure.ac").read.slice(/PYTHON_VERSION, (3\.\d)/, 1)
|
||||
lib_cellar = prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}"
|
||||
|
||||
args = %W[
|
||||
--prefix=#{prefix}
|
||||
--enable-ipv6
|
||||
--datarootdir=#{share}
|
||||
--datadir=#{share}
|
||||
--enable-framework=#{frameworks}
|
||||
--enable-loadable-sqlite-extensions
|
||||
--without-ensurepip
|
||||
--with-openssl=#{Formula["openssl"].opt_prefix}
|
||||
]
|
||||
|
||||
args << "--without-gcc" if ENV.compiler == :clang
|
||||
|
||||
cflags = []
|
||||
ldflags = []
|
||||
cppflags = []
|
||||
|
||||
unless MacOS::CLT.installed?
|
||||
# Help Python's build system (setuptools/pip) to build things on Xcode-only systems
|
||||
# The setup.py looks at "-isysroot" to get the sysroot (and not at --sysroot)
|
||||
cflags = "CFLAGS=-isysroot #{MacOS.sdk_path}"
|
||||
ldflags = "LDFLAGS=-isysroot #{MacOS.sdk_path}"
|
||||
args << "CPPFLAGS=-I#{MacOS.sdk_path}/usr/include" # find zlib
|
||||
cflags << "-isysroot #{MacOS.sdk_path}"
|
||||
ldflags << "-isysroot #{MacOS.sdk_path}"
|
||||
cppflags << "-I#{MacOS.sdk_path}/usr/include" # find zlib
|
||||
# For the Xlib.h, Python needs this header dir with the system Tk
|
||||
if build.without? "tcl-tk"
|
||||
cflags += " -I#{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers"
|
||||
cflags << "-I#{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers"
|
||||
end
|
||||
args << cflags
|
||||
args << ldflags
|
||||
end
|
||||
# Avoid linking to libgcc http://code.activestate.com/lists/python-dev/112195/
|
||||
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}"
|
||||
|
||||
# We want our readline and openssl! This is just to outsmart the detection code,
|
||||
# We want our readline! This is just to outsmart the detection code,
|
||||
# superenv makes cc always find includes/libs!
|
||||
inreplace "setup.py",
|
||||
"do_readline = self.compiler.find_library_file(lib_dirs, 'readline')",
|
||||
"do_readline = '#{Formula["readline"].opt_lib}/libhistory.dylib'"
|
||||
|
||||
inreplace "setup.py" do |s|
|
||||
s.gsub! "do_readline = self.compiler.find_library_file(lib_dirs, 'readline')",
|
||||
"do_readline = '#{Formula["readline"].opt_lib}/libhistory.dylib'"
|
||||
s.gsub! "/usr/local/ssl", Formula["openssl"].opt_prefix
|
||||
s.gsub! "sqlite_setup_debug = False", "sqlite_setup_debug = True"
|
||||
s.gsub! "for d_ in inc_dirs + sqlite_inc_paths:",
|
||||
"for d_ in ['#{Formula["sqlite"].opt_include}']:"
|
||||
end
|
||||
|
||||
if build.universal?
|
||||
@@ -138,9 +132,6 @@ class Python3 < Formula
|
||||
args << "--enable-universalsdk" << "--with-universal-archs=intel"
|
||||
end
|
||||
|
||||
# Allow sqlite3 module to load extensions: http://docs.python.org/library/sqlite3.html#f1
|
||||
inreplace("setup.py", 'sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))', "pass") if build.with? "sqlite"
|
||||
|
||||
# Allow python modules to use ctypes.find_library to find homebrew's stuff
|
||||
# even if homebrew is not a /usr/local/lib. Try this with:
|
||||
# `brew install enchant && pip install pyenchant`
|
||||
@@ -155,8 +146,11 @@ class Python3 < Formula
|
||||
ENV.append "LDFLAGS", "-L#{tcl_tk}/lib"
|
||||
end
|
||||
|
||||
system "./configure", *args
|
||||
args << "CFLAGS=#{cflags.join(" ")}" unless cflags.empty?
|
||||
args << "LDFLAGS=#{ldflags.join(" ")}" unless ldflags.empty?
|
||||
args << "CPPFLAGS=#{cppflags.join(" ")}" unless cppflags.empty?
|
||||
|
||||
system "./configure", *args
|
||||
system "make"
|
||||
|
||||
ENV.deparallelize # Installs must be serialized
|
||||
@@ -164,7 +158,6 @@ class Python3 < Formula
|
||||
system "make", "install", "PYTHONAPPSDIR=#{prefix}"
|
||||
# Demos and Tools
|
||||
system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{share}/python3"
|
||||
system "make", "quicktest" if build.include? "quicktest"
|
||||
|
||||
# Any .app get a " 3" attached, so it does not conflict with python 2.x.
|
||||
Dir.glob("#{prefix}/*.app") { |app| mv app, app.sub(".app", " 3.app") }
|
||||
@@ -182,21 +175,45 @@ class Python3 < Formula
|
||||
rm bin/"2to3"
|
||||
|
||||
# Remove the site-packages that Python created in its Cellar.
|
||||
site_packages_cellar.rmtree
|
||||
|
||||
# These makevars are available through distutils.sysconfig at runtime and
|
||||
# some third-party software packages depend on them
|
||||
inreplace frameworks/"Python.framework/Versions/#{xy}/lib/python#{xy}/config-#{xy}m/Makefile" do |s|
|
||||
s.change_make_var! "LINKFORSHARED",
|
||||
"-u _PyMac_Error #{opt_prefix}/Frameworks/Python.framework/Versions/#{xy}/Python"
|
||||
end
|
||||
(prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}/site-packages").rmtree
|
||||
|
||||
%w[setuptools pip wheel].each do |r|
|
||||
(libexec/r).install resource(r)
|
||||
end
|
||||
|
||||
if MacOS.version > :snow_leopard
|
||||
cd "Doc" do
|
||||
if build.head?
|
||||
system bin/"python3", "-m", "venv", "./venv"
|
||||
resource("blurb").stage do
|
||||
system buildpath/"Doc/venv/bin/python3", "-m", "pip", "install", "-v",
|
||||
"--no-deps", "--no-binary", ":all", "--ignore-installed", "."
|
||||
end
|
||||
end
|
||||
|
||||
system "make", "html"
|
||||
doc.install Dir["build/html/*"]
|
||||
end
|
||||
end
|
||||
|
||||
# Install unversioned symlinks in libexec/bin.
|
||||
{
|
||||
"idle" => "idle3",
|
||||
"pydoc" => "pydoc3",
|
||||
"python" => "python3",
|
||||
"python-config" => "python3-config",
|
||||
}.each do |unversioned_name, versioned_name|
|
||||
(libexec/"bin").install_symlink (bin/versioned_name).realpath => unversioned_name
|
||||
end
|
||||
end
|
||||
|
||||
def post_install
|
||||
ENV.delete "PYTHONPATH"
|
||||
|
||||
xy = (prefix/"Frameworks/Python.framework/Versions").children.min.basename.to_s
|
||||
site_packages = HOMEBREW_PREFIX/"lib/python#{xy}/site-packages"
|
||||
site_packages_cellar = prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}/site-packages"
|
||||
|
||||
# Fix up the site-packages so that user-installed Python software survives
|
||||
# minor updates, such as going from 3.3.2 to 3.3.3:
|
||||
|
||||
@@ -217,8 +234,7 @@ class Python3 < Formula
|
||||
# setuptools-0.9.8-py3.3.egg
|
||||
rm_rf Dir["#{site_packages}/setuptools*"]
|
||||
rm_rf Dir["#{site_packages}/distribute*"]
|
||||
rm_rf Dir["#{site_packages}/pip[-_.][0-9]*"]
|
||||
rm_rf Dir["#{site_packages}/pip"]
|
||||
rm_rf Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"]
|
||||
|
||||
%w[setuptools pip wheel].each do |pkg|
|
||||
(libexec/pkg).cd do
|
||||
@@ -233,45 +249,50 @@ class Python3 < Formula
|
||||
rm_rf [bin/"pip", bin/"easy_install"]
|
||||
mv bin/"wheel", bin/"wheel3"
|
||||
|
||||
# Install unversioned symlinks in libexec/bin.
|
||||
{
|
||||
"easy_install" => "easy_install-#{xy}",
|
||||
"pip" => "pip3",
|
||||
"wheel" => "wheel3",
|
||||
}.each do |unversioned_name, versioned_name|
|
||||
(libexec/"bin").install_symlink (bin/versioned_name).realpath => unversioned_name
|
||||
end
|
||||
|
||||
# post_install happens after link
|
||||
%W[pip3 pip#{xy} easy_install-#{xy} wheel3].each do |e|
|
||||
(HOMEBREW_PREFIX/"bin").install_symlink bin/e
|
||||
end
|
||||
|
||||
# Help distutils find brewed stuff when building extensions
|
||||
include_dirs = [HOMEBREW_PREFIX/"include", Formula["openssl"].opt_include]
|
||||
library_dirs = [HOMEBREW_PREFIX/"lib", Formula["openssl"].opt_lib]
|
||||
|
||||
if build.with? "sqlite"
|
||||
include_dirs << Formula["sqlite"].opt_include
|
||||
library_dirs << Formula["sqlite"].opt_lib
|
||||
end
|
||||
include_dirs = [HOMEBREW_PREFIX/"include", Formula["openssl"].opt_include,
|
||||
Formula["sqlite"].opt_include]
|
||||
library_dirs = [HOMEBREW_PREFIX/"lib", Formula["openssl"].opt_lib,
|
||||
Formula["sqlite"].opt_lib]
|
||||
|
||||
if build.with? "tcl-tk"
|
||||
include_dirs << Formula["tcl-tk"].opt_include
|
||||
library_dirs << Formula["tcl-tk"].opt_lib
|
||||
end
|
||||
|
||||
cfg = lib_cellar/"distutils/distutils.cfg"
|
||||
cfg.atomic_write <<-EOF.undent
|
||||
cfg = prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}/distutils/distutils.cfg"
|
||||
|
||||
cfg.atomic_write <<~EOS
|
||||
[install]
|
||||
prefix=#{HOMEBREW_PREFIX}
|
||||
|
||||
[build_ext]
|
||||
include_dirs=#{include_dirs.join ":"}
|
||||
library_dirs=#{library_dirs.join ":"}
|
||||
EOF
|
||||
end
|
||||
|
||||
def xy
|
||||
version.to_s.slice(/(3.\d)/) || "3.6"
|
||||
EOS
|
||||
end
|
||||
|
||||
def sitecustomize
|
||||
<<-EOF.undent
|
||||
xy = (prefix/"Frameworks/Python.framework/Versions").children.min.basename.to_s
|
||||
|
||||
<<~EOS
|
||||
# This file is created by Homebrew and is executed on each python startup.
|
||||
# Don't print from here, or else python command line scripts may fail!
|
||||
# <https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Homebrew-and-Python.md>
|
||||
# <https://docs.brew.sh/Homebrew-and-Python>
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
@@ -298,32 +319,46 @@ class Python3 < Formula
|
||||
# the Cellar site-packages is a symlink to the HOMEBREW_PREFIX
|
||||
# site_packages; prefer the shorter paths
|
||||
long_prefix = re.compile(r'#{rack}/[0-9\._abrc]+/Frameworks/Python\.framework/Versions/#{xy}/lib/python#{xy}/site-packages')
|
||||
sys.path = [long_prefix.sub('#{site_packages}', p) for p in sys.path]
|
||||
sys.path = [long_prefix.sub('#{HOMEBREW_PREFIX/"lib/python#{xy}/site-packages"}', p) for p in sys.path]
|
||||
|
||||
# Set the sys.executable to use the opt_prefix
|
||||
sys.executable = '#{opt_bin}/python#{xy}'
|
||||
EOF
|
||||
EOS
|
||||
end
|
||||
|
||||
def caveats
|
||||
text = <<-EOS.undent
|
||||
Pip and setuptools have been installed. To update them
|
||||
pip3 install --upgrade pip setuptools
|
||||
if prefix.exist?
|
||||
xy = (prefix/"Frameworks/Python.framework/Versions").children.min.basename.to_s
|
||||
else
|
||||
xy = version.to_s.slice(/(3\.\d)/) || "3.7"
|
||||
end
|
||||
text = <<~EOS
|
||||
Python has been installed as
|
||||
#{HOMEBREW_PREFIX}/bin/python3
|
||||
|
||||
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
|
||||
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
|
||||
#{opt_libexec}/bin
|
||||
|
||||
If you need Homebrew's Python 2.7 run
|
||||
brew install python
|
||||
|
||||
Pip, setuptools, and wheel have been installed. To update them run
|
||||
pip3 install --upgrade pip setuptools wheel
|
||||
|
||||
You can install Python packages with
|
||||
pip3 install <package>
|
||||
|
||||
They will install into the site-package directory
|
||||
#{site_packages}
|
||||
#{HOMEBREW_PREFIX/"lib/python#{xy}/site-packages"}
|
||||
|
||||
See: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Homebrew-and-Python.md
|
||||
See: https://docs.brew.sh/Homebrew-and-Python
|
||||
EOS
|
||||
|
||||
# Tk warning only for 10.6
|
||||
tk_caveats = <<-EOS.undent
|
||||
tk_caveats = <<~EOS
|
||||
|
||||
Apple's Tcl/Tk is not recommended for use with Python on Mac OS X 10.6.
|
||||
For more information see: http://www.python.org/download/mac/tcltk/
|
||||
For more information see: https://www.python.org/download/mac/tcltk/
|
||||
EOS
|
||||
|
||||
text += tk_caveats unless MacOS.version >= :lion
|
||||
@@ -331,6 +366,7 @@ class Python3 < Formula
|
||||
end
|
||||
|
||||
test do
|
||||
xy = (prefix/"Frameworks/Python.framework/Versions").children.min.basename.to_s
|
||||
# Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions
|
||||
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
|
||||
system "#{bin}/python#{xy}", "-c", "import sqlite3"
|
||||
|
||||
@@ -3,8 +3,7 @@ class Qt < Formula
|
||||
homepage "https://www.qt.io/"
|
||||
|
||||
stable do
|
||||
url "https://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz"
|
||||
mirror "https://www.mirrorservice.org/sites/download.qt-project.org/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz"
|
||||
url "https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz"
|
||||
sha256 "e2882295097e47fe089f8ac741a95fef47e0a73a3f3cdf21b56990638f626ea0"
|
||||
end
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ class Readline < Formula
|
||||
|
||||
bottle do
|
||||
cellar :any
|
||||
sha256 "f36867f7a2762620894058678f400aa945c9a6930a7a33f7e74d02e12639bbb4" => :tiger_altivec
|
||||
sha256 "5ec9e06a248e6d50c9dfa10ab3a862597fbbb66e79039c2848a6da4995b16af4" => :tiger_g3
|
||||
sha256 "42447f1f1ed5a90e778c74131bb24431438864dccd8fdf1d9f120ee62550da67" => :tiger_altivec
|
||||
sha256 "87370403df816b715cb920cce228a31240e7d6eab976bf32b92e2f77050dac06" => :leopard_g3
|
||||
sha256 "3d347f4be190c3881c6240f3037e4e5b474b47c36740cf21595ba4122e280205" => :leopard_altivec
|
||||
end
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
class Tcsh < Formula
|
||||
desc "Enhanced, fully compatible version of the Berkeley C shell"
|
||||
homepage "http://www.tcsh.org/"
|
||||
url "ftp://ftp.astron.com/pub/tcsh/tcsh-6.19.00.tar.gz"
|
||||
mirror "http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/tcsh-6.19.00.tar.gz"
|
||||
sha256 "12e271e0b89e4259d9d6e8d525322e77340e7244cfbd199a591e5f8146285c49"
|
||||
url "ftp://ftp.astron.com/pub/tcsh/tcsh-6.20.00.tar.gz"
|
||||
mirror "https://ftp.osuosl.org/pub/blfs/conglomeration/tcsh/tcsh-6.20.00.tar.gz"
|
||||
sha256 "b89de7064ab54dac454a266cfe5d8bf66940cb5ed048d0c30674ea62e7ecef9d"
|
||||
|
||||
bottle do
|
||||
sha256 "2d3fed239e9d5ac71b47c3e5bf96b93c1e9ba77c3799ca482a5b6809621d5f1e" => :yosemite
|
||||
sha256 "ff5b980d71cb0f151264f0a7f6c6b34120e2420aac284ecfe8fcf908f4e90c07" => :mavericks
|
||||
sha256 "beab7a774551d3b446526359c31900fbbc7300403b545395c1949ba302a65e24" => :mountain_lion
|
||||
sha256 "9ea07dfb5815b5cfda4c022870a31fce1e1e66109d6afd21d45870b6566eef50" => :tiger_g3
|
||||
sha256 "e574d87dd70e6604f675033fcea4bd3f7529242dd868d705a8bae694f87f7a03" => :tiger_altivec
|
||||
sha256 "2ff1a8f5dbd9a71f555009b7ee509dc033953d4558a3fed85f74781a12942c5a" => :tiger_g5
|
||||
end
|
||||
|
||||
def install
|
||||
@@ -17,10 +17,10 @@ class Tcsh < Formula
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.csh").write <<-EOS.undent
|
||||
#!#{bin}/tcsh
|
||||
(testpath/"test.csh").write <<~EOS
|
||||
#!#{bin}/tcsh -f
|
||||
set ARRAY=( "t" "e" "s" "t" )
|
||||
foreach i ( `seq $#ARRAY` )
|
||||
foreach i ( 1 2 3 4 )
|
||||
echo -n $ARRAY[$i]
|
||||
end
|
||||
EOS
|
||||
|
||||
@@ -97,17 +97,25 @@ fetch() {
|
||||
trap - SIGINT
|
||||
fi
|
||||
|
||||
if [[ "$(sysctl -n hw.cputype)" = "18" ]]; then
|
||||
cpu_family="$(sysctl -n hw.cpusubtype)"
|
||||
else
|
||||
cpu_family="$(sysctl -n hw.cpufamily)"
|
||||
fi
|
||||
|
||||
if [[ -x "$(which shasum)" ]]
|
||||
then
|
||||
sha="$(shasum -a 256 "$CACHED_LOCATION" | cut -d' ' -f1)"
|
||||
elif [[ -x "$(which sha256sum)" ]]
|
||||
then
|
||||
sha="$(sha256sum "$CACHED_LOCATION" | cut -d' ' -f1)"
|
||||
elif [[ -x "$(which ruby)" ]]
|
||||
# Ruby 1.8.2's vendored Ruby has broken SHA256 calculation pre-G4e
|
||||
elif [[ -x "$(which ruby)" && "$cpu_family" != 9 && "$cpu_family" != 10 ]]
|
||||
then
|
||||
sha="$(ruby -e "require 'digest/sha2'; digest = Digest::SHA256.new; File.open('$CACHED_LOCATION', 'rb') { |f| digest.update(f.read) }; puts digest.hexdigest")"
|
||||
# Pure Perl SHA256 implementation
|
||||
else
|
||||
odie "Cannot verify the checksum ('shasum' or 'sha256sum' not found)!"
|
||||
sha="$($VENDOR_DIR/sha256 "$CACHED_LOCATION")"
|
||||
fi
|
||||
|
||||
if [[ "$sha" != "$VENDOR_SHA" ]]
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
Digest::SHA::PurePerl version 5.95
|
||||
==================================
|
||||
|
||||
Digest::SHA::PurePerl is a complete implementation of the NIST
|
||||
Secure Hash Standard. It gives Perl programmers a convenient way
|
||||
to calculate SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224,
|
||||
and SHA-512/256 message digests. The module can handle all types of
|
||||
input, including partial-byte data.
|
||||
|
||||
DEPENDENCIES
|
||||
|
||||
None
|
||||
|
||||
COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2003-2014 Mark Shelor
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the same terms as Perl itself.
|
||||
|
||||
Please refer to the Perl Artistic License for details:
|
||||
|
||||
http://search.cpan.org/perldoc?perlartistic
|
||||
+1594
File diff suppressed because it is too large.
Load diff
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh # Graceful sha256 for tigerbrew with fallbacks. Public domain.
|
||||
|
||||
# Cycle through utilities we may likely have that can compute a sha256.
|
||||
# We make sure it works correctly by grepping a few digits of /dev/null.
|
||||
# If we don't have a utility (or utility doesn't have the algorithm),
|
||||
# fail silently and move on.
|
||||
|
||||
# These two variables should be defined if this was called through brew;
|
||||
# otherwise, define them by shelling out in case this was called manually.
|
||||
homebrew_prefix=${HOMEBREW_PREFIX:-$(brew --repository)}
|
||||
homebrew_repository=${HOMEBREW_REPOSITORY:-$(brew --repository)}
|
||||
|
||||
homebrew_openssl="$homebrew_prefix/opt/openssl/bin/openssl"
|
||||
vendor_openssl="$homebrew_repository/Library/Homebrew/vendor/portable-openssl/current/bin/openssl"
|
||||
|
||||
for util in "sha2 -q -256" "openssl dgst -sha256" "$vendor_openssl" "$homebrew_openssl dgst -sha256" "shasum -a 256" "gsha256sum"
|
||||
do
|
||||
$util </dev/null 2>/dev/null | grep e3b0c >/dev/null 2>&1 &&
|
||||
exec $util "$@" | sed -e's|.*= ||' -e's| .*||' && exit 0
|
||||
done
|
||||
|
||||
# If we don't have a faster utility installed, then fall back to this
|
||||
# stand-alone version of Digest::SHA::PurePerl. I've changed the default
|
||||
# algorithm to sha256 instead of sha1, but otherwise its still functionally
|
||||
# equivalent to 'shasum'. The script will use Digest::SHA (the binary
|
||||
# version) if our perl happens to have it (although the perl 5.8 that ships
|
||||
# with 10.4 indeed does not), falling back to the pure perl module only
|
||||
# as a last resort. Digest::SHA::PurePerl is Artistic license.
|
||||
|
||||
exec perl -I"$(dirname "$0")" "$(dirname "$0")/shasum" "$@" | sed 's| .*||'
|
||||
+329
@@ -0,0 +1,329 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
## shasum: filter for computing SHA digests (ref. sha1sum/md5sum)
|
||||
##
|
||||
## Copyright (C) 2003-2015 Mark Shelor, All Rights Reserved
|
||||
##
|
||||
## Version: 5.95
|
||||
## Sat Jan 10 12:15:36 MST 2015
|
||||
|
||||
## shasum SYNOPSIS adapted from GNU Coreutils sha1sum. Add
|
||||
## "-a" option for algorithm selection,
|
||||
## "-U" option for Universal Newlines support,
|
||||
## "-0" option for reading bit strings, and
|
||||
## "-p" option for portable digests (to be deprecated).
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Fcntl;
|
||||
use Getopt::Long;
|
||||
|
||||
my $POD = <<'END_OF_POD';
|
||||
|
||||
=head1 NAME
|
||||
|
||||
shasum - Print or Check SHA Checksums
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
Usage: shasum [OPTION]... [FILE]...
|
||||
Print or check SHA checksums.
|
||||
With no FILE, or when FILE is -, read standard input.
|
||||
|
||||
-a, --algorithm 1, 224, 256, 384, 512, 512224, 512256
|
||||
-b, --binary read in binary mode
|
||||
-c, --check read SHA sums from the FILEs and check them
|
||||
-t, --text read in text mode (default)
|
||||
-U, --UNIVERSAL read in Universal Newlines mode
|
||||
produces same digest on Windows/Unix/Mac
|
||||
-0, --01 read in BITS mode
|
||||
ASCII '0' interpreted as 0-bit,
|
||||
ASCII '1' interpreted as 1-bit,
|
||||
all other characters ignored
|
||||
-p, --portable read in portable mode (to be deprecated)
|
||||
|
||||
The following two options are useful only when verifying checksums:
|
||||
-s, --status don't output anything, status code shows success
|
||||
-w, --warn warn about improperly formatted checksum lines
|
||||
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
When verifying SHA-512/224 or SHA-512/256 checksums, indicate the
|
||||
algorithm explicitly using the -a option, e.g.
|
||||
|
||||
shasum -a 512224 -c checksumfile
|
||||
|
||||
The sums are computed as described in FIPS PUB 180-4. When checking,
|
||||
the input should be a former output of this program. The default
|
||||
mode is to print a line with checksum, a character indicating type
|
||||
(`*' for binary, ` ' for text, `U' for UNIVERSAL, `^' for BITS, `?'
|
||||
for portable), and name for each FILE.
|
||||
|
||||
Report shasum bugs to mshelor@cpan.org
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Running I<shasum> is often the quickest way to compute SHA message
|
||||
digests. The user simply feeds data to the script through files or
|
||||
standard input, and then collects the results from standard output.
|
||||
|
||||
The following command shows how to compute digests for typical inputs
|
||||
such as the NIST test vector "abc":
|
||||
|
||||
perl -e "print qq(abc)" | shasum
|
||||
|
||||
Or, if you want to use SHA-256 instead of the default SHA-1, simply say:
|
||||
|
||||
perl -e "print qq(abc)" | shasum -a 256
|
||||
|
||||
Since I<shasum> mimics the behavior of the combined GNU I<sha1sum>,
|
||||
I<sha224sum>, I<sha256sum>, I<sha384sum>, and I<sha512sum> programs,
|
||||
you can install this script as a convenient drop-in replacement.
|
||||
|
||||
Unlike the GNU programs, I<shasum> encompasses the full SHA standard by
|
||||
allowing partial-byte inputs. This is accomplished through the BITS
|
||||
option (I<-0>). The following example computes the SHA-224 digest of
|
||||
the 7-bit message I<0001100>:
|
||||
|
||||
perl -e "print qq(0001100)" | shasum -0 -a 224
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (c) 2003-2015 Mark Shelor <mshelor@cpan.org>.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
I<shasum> is implemented using the Perl module L<Digest::SHA> or
|
||||
L<Digest::SHA::PurePerl>.
|
||||
|
||||
=cut
|
||||
|
||||
END_OF_POD
|
||||
|
||||
my $VERSION = "5.95";
|
||||
|
||||
sub usage {
|
||||
my($err, $msg) = @_;
|
||||
|
||||
$msg = "" unless defined $msg;
|
||||
if ($err) {
|
||||
warn($msg . "Type shasum -h for help\n");
|
||||
exit($err);
|
||||
}
|
||||
my($USAGE) = $POD =~ /SYNOPSIS(.+?)^=/sm;
|
||||
$USAGE =~ s/^\s*//;
|
||||
$USAGE =~ s/\s*$//;
|
||||
$USAGE =~ s/^ //gm;
|
||||
print $USAGE, "\n";
|
||||
exit($err);
|
||||
}
|
||||
|
||||
|
||||
## Sync stdout and stderr by forcing a flush after every write
|
||||
|
||||
select((select(STDOUT), $| = 1)[0]);
|
||||
select((select(STDERR), $| = 1)[0]);
|
||||
|
||||
|
||||
## Collect options from command line
|
||||
|
||||
my ($alg, $binary, $check, $text, $status, $warn, $help, $version);
|
||||
my ($portable, $BITS, $reverse, $UNIVERSAL, $versions);
|
||||
|
||||
eval { Getopt::Long::Configure ("bundling") };
|
||||
GetOptions(
|
||||
'b|binary' => \$binary, 'c|check' => \$check,
|
||||
't|text' => \$text, 'a|algorithm=i' => \$alg,
|
||||
's|status' => \$status, 'w|warn' => \$warn,
|
||||
'h|help' => \$help, 'v|version' => \$version,
|
||||
'p|portable' => \$portable,
|
||||
'0|01' => \$BITS,
|
||||
'R|REVERSE' => \$reverse,
|
||||
'U|UNIVERSAL' => \$UNIVERSAL,
|
||||
'V|VERSIONS' => \$versions,
|
||||
) or usage(1, "");
|
||||
|
||||
|
||||
## Deal with help requests and incorrect uses
|
||||
|
||||
usage(0)
|
||||
if $help;
|
||||
usage(1, "shasum: Ambiguous file mode\n")
|
||||
if scalar(grep {defined $_}
|
||||
($binary, $portable, $text, $BITS, $UNIVERSAL)) > 1;
|
||||
usage(1, "shasum: --warn option used only when verifying checksums\n")
|
||||
if $warn && !$check;
|
||||
usage(1, "shasum: --status option used only when verifying checksums\n")
|
||||
if $status && !$check;
|
||||
|
||||
|
||||
## Try to use Digest::SHA. If not installed, use the slower
|
||||
## but functionally equivalent Digest::SHA::PurePerl instead.
|
||||
|
||||
## If option -R is invoked, reverse the module preference,
|
||||
## i.e. try Digest::SHA::PurePerl first, then Digest::SHA.
|
||||
|
||||
my @MODS = qw(Digest::SHA Digest::SHA::PurePerl);
|
||||
@MODS[0, 1] = @MODS[1, 0] if $reverse;
|
||||
|
||||
my $module;
|
||||
for (@MODS) {
|
||||
my $mod = $_;
|
||||
if (eval "require $mod") {
|
||||
$module = $mod;
|
||||
last;
|
||||
}
|
||||
}
|
||||
die "shasum: Unable to find " . join(" or ", @MODS) . "\n"
|
||||
unless defined $module;
|
||||
|
||||
|
||||
## Default to SHA-256 unless overridden by command line option
|
||||
|
||||
$alg = 256 unless defined $alg;
|
||||
grep { $_ == $alg } (1, 224, 256, 384, 512, 512224, 512256)
|
||||
or usage(1, "shasum: Unrecognized algorithm\n");
|
||||
|
||||
|
||||
## Display version information if requested
|
||||
|
||||
if ($version) {
|
||||
print "$VERSION\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($versions) {
|
||||
print "shasum $VERSION\n";
|
||||
print "$module ", eval "\$${module}::VERSION", "\n";
|
||||
print "perl ", defined $^V ? sprintf("%vd", $^V) : $], "\n";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
## Try to figure out if the OS is DOS-like. If it is,
|
||||
## default to binary mode when reading files, unless
|
||||
## explicitly overridden by command line "--text" or
|
||||
## "--UNIVERSAL" or "--portable" options.
|
||||
|
||||
my $isDOSish = ($^O =~ /^(MSWin\d\d|os2|dos|mint|cygwin)$/);
|
||||
if ($isDOSish) { $binary = 1 unless $text || $UNIVERSAL || $portable }
|
||||
|
||||
my $modesym = $binary ? '*' : ($UNIVERSAL ? 'U' :
|
||||
($BITS ? '^' : ($portable ? '?' : ' ')));
|
||||
|
||||
|
||||
## Read from STDIN (-) if no files listed on command line
|
||||
|
||||
@ARGV = ("-") unless @ARGV;
|
||||
|
||||
|
||||
## sumfile($file): computes SHA digest of $file
|
||||
|
||||
sub sumfile {
|
||||
my $file = shift;
|
||||
|
||||
my $mode = $binary ? 'b' : ($UNIVERSAL ? 'U' :
|
||||
($BITS ? '0' : ($portable ? 'p' : '')));
|
||||
my $digest = eval { $module->new($alg)->addfile($file, $mode) };
|
||||
if ($@) { warn "shasum: $file: $!\n"; return }
|
||||
$digest->hexdigest;
|
||||
}
|
||||
|
||||
|
||||
## %len2alg: maps hex digest length to SHA algorithm
|
||||
|
||||
my %len2alg = (40 => 1, 56 => 224, 64 => 256, 96 => 384, 128 => 512);
|
||||
$len2alg{56} = 512224 if $alg == 512224;
|
||||
$len2alg{64} = 512256 if $alg == 512256;
|
||||
|
||||
|
||||
## unescape: convert backslashed filename to plain filename
|
||||
|
||||
sub unescape {
|
||||
$_ = shift;
|
||||
s/\\\\/\0/g;
|
||||
s/\\n/\n/g;
|
||||
return if /\\/;
|
||||
s/\0/\\/g;
|
||||
return $_;
|
||||
}
|
||||
|
||||
|
||||
## verify: confirm the digest values in a checksum file
|
||||
|
||||
sub verify {
|
||||
my $checkfile = shift;
|
||||
my ($err, $fmt_errs, $read_errs, $match_errs) = (0, 0, 0, 0);
|
||||
my ($num_lines, $num_files) = (0, 0);
|
||||
my ($bslash, $sum, $fname, $rsp, $digest);
|
||||
|
||||
local *FH;
|
||||
$checkfile eq '-' and open(FH, '< -')
|
||||
and $checkfile = 'standard input'
|
||||
or sysopen(FH, $checkfile, O_RDONLY)
|
||||
or die "shasum: $checkfile: $!\n";
|
||||
while (<FH>) {
|
||||
next if /^#/; s/\n$//; s/^[ \t]+//; $num_lines++;
|
||||
$bslash = s/^\\//;
|
||||
($sum, $modesym, $fname) =
|
||||
/^([\da-fA-F]+)[ \t]([ *?^U])([^\0]*)/;
|
||||
$alg = defined $sum ? $len2alg{length($sum)} : undef;
|
||||
$fname = unescape($fname) if defined $fname && $bslash;
|
||||
if (grep { ! defined $_ } ($alg, $sum, $modesym, $fname)) {
|
||||
$alg = 1 unless defined $alg;
|
||||
warn("shasum: $checkfile: $.: improperly " .
|
||||
"formatted SHA$alg checksum line\n") if $warn;
|
||||
$fmt_errs++;
|
||||
next;
|
||||
}
|
||||
$fname =~ s/\r$// unless -e $fname;
|
||||
$rsp = "$fname: "; $num_files++;
|
||||
($binary, $text, $UNIVERSAL, $BITS, $portable) =
|
||||
map { $_ eq $modesym } ('*', ' ', 'U', '^', 'p');
|
||||
unless ($digest = sumfile($fname)) {
|
||||
$rsp .= "FAILED open or read\n";
|
||||
$err = 1; $read_errs++;
|
||||
}
|
||||
else {
|
||||
if (lc($sum) eq $digest) { $rsp .= "OK\n" }
|
||||
else { $rsp .= "FAILED\n"; $err = 1; $match_errs++ }
|
||||
}
|
||||
print $rsp unless $status;
|
||||
}
|
||||
close(FH);
|
||||
unless ($num_files) {
|
||||
$alg = 1 unless defined $alg;
|
||||
warn("shasum: $checkfile: no properly formatted " .
|
||||
"SHA$alg checksum lines found\n");
|
||||
$err = 1;
|
||||
}
|
||||
elsif (! $status) {
|
||||
warn("shasum: WARNING: $fmt_errs line" . ($fmt_errs>1?
|
||||
's are':' is') . " improperly formatted\n") if $fmt_errs;
|
||||
warn("shasum: WARNING: $read_errs listed file" .
|
||||
($read_errs>1?'s':'') . " could not be read\n") if $read_errs;
|
||||
warn("shasum: WARNING: $match_errs computed checksum" .
|
||||
($match_errs>1?'s':'') . " did NOT match\n") if $match_errs;
|
||||
}
|
||||
return($err == 0);
|
||||
}
|
||||
|
||||
|
||||
## Verify or compute SHA checksums of requested files
|
||||
|
||||
my($file, $digest);
|
||||
|
||||
my $STATUS = 0;
|
||||
for $file (@ARGV) {
|
||||
if ($check) { $STATUS = 1 unless verify($file) }
|
||||
elsif ($digest = sumfile($file)) {
|
||||
if ($file =~ /[\n\\]/) {
|
||||
$file =~ s/\\/\\\\/g; $file =~ s/\n/\\n/g;
|
||||
$digest = "\\$digest";
|
||||
}
|
||||
print "$digest $modesym", "$file\n";
|
||||
}
|
||||
else { $STATUS = 1 }
|
||||
}
|
||||
exit($STATUS)
|
||||
Reference in new issue
Block a user