Use ENV.append_path

This commit is contained in:
Jack Nagel 2013-08-19 17:21:13 -05:00
parent b672b44cf9
commit ea8f51256b
5 changed files with 18 additions and 18 deletions

View File

@ -72,9 +72,9 @@ module Stdenv
# For Xcode 4.3 (*without* the "Command Line Tools for Xcode") compiler and tools inside of Xcode: # For Xcode 4.3 (*without* the "Command Line Tools for Xcode") compiler and tools inside of Xcode:
if not MacOS::CLT.installed? and MacOS::Xcode.installed? and MacOS::Xcode.version >= "4.3" if not MacOS::CLT.installed? and MacOS::Xcode.installed? and MacOS::Xcode.version >= "4.3"
# Some tools (clang, etc.) are in the xctoolchain dir of Xcode # Some tools (clang, etc.) are in the xctoolchain dir of Xcode
append 'PATH', "#{MacOS.xctoolchain_path}/usr/bin", File::PATH_SEPARATOR if MacOS.xctoolchain_path append_path 'PATH', "#{MacOS.xctoolchain_path}/usr/bin" if MacOS.xctoolchain_path
# Others are now at /Applications/Xcode.app/Contents/Developer/usr/bin # Others are now at /Applications/Xcode.app/Contents/Developer/usr/bin
append 'PATH', "#{MacOS.dev_tools_path}", File::PATH_SEPARATOR append_path 'PATH', MacOS.dev_tools_path
end end
end end
@ -217,15 +217,15 @@ module Stdenv
# Extra setup to support Xcode 4.3+ without CLT. # Extra setup to support Xcode 4.3+ without CLT.
self['SDKROOT'] = sdk self['SDKROOT'] = sdk
# Tell clang/gcc where system include's are: # Tell clang/gcc where system include's are:
append 'CPATH', "#{sdk}/usr/include", File::PATH_SEPARATOR append_path 'CPATH', "#{sdk}/usr/include"
# The -isysroot is needed, too, because of the Frameworks # The -isysroot is needed, too, because of the Frameworks
append_to_cflags "-isysroot #{sdk}" append_to_cflags "-isysroot #{sdk}"
append 'CPPFLAGS', "-isysroot #{sdk}" append 'CPPFLAGS', "-isysroot #{sdk}"
# And the linker needs to find sdk/usr/lib # And the linker needs to find sdk/usr/lib
append 'LDFLAGS', "-isysroot #{sdk}" append 'LDFLAGS', "-isysroot #{sdk}"
# Needed to build cmake itself and perhaps some cmake projects: # Needed to build cmake itself and perhaps some cmake projects:
append 'CMAKE_PREFIX_PATH', "#{sdk}/usr", File::PATH_SEPARATOR append_path 'CMAKE_PREFIX_PATH', "#{sdk}/usr"
append 'CMAKE_FRAMEWORK_PATH', "#{sdk}/System/Library/Frameworks", File::PATH_SEPARATOR append_path 'CMAKE_FRAMEWORK_PATH', "#{sdk}/System/Library/Frameworks"
end end
end end
@ -250,24 +250,24 @@ module Stdenv
def x11 def x11
# There are some config scripts here that should go in the PATH # There are some config scripts here that should go in the PATH
append 'PATH', MacOS::X11.bin, File::PATH_SEPARATOR append_path 'PATH', MacOS::X11.bin
# Append these to PKG_CONFIG_LIBDIR so they are searched # Append these to PKG_CONFIG_LIBDIR so they are searched
# *after* our own pkgconfig directories, as we dupe some of the # *after* our own pkgconfig directories, as we dupe some of the
# libs in XQuartz. # libs in XQuartz.
append 'PKG_CONFIG_LIBDIR', MacOS::X11.lib/'pkgconfig', File::PATH_SEPARATOR append_path 'PKG_CONFIG_LIBDIR', MacOS::X11.lib/'pkgconfig'
append 'PKG_CONFIG_LIBDIR', MacOS::X11.share/'pkgconfig', File::PATH_SEPARATOR append_path 'PKG_CONFIG_LIBDIR', MacOS::X11.share/'pkgconfig'
append 'LDFLAGS', "-L#{MacOS::X11.lib}" append 'LDFLAGS', "-L#{MacOS::X11.lib}"
append 'CMAKE_PREFIX_PATH', MacOS::X11.prefix, File::PATH_SEPARATOR append_path 'CMAKE_PREFIX_PATH', MacOS::X11.prefix
append 'CMAKE_INCLUDE_PATH', MacOS::X11.include, File::PATH_SEPARATOR append_path 'CMAKE_INCLUDE_PATH', MacOS::X11.include
append 'CPPFLAGS', "-I#{MacOS::X11.include}" append 'CPPFLAGS', "-I#{MacOS::X11.include}"
append 'ACLOCAL_PATH', MacOS::X11.share/'aclocal', File::PATH_SEPARATOR append_path 'ACLOCAL_PATH', MacOS::X11.share/'aclocal'
unless MacOS::CLT.installed? unless MacOS::CLT.installed?
append 'CMAKE_PREFIX_PATH', MacOS.sdk_path/'usr/X11', File::PATH_SEPARATOR append_path 'CMAKE_PREFIX_PATH', MacOS.sdk_path/'usr/X11'
append 'CPPFLAGS', "-I#{MacOS::X11.include}/freetype2" append 'CPPFLAGS', "-I#{MacOS::X11.include}/freetype2"
append 'CFLAGS', "-I#{MacOS::X11.include}" append 'CFLAGS', "-I#{MacOS::X11.include}"
end end

