mirror of
https://github.com/Relintai/osxcross.git
synced 2025-02-12 07:00:07 +01:00
parent
c270662f73
commit
233b1d8860
@ -16,11 +16,12 @@ Click on setup-*.exe and install the following packages:
|
|||||||
|
|
||||||
For LTO support you will also need:
|
For LTO support you will also need:
|
||||||
|
|
||||||
`libllvm-devel`, `libllvm` and `gendef`
|
`libllvm-devel`, `libllvm`, `libedit` and `libffi`
|
||||||
|
|
||||||
The cygLTO.dll import library is missing, create it by hand:
|
The Cygwin package of libLLVM lacks the LTO library, but you can create that dll
|
||||||
|
by issuing the following command:
|
||||||
|
|
||||||
`gendef /bin/cygLTO.dll && dlltool -d cygLTO.def -l /lib/libLTO.dll.a && rm cygLTO.def`
|
`./tools/gen_cyglto_dll.sh`
|
||||||
|
|
||||||
#### Step 2: ####
|
#### Step 2: ####
|
||||||
|
|
||||||
|
3
build.sh
3
build.sh
@ -150,6 +150,9 @@ popd &>/dev/null
|
|||||||
patch -p0 < $PATCH_DIR/cctools-ld64-1.patch
|
patch -p0 < $PATCH_DIR/cctools-ld64-1.patch
|
||||||
patch -p0 < $PATCH_DIR/cctools-ld64-2.patch
|
patch -p0 < $PATCH_DIR/cctools-ld64-2.patch
|
||||||
patch -p1 < $PATCH_DIR/cctools-ld64-misc-fixes.patch
|
patch -p1 < $PATCH_DIR/cctools-ld64-misc-fixes.patch
|
||||||
|
pushd .. &>/dev/null
|
||||||
|
patch -p0 < $PATCH_DIR/cctools-ld64-cygwin-buildfix.patch
|
||||||
|
popd &>/dev/null
|
||||||
echo ""
|
echo ""
|
||||||
CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET "
|
CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET "
|
||||||
CONFFLAGS+="--disable-clang-as "
|
CONFFLAGS+="--disable-clang-as "
|
||||||
|
60
patches/cctools-ld64-cygwin-buildfix.patch
Normal file
60
patches/cctools-ld64-cygwin-buildfix.patch
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
diff --git cctools/configure.ac cctools/configure.ac
|
||||||
|
index 56e8f24..5219e3d 100644
|
||||||
|
--- cctools/configure.ac
|
||||||
|
+++ cctools/configure.ac
|
||||||
|
@@ -49,7 +49,8 @@ case $host_os in
|
||||||
|
;;
|
||||||
|
cygwin* )
|
||||||
|
iscygwin=yes
|
||||||
|
- EXTRAFLAGS="-D__LARGE64_FILES -fno-PIC"
|
||||||
|
+ # https://github.com/tpoechtrager/osxcross/issues/87
|
||||||
|
+ EXTRAFLAGS="-D__LARGE64_FILES -D_GNU_SOURCE -fno-PIC"
|
||||||
|
WARNINGS="-Wno-attributes"
|
||||||
|
XCC="gcc"
|
||||||
|
XCXX="g++"
|
||||||
|
diff --git cctools/include/foreign/machine/endian.h cctools/include/foreign/machine/endian.h
|
||||||
|
index 6cf3901..0920fd6 100644
|
||||||
|
--- cctools/include/foreign/machine/endian.h
|
||||||
|
+++ cctools/include/foreign/machine/endian.h
|
||||||
|
@@ -28,7 +28,8 @@
|
||||||
|
/*
|
||||||
|
* Copyright 1995 NeXT Computer, Inc. All rights reserved.
|
||||||
|
*/
|
||||||
|
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||||
|
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
|
||||||
|
+ defined(__DragonFly__) || defined(__CYGWIN__)
|
||||||
|
#include_next <machine/endian.h>
|
||||||
|
#else
|
||||||
|
#ifndef _BSD_MACHINE_ENDIAN_H_
|
||||||
|
@@ -45,4 +46,5 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _BSD_MACHINE_ENDIAN_H_ */
|
||||||
|
-#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
|
||||||
|
+#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ ||
|
||||||
|
+ __DragonFly__ || __CYGWIN__ */
|
||||||
|
diff --git usage_examples/ios_toolchain/wrapper.c usage_examples/ios_toolchain/wrapper.c
|
||||||
|
index c102d79..b88d35a 100644
|
||||||
|
--- usage_examples/ios_toolchain/wrapper.c
|
||||||
|
+++ usage_examples/ios_toolchain/wrapper.c
|
||||||
|
@@ -86,6 +86,7 @@ char *get_executable_path(char *epath, size_t buflen)
|
||||||
|
l = strlen(epath);
|
||||||
|
#else
|
||||||
|
ssize_t l = readlink("/proc/self/exe", epath, buflen);
|
||||||
|
+ if (l > 0) epath[l] = '\0';
|
||||||
|
#endif
|
||||||
|
if (l <= 0) return NULL;
|
||||||
|
epath[buflen - 1] = '\0';
|
||||||
|
--- cctools/configure
|
||||||
|
+++ cctools/configure
|
||||||
|
@@ -2627,7 +2627,8 @@
|
||||||
|
;;
|
||||||
|
cygwin* )
|
||||||
|
iscygwin=yes
|
||||||
|
- EXTRAFLAGS="-D__LARGE64_FILES -fno-PIC"
|
||||||
|
+ # https://github.com/tpoechtrager/osxcross/issues/87
|
||||||
|
+ EXTRAFLAGS="-D__LARGE64_FILES -D_GNU_SOURCE -fno-PIC"
|
||||||
|
WARNINGS="-Wno-attributes"
|
||||||
|
XCC="gcc"
|
||||||
|
XCXX="g++"
|
||||||
|
|
51
tools/gen_cyglto_dll.sh
Executable file
51
tools/gen_cyglto_dll.sh
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
pushd "${0%/*}/.." &>/dev/null
|
||||||
|
source tools/tools.sh
|
||||||
|
|
||||||
|
if [[ $PLATFORM != CYGWIN* ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
LLVM_CONFIG="llvm-config"
|
||||||
|
|
||||||
|
CXXFLAGS="$($LLVM_CONFIG --cxxflags) -fno-PIC"
|
||||||
|
LDFLAGS="$($LLVM_CONFIG --cxxflags) -Wl,-s"
|
||||||
|
INCDIR=$($LLVM_CONFIG --includedir)
|
||||||
|
LIBDIR=$($LLVM_CONFIG --libdir)
|
||||||
|
LIBS=$($LLVM_CONFIG --libs all)
|
||||||
|
SYSLIBS="$($LLVM_CONFIG --system-libs) -ledit -lffi"
|
||||||
|
|
||||||
|
VERSION=$($LLVM_CONFIG --version | awk -F \. {'print $1$2'} | sed 's/svn//g')
|
||||||
|
|
||||||
|
set -e
|
||||||
|
TMP=$(mktemp -d)
|
||||||
|
set +e
|
||||||
|
|
||||||
|
pushd $TMP &>/dev/null
|
||||||
|
wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/lto.cpp
|
||||||
|
wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/LTODisassembler.cpp
|
||||||
|
wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/lto.exports
|
||||||
|
|
||||||
|
echo "{" > cyglto.exports
|
||||||
|
echo " global:" >> cyglto.exports
|
||||||
|
while read p; do
|
||||||
|
echo " $p;" >> cyglto.exports
|
||||||
|
done < lto.exports
|
||||||
|
echo " LLVM*;" >> cyglto.exports
|
||||||
|
echo " local: *;" >> cyglto.exports
|
||||||
|
echo "};" >> cyglto.exports
|
||||||
|
|
||||||
|
popd &>/dev/null
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
g++ -shared \
|
||||||
|
-L$LIBDIR -I$INCDIR $CXXFLAGS $LDFLAGS \
|
||||||
|
-Wl,--whole-archive $LIBS -Wl,--no-whole-archive $SYSLIBS \
|
||||||
|
$TMP/lto.cpp $TMP/LTODisassembler.cpp -Wl,-version-script,$TMP/cyglto.exports \
|
||||||
|
-o /bin/cygLTO.dll -Wl,--out-implib,/lib/libLTO.dll.a
|
||||||
|
|
||||||
|
rm -rf $TMP
|
||||||
|
|
||||||
|
popd &>/dev/null
|
@ -135,8 +135,9 @@ char *getExecutablePath(char *buf, size_t len) {
|
|||||||
l = 0;
|
l = 0;
|
||||||
delete[] argv;
|
delete[] argv;
|
||||||
#else
|
#else
|
||||||
ssize_t l = readlink("/proc/self/exe", buf, len);
|
ssize_t l = readlink("/proc/self/exe", buf, len - 1);
|
||||||
assert(l > 0 && "/proc not mounted?");
|
assert(l > 0 && "/proc not mounted?");
|
||||||
|
if (l > 0) buf[l] = '\0';
|
||||||
#endif
|
#endif
|
||||||
if (l <= 0)
|
if (l <= 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CodeLite_Workspace Name="wrapper" Database="wrapper.tags" SWTLW="No">
|
<CodeLite_Workspace Name="wrapper" Database="wrapper.tags">
|
||||||
<Project Name="wrapper" Path="./wrapper.project" Active="Yes"/>
|
<Project Name="wrapper" Path="./wrapper.project" Active="Yes"/>
|
||||||
<BuildMatrix>
|
<BuildMatrix>
|
||||||
<WorkspaceConfiguration Name="Debug" Selected="yes">
|
<WorkspaceConfiguration Name="Debug" Selected="yes">
|
||||||
|
Loading…
Reference in New Issue
Block a user