Unverified Commit c50bdcde authored by boklm's avatar boklm
Browse files

macosx-toolchain: add clang wrappers to add -fPIE to the FLAGS

For bug 20439.
parent b2c8f47f
#!/bin/sh
set -e
rootdir=$(pwd)
distdir="$rootdir/dist/[% project %]"
distdir="/var/tmp/dist/[% project %]"
mkdir -p "$distdir"
tar xzf [% c('input_files_by_name/SDK') %]
mv MacOSX10.7.sdk "$distdir/SDK"
......@@ -11,7 +11,25 @@ tar -C $distdir -xf [% c('input_files_by_name/cctools') %]
cd $distdir/cctools/bin
ln -s ../../clang/bin/clang x86_64-apple-darwin10-clang
ln -s ../../clang/bin/clang++ x86_64-apple-darwin10-clang++
cd "$rootdir/dist"
cd $distdir
# Bug 20439: build with PIE
# If we add -fPIE to the FLAGS, the firefox build fails in js/src/ctypes/libffi
# with libtool giving an error:
# libtool: compile: unable to infer tagged configuration
# To avoid this error, we add -fPIE using wrappers on clang and clang++
mkdir clang/helpers
cat > clang/helpers/clang << EOF
#!/bin/sh
exec $distdir/clang/bin/clang -fPIE "\$@"
EOF
cat > clang/helpers/clang++ << EOF
#!/bin/sh
exec $distdir/clang/bin/clang++ -fPIE "\$@"
EOF
chmod +x clang/helpers/clang clang/helpers/clang++
cd "/var/tmp/dist"
[% c('tar', {
tar_src => [ project ],
tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
......
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
version: 10.7-1
remote_docker: 1
var:
setup: |
mkdir -p /var/tmp/dist
tar -C /var/tmp/dist -xf [% c("compiler_tarfile") %]
export sysrootdir=/var/tmp/dist/[% project %]/SDK/
export clangdir=/var/tmp/dist/[% project %]/clang/bin
export clangdir=/var/tmp/dist/[% project %]/clang
export cctoolsdir=/var/tmp/dist/[% project %]/cctools/bin
export PATH="$clangdir:$cctoolsdir:$PATH"
export PATH="$clangdir/helpers:$clangdir/bin:$cctoolsdir:$PATH"
export LD_LIBRARY_PATH=/var/tmp/dist/[% project %]/clang/lib
CFLAGS="-target x86_64-apple-darwin10 -mlinker-version=136 -B $$cctoolsdir -isysroot $sysrootdir"
CFLAGS="-target x86_64-apple-darwin10 -mlinker-version=136 -B $cctoolsdir -isysroot $sysrootdir"
CXXFLAGS="$CFLAGS"
CC="$clangdir/clang $CFLAGS"
CXX="$clangdir/clang++ $CXXFLAGS"
CC="$clangdir/helpers/clang $CFLAGS"
CXX="$clangdir/helpers/clang++ $CXXFLAGS"
RANLIB=$cctoolsdir/x86_64-apple-darwin10-ranlib
AR=$cctoolsdir/x86_64-apple-darwin10-ar
AS=$cctoolsdir/x86_64-apple-darwin10-as
......@@ -29,3 +30,4 @@ input_files:
- name: SDK
URL: https://people.torproject.org/~mikeperry/mirrors/sources/MacOSX10.7.sdk.tar.gz
sha256sum: da77bb0003fcca5ea8c4e8cb2da8828ded750c54afdcac29ec6f3b46ad5e3adf
- project: docker-image
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment