Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ma11hew28
Last active September 16, 2019 07:49
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ma11hew28/3789921 to your computer and use it in GitHub Desktop.
Save ma11hew28/3789921 to your computer and use it in GitHub Desktop.
How to Install RVM, Ruby, and Gems without Xcode Command Line Tools
# How to Install RVM, Ruby, and Gems without Xcode Command Line Tools
# ===================================================================
#
# Mac OS X 10.8.2 (12C60) (Mountain Lion)
# Xcode 4.5 (4G182)
#
# While attempting to `rvm pkg install openssl`, I had encountered the error:
# > cryptlib.h:62:20: error: stdlib.h: No such file or directory
# But, the commands & ouput below show how I worked around the issue.
#
# Note: I replaced all occurrences below of my home directory path (/Users/username) with ~
#
# UPDATE: I never got this working. Use Homebrew to install Ruby without Xcode Command Line Tools. It works great!
$ bash --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)
Copyright (C) 2007 Free Software Foundation, Inc.
$ cat ~/.bash_profile
export PATH="$PATH:`xcode-select -print-path`/usr/bin:`xcode-select -print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin"
...
$ brew update
$ brew upgrade
$ brew install libksba autoconf automake apple-gcc42 # per rvm requirements
$ brew cleanup --force -s
$ brew list
apple-gcc42 autoconf automake libgpg-error libksba
$ `which gcc-4.2` --version
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ which cpp
/Applications/Xcode.app/Contents/Developer/usr/bin/cpp
$ find /Applications/Xcode.app/Contents/ -name stdlib.h
/Applications/Xcode.app/Contents//Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/include/c++/4.2.1/tr1/stdlib.h
/Applications/Xcode.app/Contents//Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/include/stdlib.h
/Applications/Xcode.app/Contents//Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/include/c++/4.2.1/tr1/stdlib.h
/Applications/Xcode.app/Contents//Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/include/stdlib.h
/Applications/Xcode.app/Contents//Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/stdlib.h
/Applications/Xcode.app/Contents//Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/stdlib.h
/Applications/Xcode.app/Contents//Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1/tr1/stdlib.h
/Applications/Xcode.app/Contents//Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/stdlib.h
$ cat ~/.rvmrc
rvm_configure_flags=(-I`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -L`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib)
$ \curl -L https://get.rvm.io | bash
...
Downloading RVM from wayneeseguin branch master
...
# At this point, I closed and reopened Terminal, just to be sure.
$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:~/.rvm/bin
$ rvm --version
rvm 1.16.17 () by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ rvm pkg install openssl
# Before `rvm install 1.9.3` edit ~/.rvmrc to prevent:
# > configure: error: unrecognized option: `-I...`
$ cat ~/.rvmrc
rvm_configure_env=(CFLAGS=-I`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include LDFLAGS=-L`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib)
# At this point, I closed and reopened Terminal to relaod ~/.rvmrc.
$ CPP=/usr/local/Library/ENV/4.3/cpp CC=`which gcc-4.2` rvm install 1.9.3
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p286.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to ~/.rvm/archives
Extracting yaml-0.1.4.tar.gz to ~/.rvm/src
Configuring yaml in ~/.rvm/src/yaml-0.1.4.
Error running 'env CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include LDFLAGS=-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib ./configure --prefix=~/.rvm/usr', please read ~/.rvm/log/ruby-1.9.3-p286/yaml/configure.log
Compiling yaml in ~/.rvm/src/yaml-0.1.4.
Error running 'make', please read ~/.rvm/log/ruby-1.9.3-p286/yaml/make.log
Installing Ruby from source to: ~/.rvm/rubies/ruby-1.9.3-p286, this may take a while depending on your cpu(s)...
ruby-1.9.3-p286 - #downloading ruby-1.9.3-p286, this may take a while depending on your connection...
ruby-1.9.3-p286 - #extracting ruby-1.9.3-p286 to ~/.rvm/src/ruby-1.9.3-p286
ruby-1.9.3-p286 - #extracted to ~/.rvm/src/ruby-1.9.3-p286
Applying patch ~/.rvm/patches/ruby/1.9.3/p286/cflags.patch
ruby-1.9.3-p286 - #autoreconf
ruby-1.9.3-p286 - #configuring
Error running 'env CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -I~/.rvm/usr/include LDFLAGS=-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib -L~/.rvm/usr/lib ./configure --enable-shared --disable-install-doc --prefix=~/.rvm/rubies/ruby-1.9.3-p286', please read ~/.rvm/log/ruby-1.9.3-p286/configure.log
There has been an error while running configure. Halting the installation.
[2012-10-26 18:10:09] env CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include LDFLAGS=-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib ./configure --prefix=~/.rvm/usr
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking for gcc... /usr/local/bin/gcc-4.2
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /usr/local/bin/gcc-4.2 accepts -g... yes
checking for /usr/local/bin/gcc-4.2 option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of /usr/local/bin/gcc-4.2... gcc3
checking how to run the C preprocessor... /usr/local/Library/ENV/4.3/cpp
configure: error: in `~/.rvm/src/yaml-0.1.4':
configure: error: C preprocessor "/usr/local/Library/ENV/4.3/cpp" fails sanity check
See `config.log' for more details
[2012-10-26 18:10:11] make
make: *** No targets specified and no makefile found. Stop.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by yaml configure 0.1.4, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ ./configure --prefix=~/.rvm/usr
## --------- ##
## Platform. ##
## --------- ##
hostname = Matts-MacBook-Pro.local
uname -m = x86_64
uname -r = 12.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = Mach kernel version:
Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64
Kernel configured for up to 8 processors.
4 processors are physically available.
8 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 8.00 gigabytes
Default processor set: 135 tasks, 669 threads, 8 processors
Load average: 1.27, Mach factor: 6.72
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/local/share/npm/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/bin
PATH: /Applications/Xcode.app/Contents/Developer/usr/bin
PATH: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
PATH: ~/.rvm/bin
PATH: /usr/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2409: checking for a BSD-compatible install
configure:2477: result: /usr/bin/install -c
configure:2488: checking whether build environment is sane
configure:2538: result: yes
configure:2679: checking for a thread-safe mkdir -p
configure:2718: result: config/install-sh -c -d
configure:2731: checking for gawk
configure:2761: result: no
configure:2731: checking for mawk
configure:2761: result: no
configure:2731: checking for nawk
configure:2761: result: no
configure:2731: checking for awk
configure:2747: found /usr/bin/awk
configure:2758: result: awk
configure:2769: checking whether make sets $(MAKE)
configure:2791: result: yes
configure:2947: checking for gcc
configure:2974: result: /usr/local/bin/gcc-4.2
configure:3203: checking for C compiler version
configure:3212: /usr/local/bin/gcc-4.2 --version >&5
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3223: $? = 0
configure:3212: /usr/local/bin/gcc-4.2 -v >&5
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /Volumes/Media/Builds/gcc-5666.3/build/obj/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++,fortran --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
configure:3223: $? = 0
configure:3212: /usr/local/bin/gcc-4.2 -V >&5
gcc-4.2: argument to `-V' is missing
configure:3223: $? = 1
configure:3212: /usr/local/bin/gcc-4.2 -qversion >&5
i686-apple-darwin11-gcc-4.2.1: no input files
configure:3223: $? = 1
configure:3243: checking whether the C compiler works
configure:3265: /usr/local/bin/gcc-4.2 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib conftest.c >&5
configure:3269: $? = 0
configure:3317: result: yes
configure:3320: checking for C compiler default output file name
configure:3322: result: a.out
configure:3328: checking for suffix of executables
configure:3335: /usr/local/bin/gcc-4.2 -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib conftest.c >&5
configure:3339: $? = 0
configure:3361: result:
configure:3383: checking whether we are cross compiling
configure:3391: /usr/local/bin/gcc-4.2 -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib conftest.c >&5
configure:3395: $? = 0
configure:3402: ./conftest
configure:3406: $? = 0
configure:3421: result: no
configure:3426: checking for suffix of object files
configure:3448: /usr/local/bin/gcc-4.2 -c -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include conftest.c >&5
configure:3452: $? = 0
configure:3473: result: o
configure:3477: checking whether we are using the GNU C compiler
configure:3496: /usr/local/bin/gcc-4.2 -c -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include conftest.c >&5
configure:3496: $? = 0
configure:3505: result: yes
configure:3514: checking whether /usr/local/bin/gcc-4.2 accepts -g
configure:3534: /usr/local/bin/gcc-4.2 -c -g conftest.c >&5
configure:3534: $? = 0
configure:3575: result: yes
configure:3592: checking for /usr/local/bin/gcc-4.2 option to accept ISO C89
configure:3656: /usr/local/bin/gcc-4.2 -c -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include conftest.c >&5
configure:3656: $? = 0
configure:3669: result: none needed
configure:3700: checking for style of include used by make
configure:3728: result: GNU
configure:3753: checking dependency style of /usr/local/bin/gcc-4.2
configure:3863: result: gcc3
configure:3883: checking how to run the C preprocessor
configure:3953: result: /usr/local/Library/ENV/4.3/cpp
configure:3973: /usr/local/Library/ENV/4.3/cpp conftest.c
The build-tool has reset ENV. --env=std required.
configure:3973: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "yaml"
| #define PACKAGE_TARNAME "yaml"
| #define PACKAGE_VERSION "0.1.4"
| #define PACKAGE_STRING "yaml 0.1.4"
| #define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component=libyaml"
| #define PACKAGE_URL ""
| #define PACKAGE "yaml"
| #define VERSION "0.1.4"
| #define YAML_VERSION_MAJOR 0
| #define YAML_VERSION_MINOR 1
| #define YAML_VERSION_PATCH 4
| #define YAML_VERSION_STRING "0.1.4"
| /* end confdefs.h. */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| Syntax error
configure:3973: /usr/local/Library/ENV/4.3/cpp conftest.c
The build-tool has reset ENV. --env=std required.
configure:3973: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "yaml"
| #define PACKAGE_TARNAME "yaml"
| #define PACKAGE_VERSION "0.1.4"
| #define PACKAGE_STRING "yaml 0.1.4"
| #define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component=libyaml"
| #define PACKAGE_URL ""
| #define PACKAGE "yaml"
| #define VERSION "0.1.4"
| #define YAML_VERSION_MAJOR 0
| #define YAML_VERSION_MINOR 1
| #define YAML_VERSION_PATCH 4
| #define YAML_VERSION_STRING "0.1.4"
| /* end confdefs.h. */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| Syntax error
configure:4003: error: in `~/.rvm/src/yaml-0.1.4':
configure:4005: error: C preprocessor "/usr/local/Library/ENV/4.3/cpp" fails sanity check
See `config.log' for more details
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=set
ac_cv_env_CC_value=/usr/local/bin/gcc-4.2
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=set
ac_cv_env_CPP_value=/usr/local/Library/ENV/4.3/cpp
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value=-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_objext=o
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_AWK=awk
ac_cv_prog_CPP=/usr/local/Library/ENV/4.3/cpp
ac_cv_prog_ac_ct_CC=/usr/local/bin/gcc-4.2
ac_cv_prog_cc_c89=
ac_cv_prog_cc_g=yes
ac_cv_prog_make_make_set=yes
am_cv_CC_dependencies_compiler_type=gcc3
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='${SHELL} ~/.rvm/src/yaml-0.1.4/config/missing --run aclocal-1.11'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='${SHELL} ~/.rvm/src/yaml-0.1.4/config/missing --run tar'
AR=''
AUTOCONF='${SHELL} ~/.rvm/src/yaml-0.1.4/config/missing --run autoconf'
AUTOHEADER='${SHELL} ~/.rvm/src/yaml-0.1.4/config/missing --run autoheader'
AUTOMAKE='${SHELL} ~/.rvm/src/yaml-0.1.4/config/missing --run automake-1.11'
AWK='awk'
CC='/usr/local/bin/gcc-4.2'
CCDEPMODE='depmode=gcc3'
CFLAGS='-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include'
CPP='/usr/local/Library/ENV/4.3/cpp'
CPPFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
DOXYGEN=''
DOXYGEN_FALSE=''
DOXYGEN_TRUE=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GREP=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS='-L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib'
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
MAKEINFO='${SHELL} ~/.rvm/src/yaml-0.1.4/config/missing --run makeinfo'
MKDIR_P='config/install-sh -c -d'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT='o'
OTOOL64=''
OTOOL=''
PACKAGE='yaml'
PACKAGE_BUGREPORT='http://pyyaml.org/newticket?component=libyaml'
PACKAGE_NAME='yaml'
PACKAGE_STRING='yaml 0.1.4'
PACKAGE_TARNAME='yaml'
PACKAGE_URL=''
PACKAGE_VERSION='0.1.4'
PATH_SEPARATOR=':'
RANLIB=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
VERSION='0.1.4'
YAML_LT_AGE='0'
YAML_LT_CURRENT='2'
YAML_LT_RELEASE='0'
YAML_LT_REVISION='2'
ac_ct_CC='/usr/local/bin/gcc-4.2'
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE='#'
am__fastdepCC_TRUE=''
am__include='include'
am__isrc=''
am__leading_dot='.'
am__quote=''
am__tar='${AMTAR} chof - "$$tardir"'
am__untar='${AMTAR} xf -'
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} ~/.rvm/src/yaml-0.1.4/config/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
lt_ECHO='/bin/echo'
mandir='${datarootdir}/man'
mkdir_p='$(top_builddir)/config/install-sh -c -d'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='~/.rvm/usr'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "yaml"
#define PACKAGE_TARNAME "yaml"
#define PACKAGE_VERSION "0.1.4"
#define PACKAGE_STRING "yaml 0.1.4"
#define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component=libyaml"
#define PACKAGE_URL ""
#define PACKAGE "yaml"
#define VERSION "0.1.4"
#define YAML_VERSION_MAJOR 0
#define YAML_VERSION_MINOR 1
#define YAML_VERSION_PATCH 4
#define YAML_VERSION_STRING "0.1.4"
configure: exit 1
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0
#TODO make it work with homebrew/dupes/gcc
#TODO? If we find -mmacosx-version-min=10.8, change sdkroot? warn visibly if no such SDK?
#TODO fix pkg-config files, should point to /usr/local or /usr/local/opt
#TODO create mechanism to specify build effects like %w{-O0 -O4 vanilla-arg-parsing sdk=10.6} etc.
require "#{File.dirname __FILE__}/../libsuperenv"
require 'set'
def cccfg? flags
flags.split('').all?{|c| ENV['HOMEBREW_CCCFG'].include? c } if ENV['HOMEBREW_CCCFG']
end
def nclt?
$sdkroot != nil
end
def syspath
if nclt?
%W{#$sdkroot/usr #$sdkroot/usr/local}
else
%W{/usr /usr/local}
end
end
def exec *args
path = File.expand_path('~/Library/Logs/Homebrew/cc.log')
open(path, 'a') do |f|
f.print '[', $0
f.print " -%s" % ENV['HOMEBREW_CCCFG'] if ENV['HOMEBREW_CCCFG']
f.print '] '
f.puts args.join(' ')
f.puts
end
Kernel.exec *args
end if ENV['HOMEBREW_LOG']
class Cmd
def initialize path, args
@arg0 = path.basename.freeze
@args = args.freeze
end
def mode
if @arg0 == 'cpp' or @arg0 == 'ld'
@arg0.to_sym
elsif @args.include? '-c'
:cc
elsif @args.include? '-E'
:cpp
else
:ccld
end
end
def tool
@tool ||= case @arg0
when 'ld' then 'ld'
when 'cc', 'c99', 'c89'
# Ideally we would run `cx9`, however these tools are POSIX compliant
# and don't support many flags. We need -isystem for instance, but also
# reliability is generally much higher if we just get clang/gcc to do
# the work since Makefiles are dumb and include a lot of excess flags.
ENV['HOMEBREW_CC']
when 'c++'
if ENV['HOMEBREW_CC'] =~ /gcc/
'g++'
else
'clang++'
end
else
@arg0
end
end
def args
args = if not cccfg? 'O' or tool == 'ld'
@args.dup
else
refurbished_args
end
if tool != 'ld'
args << "--sysroot=#$sdkroot"
else
args << "-syslibroot" << $sdkroot
end if nclt?
case mode
when :cpp
%w{-E} + args + cppflags
when :ld
ldflags + args
when :cc
cflags + args + cppflags
when :ccld
cflags + args + cppflags + ldflags
end.compact
end
def refurbished_args
lset = Set.new(libpath + syslibpath)
iset = Set.new(cpath.flatten)
args = []
whittler = @args.each
loop do
case arg = whittler.next
when '-arch', /^-Xarch_/
whittler.next
when /^-g\d?/, /^-gstabs\d+/, '-gstabs+', /^-ggdb\d?/, '-gdwarf-2',
/^-march=.+/, /^-mtune=.+/, '-m64', '-m32',
/^-O[0-9zs]?/, '-fast',
'-pedantic', '-pedantic-errors'
when '-fopenmp', '-lgomp'
# clang doesn't support OpenMP
args << arg if not tool =~ /^clang/
when /^-W.*/
args << arg if arg =~ /^-Wl,/
when '-macosx_version_min', '-dylib_install_name'
args << "-Wl,#{arg},#{whittler.next}"
when '-dylib'
args << "-Wl,#{arg}"
when /^-I(.+)/
# it is okay to add a space after the -I; so let's support it
path = $1.chuzzle || whittler.next
args << "-I#{path}" if iset.add?(path.cleanpath)
when /^-L(.+)/
path = $1.chuzzle || whittler.next
case path.cleanpath
when %r{^/opt}, %r{^/sw}, %r{/usr/X11}
# NOOP
else
args << "-L#{path}" if lset.add?(path.cleanpath)
end
else
args << arg
end
end
make_fuss(args)
args
end
def cflags
if cccfg? 'Ob'
%w{-mtune=generic -Oz}
elsif cccfg? 'O'
args = %w{-pipe -w -Os}
args << '-march=native' if tool =~ /clang/
args += %w{-arch i386 -arch x86_64} if cccfg? 'u'
args << "--std=#{@arg0}" if @arg0 =~ /c[89]9/
args
else
[]
end
end
def syslibpath
# We reject brew's lib as we explicitly add this as a -L flag, thus it
# is given higher priority by cc, so it surpasses the system libpath.
# NOTE this only counts if Homebrew is installed at /usr/local
syspath.map{|d| "#{d}/lib" }.reject{ "#$brewfix/lib" }
end
def syscpath
isystem, _ = cpath
isystem + syspath.map{|d| "#{d}/include" }
end
def cpath
cpath = ENV['CMAKE_PREFIX_PATH'].split(':').map{|d| "#{d}/include" } + ENV['CMAKE_INCLUDE_PATH'].split(':')
opt = cpath.select{|prefix| prefix =~ %r{^#$brewfix/opt} }
sys = cpath - opt
[sys, opt]
end
def libpath
ENV['CMAKE_PREFIX_PATH'].split(':').map{|d| "#{d}/lib" } +
ENV['CMAKE_LIBRARY_PATH'].split(':') -
syslibpath
end
def ldflags
libpath.to_flags('-L')
end
def cppflags
sys, opt = cpath
# we want our keg-only includes to be found before system includes *and*
# before any other includes the build-system adds
sys.to_flags('-isystem') + opt.to_flags('-I')
end
def make_fuss args
dels = @args - args
adds = args - @args
dups = dels & args
STDERR.puts "brew: superenv removed: #{dels*' '}" unless dels.empty?
STDERR.puts "brew: superenv deduped: #{dels}" unless dups.empty?
STDERR.puts "brew: superenv added: #{adds*' '}" unless adds.empty?
end
end
####################################################################### sanity
abort "The build-tool has reset ENV. --env=std required." unless ENV['HOMEBREW_BREW_FILE']
case ENV['HOMEBREW_CC'].chuzzle when 'cc', nil
# those values are not allowed
ENV['HOMEBREW_CC'] = 'clang'
end
######################################################################### main
cmd = Cmd.new($0, ARGV)
exec "xcrun", cmd.tool, *cmd.args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment