Browse Source

depends: major upgrade to darwin toolchain

tl;dr: Update to the newer stable toolchain and SDK for OSX without giving up
any backwards compatibility. We can move to clang 3.5 as a next step which
allows use to use libc++ and the 10.10 sdk, but we'll need to find a build that
works in gitian/travis first.

Switch to a new, better maintained fork of cctools:
https://github.com/tpoechtrager/cctools-port

I've forked this and will be working on it some as well:
https://github.com/theuni/cctools-port

This brings in:
cctools v862
ld64: v241.9

It also fixes 64bit builds, so there's no longer any need to use a 32bit clang.
Since clang is no longer tied to an old/crusty 32bit build, clang has been
upgraded to 3.3. Unfortunately, there's a bug in 3.4 that breaks builds. 3.5
works fine, but there are no binary builds compatible with precise, which is
currently used for gitian and travis. We could always build our own if
necessary.

After updating to stable clang/linker/cctools, it's possible to use a more
recent SDK. The current SDK (10.7) through the most recent 10.10 have all been
built/tested successfully, both with and without 10.6 compatibility. However,
10.10 requires clang 3.5.

SDKs >= 10.9 use libc++ rather than libstdc++. This is verified working as well.
0.13
Cory Fields 10 years ago
parent
commit
4fe6c3c24f
  1. 5
      depends/hosts/darwin.mk
  2. 87
      depends/packages/native_cctools.mk
  3. 3
      depends/packages/native_libuuid.mk
  4. 2
      depends/packages/native_openssl.mk
  5. 2
      depends/packages/qt.mk
  6. 2
      depends/patches/qt/mac-qmake.conf

5
depends/hosts/darwin.mk

@ -1,8 +1,9 @@ @@ -1,8 +1,9 @@
OSX_MIN_VERSION=10.6
OSX_SDK_VERSION=10.7
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK)
darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK)
LD64_VERSION=241.9
darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION)
darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS)

87
depends/packages/native_cctools.mk

