60 Commits

Author SHA1 Message Date
Misty De Meo
db38053840 Clarify ENV.gcc, ENV.llvm c++ compiler names 2013-06-27 15:13:02 -05:00
Jack Nagel
50db35e5d3 Use Hardware::CPU module 2013-06-14 10:34:17 -05:00
Clemens Gruber
fc649af17a superenv: apply apr-1-config fix to 10.8+
Fixes Homebrew/homebrew#20417.
Closes Homebrew/homebrew#20474.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-06-13 11:33:16 -05:00
Samuel John
7aa2bcc3d5 Python add -F#{python.framework} for brewed Python
Since Python has been removed from superenv and
added as an explicit `depends_on :python`,
we should add
`-F#{HOMEBREW_PREFIX}/opt/python/Framewoks`
so that build tools that don't use
`python-config --ldflags` (as they should!)
can link against brewed Python.
2013-06-05 14:46:02 +02:00
Samuel John
0688991507 superenv: Work if build tool changes DEVELOPER_DIR
Some build systems still set the DEVELOPER_DIR to /Developer
and then nothing works any more (xcrun, xcodebuild etc.)
I am looking at you MacVim.
2013-06-03 17:29:43 +02:00
Samuel John
c524895666 Python 2.x and 3.x support
New `depends_on :python` Dependency.
New `depends_on :python3` Dependency.

To avoid having multiple formulae with endings -py2 and -py3,
we will handle support for different pythons (2.x vs. 3.x)
in the same formula.
Further brewed vs. external python will be transparently supported.

The formula also gets a new object `python`, which is false if
no Python is available or the user has disabled it. Otherwise
it is defined and provides several support methods:

python.site_packages # the site-packages in the formula's Cellar
python.global_site_packages
python.binary # the full path to the python binary
python.prefix
python.version
python.version.major
python.version.minor
python.xy # => e.g. "python2.7"
python.incdir # includes of python
python.libdir # the python dylib library
python.pkg_config_path # used internally by brew
python.from_osx?
python.framework?
python.universal?
python.pypy?
python.standard_caveats # Text to set PYTHONPATH for python.from_osx?
python.if3then3 # => "" for 2.x and to "3" for 3.x.

Further, to avoid code duplication, `python` takes an optional
block that is run twice if the formula defines depends_on
:python AND :python3.

python do
  system python, 'setup.py', "--prefix=#{prefix}"
end

Read more in the Homebrew wiki.
2013-06-03 17:29:43 +02:00
Jack Nagel
9647954a60 Allow gcc-4.2 in HOMEBREW_CC
Fixes:

$ HOMEBREW_CC=gcc brew irb
...
irb(main):001:0> require 'superenv'
=> true
irb(main):002:0> ENV.setup_build_environment
=> nil
irb(main):003:0> ENV.setup_build_environment
Warning: Invalid value for HOMEBREW_CC: gcc-4.2
2013-06-02 19:45:09 -05:00
Misty De Meo
63b9031159 superenv: find Homebrew's gcc-4.2
If we're using a homebrewed gcc-4.2, xcrun may fail to find it (or,
worse, find superenv's shim instead). Explicitly add it to the PATH and
search all path elements for the requested tool.

Also make sure to specify 'gcc-4.2' as the compiler name, not plain
'gcc'. That can resolve to llvm-gcc and to gcc-4.0 on various Xcodes.
2013-06-02 14:44:27 -05:00
Misty De Meo
d212b360ec superenv: Improve compiler selection
This fixes superenv on Xcode 3.2.6, and also fixes C++ software with
gcc-4.2 on all Xcodes.
2013-05-27 12:56:25 -05:00
Mike McQuaid
ad5c1b81cd Fix --build-bottle CFLAGS.
The CFLAGS were previously not generic enough.

