Update osxcross to 325-16efae8 using MacOSX-SDK 10.13

This commit is contained in:
Martchus 2019-08-03 15:47:26 +02:00
parent a06842807b
commit 7df52780c2
4 changed files with 37 additions and 155 deletions

View File

@ -2,17 +2,14 @@
# Contributor: emersion <contact@emersion.fr>
# This package contains a cross toolchain to compile for MacOSX. It bundles:
# * MacOSX 10.11 SDK
# * MacOSX 10.13 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 does not provide CMake wrapper scripts
# * 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
@ -21,28 +18,27 @@
# 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 particular MacOSX SDK (the only part users would still need
# * apple-darwin-sdk-macosx: contains the particular 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
# * 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
_osxcrossrevccount=325
_osxcrosscommit=16efae8
_sdkname=MacOSX10.13.sdk
_darwinversion=17
_prefix=/opt/osxcross # install everything under /opt/osxcross since the toolchain and SKD don't fit well in the regular fs structure
pkgver=$_osxcrossrevccount.$_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')
makedepends=('git' 'libxml2' 'clang>=3.2' 'cmake' 'python' 'libc++')
optdepends=('clang>=3.2: Use Clang (rather than GCC)'
'llvm: Link Time Optimization support and ld64 -bitcode_bundle support'
'uuid: ld64 -random_uuid support'
@ -50,24 +46,15 @@ optdepends=('clang>=3.2: Use Clang (rather than GCC)'
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'
"https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/$_sdkname.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')
'toolchain-apple-darwin.cmake')
sha256sums=('SKIP'
'694a66095a3514328e970b14978dc78c0f4d170e590fa7b2c3d3674b75f0b713'
'fc3c25980c6d8e32721217b43b7ae272d309a67c94a5ddd105c668d0ea7eb91e'
'fa4a430ef0ce168cfbeef4660a67ad08c3e1508ae89ab78b1ea14bb2f6709cb2'
'34ddb0fb6c08bc19ded7f608264696d7972601b635ee7ece548005286b4ba884'
'SKIP'
'6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b'
'c537bce5e9aa2b6fcdec3c1e7f94017633cb5ff5af59beda699262be3c06cca5')
noextract=('MacOSX10.11.sdk.tar.xz')
'b28b6489ae9287b4f3575bdd6d5450f33e6ea1d2f706d5579f839a494937e8ab'
'23fc0013add1d33857019ea539851af20a70efa3c387fc289625ba1dbd755573'
'8de19cc38ac2f7b8c4bec060eb36df167d814353c1139f88ed9a1cfb5bc03bc0')
options=('!strip')
_architectures='i386-apple-darwin15 x86_64-apple-darwin15 x86_64h-apple-darwin15'
_architectures="i386-apple-darwin$_darwinversion x86_64-apple-darwin$_darwinversion x86_64h-apple-darwin$_darwinversion"
#pkgver() {
# cd "$srcdir/$_pkgname"
@ -75,75 +62,52 @@ _architectures='i386-apple-darwin15 x86_64-apple-darwin15 x86_64h-apple-darwin15
#}
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 '"Package" SDK'
cd "$srcdir"
# be evil and just copy over headers from libc++ package
cp -r /usr/include/c++/v1 "$_sdkname/usr/include/c++"
bsdtar cJf "$srcdir/$_pkgname/tarballs/$_sdkname.tar.xz" "$_sdkname"
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"
export OSX_VERSION_MIN=10.13
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
sed -e "s|@TRIPLE@|${_arch}|g" -e "s|@PREFIX@|${_prefix}/SDK/${_sdkname}/usr|g" -e "s|@OSXCROSSDIR@|${_prefix}|g" toolchain-apple-darwin.cmake > toolchain-${_arch}.cmake
sed -e "s|@TRIPLE@|${_arch}|g" -e "s|@PREFIX@|${_prefix}/SDK/${_sdkname}/usr|g" -e "s|@OSXCROSSDIR@|${_prefix}|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
mkdir -p "$pkgdir/${_prefix%/*}"
cp -r target "$pkgdir/${_prefix}"
install -d "${pkgdir}/${_prefix}/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
install -t "${pkgdir}/${_prefix}/share/apple-darwin" -m 644 toolchain-${_arch}.cmake
install -t "${pkgdir}/${_prefix}/bin" -m 755 ${_arch}-cmake
# add symlinks for ccache
local ccachedir="${pkgdir}/opt/osxcross/lib/ccache/bin"
local ccachedir="${pkgdir}/${_prefix}/lib/ccache/bin"
mkdir -p "${ccachedir}"
pushd "${ccachedir}"
for app in clang clang++ gcc g++; do
for app in clang clang++; do
ln -s /usr/bin/ccache ./${_arch}-${app}
done
popd

View File

@ -1,82 +0,0 @@
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)
{

View File

@ -1,5 +1,5 @@
#!/bin/sh
prefix=/opt/osxcross/SDK/MacOSX10.11.sdk/usr
prefix=@PREFIX@
additional_args=" \
-DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
@ -10,10 +10,10 @@ additional_args=" \
-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"
-DCMAKE_TOOLCHAIN_FILE=@OSXCROSSDIR@/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 "$@"
PATH="@OSXCROSSDIR@/bin:${prefix}/bin:$PATH" cmake $additional_args "$@"

View File

@ -5,7 +5,7 @@ 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)
set (CMAKE_FIND_ROOT_PATH @OSXCROSSDIR@/@TRIPLE@;@PREFIX@)
# search for programs in the build host directories
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
@ -15,7 +15,7 @@ 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_BINARY_DIR @OSXCROSSDIR@/bin @OSXCROSSDIR@/@TRIPLE@/lib/qt/bin)
set (QT_INCLUDE_DIRS_NO_SYSTEM ON)
set (CMAKE_AR:FILEPATH @TRIPLE@-ar)