Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Import gcc 4.7 from homebrew-dupes. #80

Closed
wants to merge 1 commit into from

2 participants

@manphiz
Collaborator
  • Add head link tracking GCC trunk.
@manphiz manphiz Import gcc 4.7 from homebrew-dupes.
* Add head link tracking GCC trunk.
6a76458
@manphiz
Collaborator

This should go with Homebrew/homebrew-dupes#145.

@manphiz
Collaborator

As Homebrew/homebrew#17911 has already been pulled in, please consider pull this one together with Homebrew/homebrew-dupes#145.

@jacknagel jacknagel closed this pull request from a commit
@manphiz manphiz Import gcc 4.7 from homebrew-dupes
* Add head link tracking GCC trunk.

Closes #80.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
5ff0e23
@jacknagel jacknagel closed this in 5ff0e23
@cwoodcox cwoodcox referenced this pull request
Closed

GCC 4.7 doesn't install #86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 4, 2013
  1. @manphiz

    Import gcc 4.7 from homebrew-dupes.

    manphiz authored
    * Add head link tracking GCC trunk.
This page is out of date. Refresh to see the latest.
Showing with 144 additions and 0 deletions.
  1. +144 −0 gcc47.rb
View
144 gcc47.rb
@@ -0,0 +1,144 @@
+require 'formula'
+
+# NOTE: GCC 4.6.0 adds the gccgo compiler for the Go language. However,
+# gccgo "is currently known to work on GNU/Linux and RTEMS. Solaris support
+# is in progress. It may or may not work on other platforms."
+
+class Gcc < Formula
+ homepage 'http://gcc.gnu.org'
+ url 'http://ftpmirror.gnu.org/gcc/gcc-4.7.2/gcc-4.7.2.tar.bz2'
+ mirror 'http://ftp.gnu.org/gnu/gcc/gcc-4.7.2/gcc-4.7.2.tar.bz2'
+ sha1 'a464ba0f26eef24c29bcd1e7489421117fb9ee35'
+
+ head 'svn://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch'
+
+ option 'enable-cxx', 'Build the g++ compiler'
+ option 'enable-fortran', 'Build the gfortran compiler'
+ option 'enable-java', 'Buld the gcj compiler'
+ option 'enable-objc', 'Enable Objective-C language support'
+ option 'enable-objcxx', 'Enable Objective-C++ language support'
+ option 'enable-all-languages', 'Enable all compilers and languages, except Ada'
+ option 'enable-nls', 'Build with native language support'
+ option 'enable-profiled-build', 'Make use of profile guided optimization when bootstrapping GCC'
+ option 'enable-multilib', 'Build with multilib support'
+
+ fails_with :clang do
+ build 421
+ cause <<-EOS.undent
+ We have had many different clang failure reports:
+ https://github.com/Homebrew/homebrew-dupes/issues/20
+ https://github.com/Homebrew/homebrew-dupes/issues/49
+ https://github.com/Homebrew/homebrew-dupes/pull/66
+ https://github.com/Homebrew/homebrew-dupes/issues/68
+ Unfortunately, nobody seems to be interested in investigating and fixing them.
+ If you have any knowledge to share or can provide a fix, please open an issue.
+ Thanks!
+ EOS
+ end
+
+ depends_on 'gmp'
+ depends_on 'libmpc'
+ depends_on 'mpfr'
+ depends_on 'ecj' if build.include? 'enable-java' or build.include? 'enable-all-languages'
+
+ def install
+ # Force 64-bit on systems that use it. Build failures reported for some
+ # systems when this is not done.
+ ENV.m64 if MacOS.prefer_64_bit?
+
+ # GCC will suffer build errors if forced to use a particular linker.
+ ENV.delete 'LD'
+
+ # This is required on systems running a version newer than 10.6, and
+ # it's probably a good idea regardless.
+ #
+ # https://trac.macports.org/ticket/27237
+ ENV.append 'CXXFLAGS', '-U_GLIBCXX_DEBUG -U_GLIBCXX_DEBUG_PEDANTIC'
+
+ gmp = Formula.factory 'gmp'
+ mpfr = Formula.factory 'mpfr'
+ libmpc = Formula.factory 'libmpc'
+
+ # Sandbox the GCC lib, libexec and include directories so they don't wander
+ # around telling small children there is no Santa Claus. This results in a
+ # partially keg-only brew following suggestions outlined in the "How to
+ # install multiple versions of GCC" section of the GCC FAQ:
+ # http://gcc.gnu.org/faq.html#multiple
+ gcc_prefix = prefix + 'gcc'
+
+ args = [
+ # Sandbox everything...
+ "--prefix=#{gcc_prefix}",
+ # ...except the stuff in share...
+ "--datarootdir=#{share}",
+ # ...and the binaries...
+ "--bindir=#{bin}",
+ # ...which are tagged with a suffix to distinguish them.
+ "--program-suffix=-#{version.to_s.slice(/\d\.\d/)}",
+ "--with-gmp=#{gmp.opt_prefix}",
+ "--with-mpfr=#{mpfr.opt_prefix}",
+ "--with-mpc=#{libmpc.opt_prefix}",
+ "--with-system-zlib",
+ "--enable-stage1-checking",
+ "--enable-plugin",
+ "--enable-lto"
+ ]
+
+ args << '--disable-nls' unless build.include? 'enable-nls'
+
+ if build.include? 'enable-all-languages'
+ # Everything but Ada, which requires a pre-existing GCC Ada compiler
+ # (gnat) to bootstrap. GCC 4.6.0 add go as a language option, but it is
+ # currently only compilable on Linux.
+ languages = %w[c c++ fortran java objc obj-c++]
+ else
+ # The C compiler is always built, but additional defaults can be added
+ # here.
+ languages = %w[c]
+
+ languages << 'c++' if build.include? 'enable-cxx'
+ languages << 'fortran' if build.include? 'enable-fortran'
+ languages << 'java' if build.include? 'enable-java'
+ languages << 'objc' if build.include? 'enable-objc'
+ languages << 'obj-c++' if build.include? 'enable-objcxx'
+ end
+
+ if build.include? 'enable-java' or build.include? 'enable-all-languages'
+ ecj = Formula.factory 'ecj'
+ args << "--with-ecj-jar=#{ecj.opt_prefix}/share/java/ecj.jar"
+ end
+
+ if build.include? 'enable-multilib'
+ args << '--enable-multilib'
+ else
+ args << '--disable-multilib'
+ end
+
+ mkdir 'build' do
+ unless MacOS::CLT.installed?
+ # For Xcode-only systems, we need to tell the sysroot path.
+ # 'native-system-header's will be appended
+ args << "--with-native-system-header-dir=/usr/include"
+ args << "--with-sysroot=#{MacOS.sdk_path}"
+ end
+
+ system '../configure', "--enable-languages=#{languages.join(',')}", *args
+
+ if build.include? 'enable-profiled-build'
+ # Takes longer to build, may bug out. Provided for those who want to
+ # optimise all the way to 11.
+ system 'make profiledbootstrap'
+ else
+ system 'make bootstrap'
+ end
+
+ # At this point `make check` could be invoked to run the testsuite. The
+ # deja-gnu and autogen formulae must be installed in order to do this.
+
+ system 'make install'
+
+ # Remove conflicting manpages in man7
+ man7.rmtree
+ end
+ end
+end
Something went wrong with that request. Please try again.