References Homebrew/homebrew#18944.
References Homebrew/homebrew#19179.
2013-05-11 12:18:25 +01:00
Jack Nagel
aa58a404ed Fix another handful of warnings 2013-04-06 00:14:03 -05:00
Samuel John
c6b0b563e8 Better superenv support for Xcode elsewhere
- The Library/ENV/4.3/xcrun shim now respects
  ENV['DEVELOPER_DIR'] instead assuming the location
  of /Applications/Xcode.app/Contents/Developer.
- The env var DEVELOPER_DIR is set if it is not
  already. So, during superenv this var is always set
  and we no longer have to care about people with unset
  or wrongly set xcode-select stuff. This has been
  a major PITA in the past.
- determine_developer_dir (which is used to set
  the DEVELOPER_DIR var) now uses MacOS::Xcode.prefix
  which is proven and very capable and uses splotlight
  correctly.
- Replace (and remove) MacSystem.xcode43_developer_dir
  with Xcode.prefix

Closes Homebrew/homebrew#18618
2013-03-21 17:10:32 +01:00
Misty De Meo
edeb5e2397 superenv: fix xcode43_developer_dir check 2013-03-20 21:50:32 -05:00
Misty De Meo
81f9aef245 superenv?: fail when xcode43_developer_dir raises 2013-03-20 10:52:51 -05:00
Misty De Meo
16672b9d82 superenv: move check logic into superenv?
Fixes Homebrew/homebrew#16292.
2013-03-20 10:52:51 -05:00
Misty De Meo
5c746bf855 superenv: move MacSystem into separate file
This makes it requirable before superenv becomes active.
2013-03-20 10:52:51 -05:00
Jack Nagel
e463016428 ENV: clear influential include path vars 2013-03-16 13:51:30 -05:00
Jack Nagel
43c39afb8f Use attr_accessor to suppress warning 2013-03-09 17:13:41 -06:00
Jack Nagel
a21be66fc8 Rename these collections for clarity 2013-03-09 17:13:34 -06:00
Jack Nagel
149e65cc8a Add pkgconfig dirs for all deps under superenv
Fixes Homebrew/homebrew#18367.
2013-03-09 16:45:56 -06:00
Jack Nagel
2cc9322fbd Exclude global pkgconfig dirs under superenv 2013-03-09 14:46:01 -06:00
Jack Nagel
878747d458 Index pkgconfig directories by MacOS.version 2013-03-09 14:46:01 -06:00
Misty De Meo
2e23e9a22d superenv: --use-gcc should specify gcc-4.2
Since 'gcc' is a symlink to 'llvm-gcc' on Xcode 4.3+, --use-gcc and
--use-llvm were doing exactly the same thing. Combined with the
previous commit, this allows users with either a leftover
/usr/bin/gcc-4.2 or a homebrewed apple-gcc42 to build with gcc.

This doesn't however fix Xcode-only systems with apple-gcc42.

Fixes Homebrew/homebrew#17243.
2013-01-26 22:57:56 -06:00
Samuel John
293be41d5c superenv: Allow ENV.m32 (for 32bit builds)
Superenv normally filters out "-m32" flag, preventing 32bit builds.
Some software, however, still only work in 32bit mode.

If ENV.m32 is called, superenv does not filter out the "-m32" flag.
Also note, superenv, does not explicitly add the -m32 flag and
expects the build system of the software to know when and where to
provide this flag.

Closes Homebrew/homebrew#16350.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-01-24 19:21:57 -08:00
Jack Nagel
d4dc1bbd15 superenv: favor /opt/X11 over /usr/X11 when both exist
This is the order of precedence used elsewhere in Homebrew when
detecting X11 versions and prefixes.

Fixes Homebrew/homebrew#16598.
2013-01-20 19:46:01 -06:00
Adam Vandenberg
a5e969dfb5 superenv: make HOMEBREW_FILE available
Superenv scripts have a stripped PATH, which may not include
the brew binary itself. Make this explicitly available to
superenv scripts.

Fixes bsdmake wrapper.