@ -1,80 +1,57 @@ @@ -1,80 +1,57 @@
package=native_cctools
$(package)_version=809
$(package)_download_path=http://www.opensource.apple.com/tarballs/cctools
$(package)_file_name=cctools-$($(package)_version).tar.gz
$(package)_sha256_hash=03ba62749b843b131c7304a044a98c6ffacd65b1399b921d69add0375f79d8ad
$(package)_build_subdir=cctools2odcctools/odcctools-$($(package)_version)
$(package)_version=59d21d2c793c51d205c8b4ab14b9b28e63c72445
$(package)_download_path=https://github.com/theuni/cctools-port/archive
$(package)_file_name=$($(package)_version).tar.gz
$(package)_sha256_hash=e13c7129b9d496adf4d674156b4a1d72d8b936f29f377aae8f8b5e7b650cc305
$(package)_build_subdir=cctools
$(package)_dependencies=native_libuuid native_openssl
$(package)_ld64_download_file=ld64-127.2.tar.gz
$(package)_ld64_download_path=http://www.opensource.apple.com/tarballs/ld64
$(package)_ld64_file_name=$($(package)_ld64_download_file)
$(package)_ld64_sha256_hash=97b75547b2bd761306ab3e15ae297f01e7ab9760b922bc657f4ef72e4e052142
$(package)_dyld_download_file=dyld-195.5.tar.gz
$(package)_dyld_download_path=http://www.opensource.apple.com/tarballs/dyld
$(package)_dyld_file_name=$($(package)_dyld_download_file)
$(package)_dyld_sha256_hash=2cf0484c87cf79b606b351a7055a247dae84093ae92c747a74e0cde2c8c8f83c
$(package)_toolchain4_download_file=10cc648683617cca8bcbeae507888099b41b530c.tar.gz
$(package)_toolchain4_download_path=https://github.com/mingwandroid/toolchain4/archive
$(package)_toolchain4_file_name=toolchain4-1.tar.gz
$(package)_toolchain4_sha256_hash=18406961fd4a1ec5c7ea35c91d6a80a2f8bb797a2bd243a610bd75e13eff9aca
$(package)_clang_download_file=clang+llvm-3.2-x86-linux-ubuntu-12.04.tar.gz
$(package)_clang_download_path=http://llvm.org/releases/3.2
$(package)_clang_file_name=clang-llvm-3.2-x86-linux-ubuntu-12.04.tar.gz
$(package)_clang_sha256_hash=b9d57a88f9514fa1f327a1a703756d0c1c960f4c58494a5bd80313245d13ffff
$(package)_clang_version=3.3
$(package)_clang_download_path=http://llvm.org/releases/$($(package)_clang_version)
$(package)_clang_download_file=clang+llvm-$($(package)_clang_version)-amd64-Ubuntu-12.04.2.tar.gz
$(package)_clang_file_name=clang-llvm-$($(package)_clang_version)-amd64-Ubuntu-12.04.2.tar.gz
$(package)_clang_sha256_hash=60d8f69f032d62ef61bf527857ebb933741ec3352d4d328c5516aa520662dab7
define $(package)_fetch_cmds
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \
$(call fetch_file,$(package),$($(package)_ld64_download_path),$($(package)_ld64_download_file),$($(package)_ld64_file_name),$($(package)_ld64_sha256_hash)) && \
$(call fetch_file,$(package),$($(package)_dyld_download_path),$($(package)_dyld_download_file),$($(package)_dyld_file_name),$($(package)_dyld_sha256_hash)) && \
$(call fetch_file,$(package),$($(package)_clang_download_path),$($(package)_clang_download_file),$($(package)_clang_file_name),$($(package)_clang_sha256_hash)) && \
$(call fetch_file,$(package),$($(package)_toolchain4_download_path),$($(package)_toolchain4_download_file),$($(package)_toolchain4_file_name),$($(package)_toolchain4_sha256_hash))
$(call fetch_file,$(package),$($(package)_clang_download_path),$($(package)_clang_download_file),$($(package)_clang_file_name),$($(package)_clang_sha256_hash))
endef
define $(package)_set_vars
$(package)_config_opts=--target=$(host) --with-sysroot=$(OSX_SDK)
$(package)_cflags+=-m32
$(package)_cxxflags+=-m32
$(package)_cppflags+=-D__DARWIN_UNIX03 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
$(package)_ldflags+=-m32 -Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib
$(package)_ldflags+=-L$$(native_cctools_extract_dir)/clang+llvm-3.2-x86-linux-ubuntu-12.04/lib
endef
define $(package)_extract_cmds
tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_toolchain4_file_name) && \
ln -sf $($(package)_source) cctools2odcctools/$($(package)_file_name) && \
ln -sf $($(package)_source_dir)/$($(package)_ld64_file_name) cctools2odcctools/$($(package)_ld64_file_name) && \
ln -sf $($(package)_source_dir)/$($(package)_dyld_file_name) cctools2odcctools/$($(package)_dyld_file_name) && \
tar xf $($(package)_source_dir)/$($(package)_clang_file_name) && \
mkdir -p $(SDK_PATH) sdks &&\
cd sdks; ln -sf $(OSX_SDK) MacOSX$(OSX_SDK_VERSION).sdk
mkdir -p toolchain/bin toolchain/lib/clang/3.5/include && \
tar --strip-components=1 -C toolchain -xf $($(package)_source_dir)/$($(package)_clang_file_name) && \
echo "#!/bin/sh" > toolchain/bin/$(host)-dsymutil && \
echo "exit 0" >> toolchain/bin/$(host)-dsymutil && \
chmod +x toolchain/bin/$(host)-dsymutil && \
tar --strip-components=1 -xf $($(package)_source)
endef
define $(package)_set_vars
$(package)_config_opts=--target=$(host) CC=toolchain/clang CXX=toolchain/clang++
$(package)_ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib
endef
define $(package)_preprocess_cmds
sed -i "s|GCC_DIR|LLVM_CLANG_DIR|g" cctools2odcctools/extract.sh && \
sed -i "s|llvmgcc42-2336.1|clang+llvm-3.2-x86-linux-ubuntu-12.04|g" cctools2odcctools/extract.sh && \
sed -i "s|/llvmCore/include/llvm-c|/include/llvm-c \$$$${LLVM_CLANG_DIR}/include/llvm |" cctools2odcctools/extract.sh && \
sed -i "s|fAC_INIT|AC_INIT|" cctools2odcctools/files/configure.ac && \
sed -i 's/\# Dynamically linked LTO/\t ;\&\n\t linux*)\n# Dynamically linked LTO/' cctools2odcctools/files/configure.ac && \
cd cctools2odcctools; ./extract.sh --osxver $(OSX_SDK_VERSION) && \
sed -i "s|define\tPC|define\tPC_|" odcctools-809/include/architecture/sparc/reg.h
cd $($(package)_build_subdir); ./autogen.sh
endef
define $(package)_config_cmds
export "PATH=$($(package)_extract_dir)/toolchain/bin:$(PATH)" && \
$($(package)_autoconf)
endef
define $(package)_build_cmds
export "PATH=$($(package)_extract_dir)/toolchain/bin:$(PATH)" && \
$(MAKE)
endef
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install && \
cd ../../clang+llvm-3.2-x86-linux-ubuntu-12.04 && \
mkdir -p $($(package)_staging_prefix_dir)/lib/clang/3.2/include && \
mkdir -p $($(package)_staging_prefix_dir)/bin && \
cd $($(package)_extract_dir)/toolchain && \
mkdir -p $($(package)_staging_prefix_dir)/lib/clang/$($(package)_clang_version)/include && \
mkdir -p $($(package)_staging_prefix_dir)/bin $($(package)_staging_prefix_dir)/include && \
cp -P bin/clang bin/clang++ $($(package)_staging_prefix_dir)/bin/ &&\
cp lib/libLTO.so $($(package)_staging_prefix_dir)/lib/ && \
cp lib/clang/3.2/include/* $($(package)_staging_prefix_dir)/lib/clang/3.2/include/ && \
echo "#!/bin/sh" > $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil && \
echo "exit 0" >> $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil && \
chmod +x $($(package)_staging_prefix_dir)/bin/$(host)-dsymutil
cp -rf lib/clang/$($(package)_clang_version)/include/* $($(package)_staging_prefix_dir)/lib/clang/$($(package)_clang_version)/include/ && \
cp bin/$(host)-dsymutil $($(package)_staging_prefix_dir)/bin && \
if `test -d include/c++/`; then cp -rf include/c++/ $($(package)_staging_prefix_dir)/include/; fi && \
if `test -d lib/c++/`; then cp -rf lib/c++/ $($(package)_staging_prefix_dir)/lib/; fi
endef

3
depends/packages/native_libuuid.mk

@ -6,9 +6,6 @@ $(package)_sha256_hash=dbc7a138a3218d9b80a0626b5b692d76934d6746d8cbb762751be3378 @@ -6,9 +6,6 @@ $(package)_sha256_hash=dbc7a138a3218d9b80a0626b5b692d76934d6746d8cbb762751be3378
define $(package)_set_vars
$(package)_config_opts=--disable-elf-shlibs --disable-uuidd
$(package)_cflags+=-m32
$(package)_ldflags+=-m32
$(package)_cxxflags+=-m32
endef
define $(package)_config_cmds

2
depends/packages/native_openssl.mk

@ -4,7 +4,7 @@ $(package)_download_path=https://www.openssl.org/source @@ -4,7 +4,7 @@ $(package)_download_path=https://www.openssl.org/source
$(package)_file_name=openssl-$($(package)_version).tar.gz
$(package)_sha256_hash=9d1c8a9836aa63e2c6adb684186cbd4371c9e9dcc01d6e3bb447abf2d4d3d093
define $(package)_set_vars
$(package)_build_config_opts= --prefix=$(build_prefix) no-zlib no-shared no-krb5C linux-generic32 -m32
$(package)_build_config_opts= --prefix=$(build_prefix) no-zlib no-shared no-krb5C linux-generic64
endef
define $(package)_config_cmds

2
depends/packages/qt.mk

@ -34,7 +34,7 @@ $(package)_config_opts += -qt-libpng -qt-libjpeg -qt-zlib -qt-pcre @@ -34,7 +34,7 @@ $(package)_config_opts += -qt-libpng -qt-libjpeg -qt-zlib -qt-pcre
ifneq ($(build_os),darwin)
$(package)_config_opts_darwin = -xplatform macx-clang-linux -device-option MAC_SDK_PATH=$(OSX_SDK) -device-option CROSS_COMPILE="$(host)-"
$(package)_config_opts_darwin += -device-option MAC_MIN_VERSION=$(OSX_MIN_VERSION) -device-option MAC_TARGET=$(host)
$(package)_config_opts_darwin += -device-option MAC_MIN_VERSION=$(OSX_MIN_VERSION) -device-option MAC_TARGET=$(host) -device-option MAC_LD64_VERSION=$(LD64_VERSION)
endif
$(package)_config_opts_linux = -qt-xkbcommon -qt-xcb -no-eglfs -no-linuxfb -system-freetype -no-sm -fontconfig -no-xinput2 -no-libudev -no-egl -no-opengl

2
depends/patches/qt/mac-qmake.conf

@ -15,7 +15,7 @@ QMAKE_MAC_SDK.macosx.platform_name = macosx @@ -15,7 +15,7 @@ QMAKE_MAC_SDK.macosx.platform_name = macosx
QMAKE_CFLAGS += -target $${MAC_TARGET}
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
QMAKE_LFLAGS += -target $${MAC_TARGET}
QMAKE_LFLAGS += -target $${MAC_TARGET} -mlinker-version=$${MAC_LD64_VERSION}
QMAKE_AR = $${CROSS_COMPILE}ar cq
QMAKE_RANLIB=$${CROSS_COMPILE}ranlib
QMAKE_LIBTOOL=$${CROSS_COMPILE}libtool

Loading…
Cancel
Save