diff options
author | Martchus | 2017-08-09 22:24:25 +0200 |
---|---|---|
committer | Martchus | 2017-08-09 22:24:25 +0200 |
commit | 654e51b74c1c2e7b643df1cd968e1cf0e4b28966 (patch) | |
tree | 5989b7aa4759ddcc8b780c0d9ccba5712ce8c649 | |
download | aur-654e51b74c1c2e7b643df1cd968e1cf0e4b28966.tar.gz |
Initial import
-rw-r--r-- | .SRCINFO | 39 | ||||
-rw-r--r-- | 0001-Use-GCC-from-Git-checkout.patch | 49 | ||||
-rw-r--r-- | PKGBUILD | 152 | ||||
-rw-r--r-- | Revert-eeb6872bf.patch | 82 | ||||
-rw-r--r-- | apple-darwin-cmake.sh | 19 | ||||
-rw-r--r-- | toolchain-apple-darwin.cmake | 22 |
6 files changed, 363 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..2431cd87167e --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,39 @@ +# Generated by mksrcinfo v8 +# Wed Aug 9 20:24:25 UTC 2017 +pkgbase = apple-darwin-osxcross + pkgdesc = OS X cross toolchain for Linux, FreeBSD and NetBSD + pkgver = 272.a0c5314 + pkgrel = 1 + url = https://github.com/tpoechtrager/osxcross + arch = x86_64 + license = MIT + makedepends = git + makedepends = libxml2 + makedepends = clang>=3.2 + optdepends = clang>=3.2: Use Clang (rather than GCC) + optdepends = llvm: Link Time Optimization support and ld64 -bitcode_bundle support + optdepends = uuid: ld64 -random_uuid support + optdepends = xar: ld64 -bitcode_bundle support + provides = osxcross + conflicts = osxcross + noextract = MacOSX10.11.sdk.tar.xz + options = !strip + source = git+https://github.com/tpoechtrager/osxcross.git#commit=a0c5314 + source = https://s3.dockerproject.org/darwin/v2/MacOSX10.11.sdk.tar.xz + source = apple-darwin-cmake.sh + source = toolchain-apple-darwin.cmake + source = 0001-Use-GCC-from-Git-checkout.patch + source = git+https://gcc.gnu.org/git/gcc.git#commit=d791474f3fc2133fa0c310e566988b0cbdff321e + source = http://isl.gforge.inria.fr/isl-0.18.tar.bz2 + source = Revert-eeb6872bf.patch + sha256sums = SKIP + sha256sums = 694a66095a3514328e970b14978dc78c0f4d170e590fa7b2c3d3674b75f0b713 + sha256sums = fc3c25980c6d8e32721217b43b7ae272d309a67c94a5ddd105c668d0ea7eb91e + sha256sums = fa4a430ef0ce168cfbeef4660a67ad08c3e1508ae89ab78b1ea14bb2f6709cb2 + sha256sums = 34ddb0fb6c08bc19ded7f608264696d7972601b635ee7ece548005286b4ba884 + sha256sums = SKIP + sha256sums = 6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b + sha256sums = c537bce5e9aa2b6fcdec3c1e7f94017633cb5ff5af59beda699262be3c06cca5 + +pkgname = apple-darwin-osxcross + diff --git a/0001-Use-GCC-from-Git-checkout.patch b/0001-Use-GCC-from-Git-checkout.patch new file mode 100644 index 000000000000..1bf50ac03c60 --- /dev/null +++ b/0001-Use-GCC-from-Git-checkout.patch @@ -0,0 +1,49 @@ +From 2248baf52ef79c73a99230ab1363fca0f1059588 Mon Sep 17 00:00:00 2001 +From: Martchus <martchus@gmx.net> +Date: Fri, 28 Jul 2017 23:11:35 +0200 +Subject: [PATCH] Use GCC from Git checkout + +--- + build_gcc.sh | 18 ++---------------- + 1 file changed, 2 insertions(+), 16 deletions(-) + +diff --git a/build_gcc.sh b/build_gcc.sh +index 1eb07b8..1b7c782 100755 +--- a/build_gcc.sh ++++ b/build_gcc.sh +@@ -27,8 +27,6 @@ fi + # GCC mirror + GCC_MIRROR="ftp://ftp.fu-berlin.de/unix/languages/gcc" + +-require wget +- + pushd $OSXCROSS_BUILD_DIR &>/dev/null + + function remove_locks() +@@ -40,21 +38,9 @@ source $BASE_DIR/tools/trap_exit.sh + + if [ ! -f "have_gcc_${GCC_VERSION}_${OSXCROSS_TARGET}" ]; then + +-pushd $OSXCROSS_TARBALL_DIR &>/dev/null +-if [[ $GCC_VERSION != *-* ]]; then +- wget -c "$GCC_MIRROR/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2" +-else +- wget -c "$GCC_MIRROR/snapshots/$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2" +-fi +-popd &>/dev/null +- +-echo "cleaning up ..." +-rm -rf gcc* 2>/dev/null +- +-extract "$OSXCROSS_TARBALL_DIR/gcc-$GCC_VERSION.tar.bz2" 1 +-echo "" ++ln -s "$GCC_CHECKOUT" gcc-$GCC_VERSION + +-pushd gcc*$GCC_VERSION* &>/dev/null ++pushd gcc-$GCC_VERSION &>/dev/null + + rm -f $OSXCROSS_TARGET_DIR/bin/*-gcc* + rm -f $OSXCROSS_TARGET_DIR/bin/*-g++* +-- +2.13.3 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..3af12fd97f38 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,152 @@ +# Maintainer: Martchus <martchus@gmx.net> +# Contributor: emersion <contact@emersion.fr> + +# This package contains a cross toolchain to compile for MacOSX. It bundles: +# * MacOSX 10.11 SDK +# * wrapper for Clang provided by osxcross +# * wrapper and toolchain file for using Clang with CMake +# * GCC toolchain (including libstdc++) which is built using the script provided by osxcross +# Note that GCC is only available for i386, x86_64 but not for x86_64h +# * symlinks for ccache, so it will be used when cross compiling if it is enabled in /etc/makepkg.conf + +# Difference between this package and osxcross-git maintained by emersion in the AUR: +# * osxcross-git does not stick to a particular commit +# * osxcross-git does not provide GCC toolchain (only Clang wrapper) +# * osxcross-git does not provide CMake toolchain file +# * osxcross-git violates "package etiquette" by putting stuff under /usr/local/osxcross (this package +# uses /opt/osxcross) +# * osxcross-git will likely not work for building other apple-darwin-* packages provided +# by me, such as apple-darwin-qt5-base (so if you want to build these, use my this package) +# * osxcross-git does not provide symlinks for ccache + +# Note that this package includes a MacOSX SDK and hence is not redistributable. Hence it might be worth +# splitting it into: +# * apple-darwin-sdk-macosx10.11: contains the MacOSX SDK, the only part users would still need to build +# from sources +# * apple-darwin-osxcross: contains the actual sources of osxcross reporitory +# * apple-darwin-toolchain: contains the Clang toolchain built with scripts in apple-darwin-osxcross +# * apple-darwin-gcc: contains the gcc toolchain built with scripts in apple-darwin-osxcross + +pkgname=apple-darwin-osxcross +_pkgname=osxcross +# There's no official release of osxcross yet, so let's just stick to a Git revision +_osxcrosscommit=a0c5314 +# Use the same GCC and isl version as used by regular gcc package +_gccver=7.1.1 +_gcccommit=d791474f3fc2133fa0c310e566988b0cbdff321e +_islver=0.18 +pkgver=272.$_osxcrosscommit +pkgrel=1 +pkgdesc='OS X cross toolchain for Linux, FreeBSD and NetBSD' +arch=('x86_64') +url='https://github.com/tpoechtrager/osxcross' +license=('MIT') +depends=() +makedepends=('git' 'libxml2' 'clang>=3.2') +optdepends=('clang>=3.2: Use Clang (rather than GCC)' + 'llvm: Link Time Optimization support and ld64 -bitcode_bundle support' + 'uuid: ld64 -random_uuid support' + 'xar: ld64 -bitcode_bundle support') +provides=("$_pkgname") +conflicts=("$_pkgname") +source=("git+https://github.com/tpoechtrager/${_pkgname}.git#commit=${_osxcrosscommit}" + 'https://s3.dockerproject.org/darwin/v2/MacOSX10.11.sdk.tar.xz' + 'apple-darwin-cmake.sh' + 'toolchain-apple-darwin.cmake' + '0001-Use-GCC-from-Git-checkout.patch' + "git+https://gcc.gnu.org/git/gcc.git#commit=${_gcccommit}" + "http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2" + 'Revert-eeb6872bf.patch') +sha256sums=('SKIP' + '694a66095a3514328e970b14978dc78c0f4d170e590fa7b2c3d3674b75f0b713' + 'fc3c25980c6d8e32721217b43b7ae272d309a67c94a5ddd105c668d0ea7eb91e' + 'fa4a430ef0ce168cfbeef4660a67ad08c3e1508ae89ab78b1ea14bb2f6709cb2' + '34ddb0fb6c08bc19ded7f608264696d7972601b635ee7ece548005286b4ba884' + 'SKIP' + '6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b' + 'c537bce5e9aa2b6fcdec3c1e7f94017633cb5ff5af59beda699262be3c06cca5') +noextract=('MacOSX10.11.sdk.tar.xz') +options=('!strip') +_architectures='i386-apple-darwin15 x86_64-apple-darwin15 x86_64h-apple-darwin15' + +#pkgver() { +# cd "$srcdir/$_pkgname" +# echo "$(git rev-list --count HEAD).$(git rev-parse --short HEAD)" +#} + +prepare() { + cd "${srcdir}/gcc" + + msg2 'Prepare GCC (using same steps as in regular GCC package)' + # link isl for in-tree build + ln -s ../isl-${_islver} isl + + # Do not run fixincludes + sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in + + # Arch Linux installs x86_64 libraries /lib + [[ $CARCH == "x86_64" ]] && sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64 + + # hack! - some configure tests for header files using "$CPP $CPPFLAGS" + sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure + + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80717 + git apply ../Revert-eeb6872bf.patch + + msg2 'Prepare osxcross' + cd "$srcdir/$_pkgname" + git apply ../0001-Use-GCC-from-Git-checkout.patch + sed -i -e 's|-march=native||g' build_clang.sh wrapper/build.sh + # create symlink to SDK file so osxcross can find it + pushd tarballs && ln -sf ../../MacOSX10.11.sdk.tar.xz MacOSX10.11.sdk.tar.xz && popd +} + +build() { + cd "$srcdir/$_pkgname" + export UNATTENDED=yes + export OSX_VERSION_MIN=10.5 + export ENABLE_FORTRAN=1 + export GCC_VERSION="$_gccver" + export GCC_CHECKOUT="${srcdir}/gcc" + + msg2 'Build osxcross' + ./build.sh + + msg2 'Build GCC (using build script provided by osxcross)' + ./build_gcc.sh + + msg2 'Build toolchain file and wrapper for CMake' + cd "$srcdir" + for _arch in ${_architectures}; do + sed "s|@TRIPLE@|${_arch}|g" toolchain-apple-darwin.cmake > toolchain-${_arch}.cmake + sed "s|@TRIPLE@|${_arch}|g" apple-darwin-cmake.sh > ${_arch}-cmake + done + # TODO: Also create a wrapper and a toolchain file for GCC +} + +package() { + cd "$srcdir/$_pkgname" + + # install everything under /opt/osxcross since the toolchain and SKD don't fit well in the regular fs structure + mkdir -p $pkgdir/opt + cp -r target $pkgdir/opt/osxcross + install -d "${pkgdir}"/opt/osxcross/share/apple-darwin + + # install files for CMake and ccache + cd "$srcdir" + for _arch in ${_architectures}; do + # install toolchain file and wrapper for CMake + install -t "${pkgdir}"/opt/osxcross/share/apple-darwin -m 644 toolchain-${_arch}.cmake + install -t "${pkgdir}"/opt/osxcross/bin -m 755 ${_arch}-cmake + + # add symlinks for ccache + local ccachedir="${pkgdir}/opt/osxcross/lib/ccache/bin" + mkdir -p "${ccachedir}" + pushd "${ccachedir}" + for app in clang clang++ gcc g++; do + ln -s /usr/bin/ccache ./${_arch}-${app} + done + popd + done + +} diff --git a/Revert-eeb6872bf.patch b/Revert-eeb6872bf.patch new file mode 100644 index 000000000000..1688c149a805 --- /dev/null +++ b/Revert-eeb6872bf.patch @@ -0,0 +1,82 @@ +commit 43d83a70267a9e5c456d28de8e7348820446b712 +Author: Bartłomiej Piotrowski <bpiotrowski@archlinux.org> +Date: Tue May 16 07:50:42 2017 +0200 + + Revert "Prevent LTO wrappers to process a recursive execution" + + This reverts commit eeb6872bfdfd1e71b27de6f62a5f5c08a2efb015. + +diff --git a/gcc/file-find.c b/gcc/file-find.c +index b072a4993d76..b5a1fe8494e8 100644 +--- a/gcc/file-find.c ++++ b/gcc/file-find.c +@@ -208,38 +208,3 @@ prefix_from_string (const char *p, struct path_prefix *pprefix) + } + free (nstore); + } +- +-void +-remove_prefix (const char *prefix, struct path_prefix *pprefix) +-{ +- struct prefix_list *remove, **prev, **remove_prev = NULL; +- int max_len = 0; +- +- if (pprefix->plist) +- { +- prev = &pprefix->plist; +- for (struct prefix_list *pl = pprefix->plist; pl->next; pl = pl->next) +- { +- if (strcmp (prefix, pl->prefix) == 0) +- { +- remove = pl; +- remove_prev = prev; +- continue; +- } +- +- int l = strlen (pl->prefix); +- if (l > max_len) +- max_len = l; +- +- prev = &pl; +- } +- +- if (remove_prev) +- { +- *remove_prev = remove->next; +- free (remove); +- } +- +- pprefix->max_len = max_len; +- } +-} +diff --git a/gcc/file-find.h b/gcc/file-find.h +index 8f49a3af273e..407feba26e74 100644 +--- a/gcc/file-find.h ++++ b/gcc/file-find.h +@@ -41,7 +41,6 @@ extern void find_file_set_debug (bool); + extern char *find_a_file (struct path_prefix *, const char *, int); + extern void add_prefix (struct path_prefix *, const char *); + extern void add_prefix_begin (struct path_prefix *, const char *); +-extern void remove_prefix (const char *prefix, struct path_prefix *); + extern void prefix_from_env (const char *, struct path_prefix *); + extern void prefix_from_string (const char *, struct path_prefix *); + +diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c +index 78d2fc1ad306..d5d80e042e5a 100644 +--- a/gcc/gcc-ar.c ++++ b/gcc/gcc-ar.c +@@ -194,14 +194,6 @@ main (int ac, char **av) + #ifdef CROSS_DIRECTORY_STRUCTURE + real_exe_name = concat (target_machine, "-", PERSONALITY, NULL); + #endif +- /* Do not search original location in the same folder. */ +- char *exe_folder = lrealpath (av[0]); +- exe_folder[strlen (exe_folder) - strlen (lbasename (exe_folder))] = '\0'; +- char *location = concat (exe_folder, PERSONALITY, NULL); +- +- if (access (location, X_OK) == 0) +- remove_prefix (exe_folder, &path); +- + exe_name = find_a_file (&path, real_exe_name, X_OK); + if (!exe_name) + { diff --git a/apple-darwin-cmake.sh b/apple-darwin-cmake.sh new file mode 100644 index 000000000000..c8bac2469c4d --- /dev/null +++ b/apple-darwin-cmake.sh @@ -0,0 +1,19 @@ +#!/bin/sh +prefix=/opt/osxcross/SDK/MacOSX10.11.sdk/usr + +additional_args=" \ + -DCMAKE_INSTALL_PREFIX:PATH=${prefix} \ + -DCMAKE_INSTALL_LIBDIR:PATH=${prefix}/lib \ + -DINCLUDE_INSTALL_DIR:PATH=${prefix}/include \ + -DCMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES:PATH=${prefix}/include \ + -DCMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES:PATH=${prefix}/include \ + -DLIB_INSTALL_DIR:PATH=${prefix}/lib \ + -DSYSCONF_INSTALL_DIR:PATH=${prefix}/etc \ + -DSHARE_INSTALL_DIR:PATH=${prefix}/share \ + -DCMAKE_TOOLCHAIN_FILE=/opt/osxcross/share/apple-darwin/toolchain-@TRIPLE@.cmake" + +[[ ! $PREVENT_FORCING_SHARED_LIBS ]] && + additional_args+=' -DBUILD_SHARED_LIBS:BOOL=ON' || + additional_args+=' -DBUILD_SHARED_LIBS:BOOL=OFF' + +PATH="/opt/osxcross/bin:${prefix}/bin:$PATH" cmake $additional_args "$@" diff --git a/toolchain-apple-darwin.cmake b/toolchain-apple-darwin.cmake new file mode 100644 index 000000000000..ad9e70e02bb0 --- /dev/null +++ b/toolchain-apple-darwin.cmake @@ -0,0 +1,22 @@ +set (CMAKE_SYSTEM_NAME Darwin) + +# specify the cross compiler +set (CMAKE_C_COMPILER @TRIPLE@-clang) +set (CMAKE_CXX_COMPILER @TRIPLE@-clang++) + +# where is the target environment +set (CMAKE_FIND_ROOT_PATH /opt/osxcross/@TRIPLE@;/opt/osxcross/SDK/MacOSX10.11.sdk/usr) + +# search for programs in the build host directories +set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +# Make sure Qt can be detected by CMake +set (QT_BINARY_DIR /opt/osxcross/bin /opt/osxcross/@TRIPLE@/lib/qt/bin) +set (QT_INCLUDE_DIRS_NO_SYSTEM ON) + +set (CMAKE_AR:FILEPATH @TRIPLE@-ar) +set (CMAKE_RANLIB:FILEPATH @TRIPLE@-ranlib) |