View File

@ -96,7 +96,7 @@ module Superenv
# so xcrun may not be able to find it # so xcrun may not be able to find it
if self['HOMEBREW_CC'] == 'gcc-4.2' if self['HOMEBREW_CC'] == 'gcc-4.2'
apple_gcc42 = Formula.factory('apple-gcc42') rescue nil apple_gcc42 = Formula.factory('apple-gcc42') rescue nil
append('PATH', apple_gcc42.opt_prefix/'bin', File::PATH_SEPARATOR) if apple_gcc42 append_path('PATH', apple_gcc42.opt_prefix/'bin') if apple_gcc42
end end
end end

View File

@ -87,8 +87,8 @@ class Requirement
case o case o
when Pathname when Pathname
self.class.env do self.class.env do
unless ENV["PATH"].split(":").include?(o.parent.to_s) unless ENV["PATH"].split(File::PATH_SEPARATOR).include?(o.parent.to_s)
ENV.append("PATH", o.parent, ":") ENV.append_path("PATH", o.parent)
end end
end end
end end

View File

@ -254,8 +254,8 @@ class PythonInstalled < Requirement
ENV['PYTHONHOME'] = nil # to avoid fuck-ups. ENV['PYTHONHOME'] = nil # to avoid fuck-ups.
ENV['PYTHONPATH'] = if brewed? then nil; else global_site_packages.to_s; end ENV['PYTHONPATH'] = if brewed? then nil; else global_site_packages.to_s; end
ENV.append 'CMAKE_INCLUDE_PATH', incdir, File::PATH_SEPARATOR ENV.append_path 'CMAKE_INCLUDE_PATH', incdir
ENV.append 'PKG_CONFIG_PATH', pkg_config_path, File::PATH_SEPARATOR if pkg_config_path ENV.append_path 'PKG_CONFIG_PATH', pkg_config_path if pkg_config_path
# We don't set the -F#{framework} here, because if Python 2.x and 3.x are # We don't set the -F#{framework} here, because if Python 2.x and 3.x are
# used, `Python.framework` is ambiguous. However, in the `python do` block # used, `Python.framework` is ambiguous. However, in the `python do` block
# we can set LDFLAGS+="-F#{framework}" because only one is temporarily set. # we can set LDFLAGS+="-F#{framework}" because only one is temporarily set.

View File

@ -75,7 +75,7 @@ class RequirementTests < Test::Unit::TestCase
end.new end.new
ENV.expects(:with_build_environment).yields.returns(which_path) ENV.expects(:with_build_environment).yields.returns(which_path)
ENV.expects(:append).with("PATH", which_path.parent, ":") ENV.expects(:append_path).with("PATH", which_path.parent)
req.satisfied? req.satisfied?
req.modify_build_environment req.modify_build_environment