Closes Homebrew/homebrew#16805.
Closes Homebrew/homebrew#16846.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-01-03 09:14:36 -08:00
Camillo Lugaresi
5e39ce44fe separate ENV/pkgconfig dirs by OS version
Closes Homebrew/homebrew#16063.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-11-19 22:04:04 -06:00
Charlie Sharpsteen
0d5a42ad89 superenv.rb: Configure Objective-C compilers
The [`OBJC`][1] and [`OBJCXX`][2] environment variables should be set along with `CC` and
`CXX`. Some formulae require these to be set in order to properly configure
against Homebrew's compilers.

Fixes Homebrew/homebrew#16029.

  [1]:http://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Objective-C-Compiler.html
  [2]:http://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Objective-C_002b_002b-Compiler.html
2012-11-13 20:54:29 -08:00
Misty De Meo
4125fa8121 superenv: don't set VERBOSE
haskell-platform falls over badly if VERBOSE is set. Theoretically
this could happen to other packages too. Really it's just less
painful to avoid setting the env var in the first place.

Fixes Homebrew/homebrew#15989.
2012-11-13 15:46:14 -06:00
Jack Nagel
6136c3c5d1 Update vendered pc file path in superenv 2012-11-11 16:24:24 -06:00
Max Howell
3cb7a02beb superenv: Add brewed-python bin to PATH
A required special case since formula that use python can optionally use system python or Homebrew python. We'll probably need more of this sort of thing.
2012-10-01 09:40:40 -04:00
samueljohn
532c849b58 python goes superenv
- Install a sitecustomize.py that is only executed for brewed
  python to
  -  Fix the prefix, python thinks it is installed to.
     (Remember, Python thinks it lives in the Cellar)
  -  Remove "/System/..." stuff from sys.path which caused
     a lot of install trouble because setuptools has the
     habbit to inject itself upfront, overwriting our distribute.
- Allow --with-poll and don't say, we didn't warn you.
- Don't need depends_on :x11 any longer. Yeah, no XQuartz!
- Add --with-brewed-openssl
- pip 1.2.1
- pip, pip-2.7, easy_install and easy_install-2.7 are installed
  to prefix, such that they are directly available, even if
  people have not set their PATH to include
  $(brew --prefix)/share/python
- Caveats shorter and clear.
- For Xcode-only:
  - Patch the distutils buildsystem to use "xcrun cc" etc.
  - Teach distutils the MacOS.sdk_path (for incs and libs)
- superenv.rb add the right python include dir depending on
  whether a brewed python is installed or not.

Closes Homebrew/homebrew#15064.

Signed-off-by: Max Howell <mxcl@me.com>
2012-09-29 09:43:39 -04:00
Max Howell
69ba010637 superenv: reset LD
Refs Homebrew/homebrew#15090.
2012-09-28 17:29:37 -04:00
Max Howell
382fa27520 Don't unset DEVELOPER_DIR if set 2012-09-25 11:31:56 -04:00
Max Howell
ca14962ab9 Assign DEVELOPER_DIR before it is needed
On a broken set up, setting DEVELOPER_DIR can fix builds, provided it is set early enough to impact them.
2012-09-24 09:49:54 -04:00
Max Howell
82c58bb615 Fix doctor hanging if xcode-select is bad
Also fix typo in the superenv DEVELOPER_DIR set detection code.
2012-09-24 08:49:58 -04:00
Max Howell
bcf0d6f245 superenv: Remove HOMEBREW_PREFIX/bin from PATH
We add the bins from all deps instead. Rationale: formula find and use eg. GNU-coreutils versions of things and then break. Only allow formula to use tools that they depend on and expect.

I want to go further and only add include paths etc. for dependencies, I have done some work on this, but I fear it may be impossible. If an include path is eg. /usr/local/lib/foo/include, is it possible to know if this path is bad? Not always AFAICT.
2012-09-23 21:26:50 -04:00
Max Howell
a0df6180b7 Set DEVELOPER_DIR; Fixes bad xcode-select path
In cases where the xcode-select -print-path is '/' xcrun still hangs indefinitely, setting DEVELOPER_DIR to something (preferably the Xcode path) fixes that. So let's.
2012-09-23 20:57:41 -04:00
Max Howell
d147a4b989 superenv: don't set LD
Some compile issue will no doubt elapse, but we can address these on a case-by-case basis.

Refs Homebrew/homebrew#14943.
2012-09-21 23:22:35 -04:00
Max Howell
d1f1d736e8 Don't add GL paths to superenv if depends_on X
Fixes Homebrew/homebrew#14780.
2012-09-13 12:13:36 -04:00
Jack Nagel
59d5a246e7 Clean up MacOS version method usage
The MacOS.version? family of methods (other than "leopard?") are poorly
defined and lead to confusing code. Replace them in formulae with more
explicit comparisons.

"MacOS.version" is a special version object that can be compared to
numerics, symbols, and strings using the standard Ruby comparison
methods.

The old methods were moved to compat when the version comparison code
was merged, and they must remain there "forever", but they should not be
used in new code.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-10 16:16:54 -05:00
Max Howell
4febf938ae Put X11 last in the libpath and cpath
It was after HOMEBREW_PREFIX but not after everything else too.
2012-09-03 15:12:31 -04:00
Max Howell
c35f6cb9d5 Set CC and CXX with superenv (again)
It was dumb to have make call different compilers to configure depending on the `servile?` flag. This is not a route to reliability.

Instead now we set CC (formula that break if CC is set like Jack be damned, their build-systems are just plain broken and should not be supported). When cc is called we examine HOMEBREW_CC, otherwise we instantiate the tool that was called, just like the formula's build-system will expect.

Fixes Homebrew/homebrew#14659 (though the build fails later for me, with the same error for stdenv and superenv).
2012-09-03 15:12:31 -04:00
Max Howell
af06c75d72 Add NCLT SDK apache include directory to superenv
Fixes subversion compile issues for NCLT configurations with superenv, stdenv still broken (tough).
2012-09-03 15:12:30 -04:00
Max Howell
429226d562 Hack so that ENV['CFLAGS'] += "foo" always works
So many formula assume CFLAGS etc. are not nil. One fix would be to set them to "" but this would set them in the environment, and that could have consequences for build-scripts. This hack works but with a (hopefully) small caveat.

Fixes Homebrew/homebrew#14580.
2012-08-31 23:45:10 -04:00
Max Howell
30b53cf92a Cram GL headers and includes into superenv
Fixes Homebrew/homebrew#14554.

We justify doing this because pre 10.8 X11 came with GL for all Homebrew-capable systems and as such is a default that we'd prefer not to have to address.
2012-08-31 14:12:28 -04:00
Max Howell
f6ded076df superenv fix for broken 10.8 apr-1-config
serf requires you to explicitly tell it where to find the supertool because otherwise it has a hardcoded /usr/bin/apr-1-config (:P), ctail however is sensible and searches the PATH so now it's as though we do nothing special in that formula. Nice.
2012-08-31 13:29:45 -04:00
Max Howell
ae17944e06 Raise if sdk_path is nil for nclt
This situation should be impossible now (in that, we should detect sdk_path provided we also detected nclt), so if it happens somehow raise in such a way that the user will be encouraged to report the bug.
2012-08-31 10:27:07 -04:00
Max Howell
6c6e82a721 Set VERBOSE if --verbose
You tend to get more useful build output this way, and (more importantly?), superenv itself only outputs certain things if VERBOSE is set.
2012-08-31 10:22:11 -04:00
Max Howell
05c708b9fc Revert the user-PATH fix
User paths might have anything in them, anything can break builds.

Instead special case these two formula with the view to having an eventual DSL to allow injection of user paths into superenv. Certainly defaulting to off.
2012-08-31 10:22:10 -04:00