X-Original-To: alpine-aports@mail.alpinelinux.org Delivered-To: alpine-aports@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id C7607DC86F8 for ; Wed, 2 Mar 2016 01:48:29 +0000 (UTC) Received: from mail-io0-f193.google.com (mail-io0-f193.google.com [209.85.223.193]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mail.alpinelinux.org (Postfix) with ESMTPS id 5CEAFDC824A for ; Wed, 2 Mar 2016 01:48:29 +0000 (UTC) Received: by mail-io0-f193.google.com with SMTP id m184so187114iof.3 for ; Tue, 01 Mar 2016 17:48:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IgS1Jq7zxPlxeDhClZxFPsPr5lQhBH9q8axmiXK/YCw=; b=Gt9njMeNWD58Zp0ejUpbVvOAwm9DQbsMF7JejEXnCxtxZ5rsKiNn34sw4Du8AvJ4tL govHiCD+dfGjyrjqmPcm6FM+97KLgfG8c9bfWZpXVxXa2xYjCJH2lzCbkPfSmo74qgPN 2QT76zoTOcJ7TD9E1qa1hIsUE8cgbNws8QLIDBCidwOgu9ek31BQbk/0H+LAmMebqk5q oBVNrFybm5qnhujc4+jHzOOa7TZF3rB+ck8ah7cMmoCXdbaGvn3TRvphhM2CojbxQQ0x 4UJb8Osx6rTcFrusKdKQpnMbcosszXVncUSyp9Qkng0YF8Diu8XDcAWwtnhGmpSBbl4Y +6sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IgS1Jq7zxPlxeDhClZxFPsPr5lQhBH9q8axmiXK/YCw=; b=Kqcq/fYTiDF3sHZJXBX6en5U/vbq1rYxqgDL22Jc2PgdbqREHE341cmSqNr85DUwKd ktGJdUbkDlFTpJKn/une5fVgpdpIEdjcrjQFsArxeiL8NelzittAdjWvxCufLEMb3Vyc HHU8vlRPwBC30HGDB65GfbVeIRnJGEi5Ite2sygHr74E8X5lTPtsieYEnNJ57zNZGVK/ cUPNJOgIiVjd8z+09zts4yKfLRYVjDUN5rWjJ8m74wKP7XPBYxgkv/KvudBejflBwSfj 3t5t19HaJnEsUEoZ4Tl0ZqEsaJ/DKKkHJUQ+IQln1a14wjqmRhChiDHzTad4SHVXIv2c A9vw== X-Gm-Message-State: AG10YOQSrsu6n0B7ajaJCG/aTmYaWHAggDD5UE1c7AaoDghFcaT7SV6GEuPrLv9JPDEUOA== X-Received: by 10.107.32.144 with SMTP id g138mr26100834iog.33.1456882227297; Tue, 01 Mar 2016 17:30:27 -0800 (PST) Received: from mb.lan (c-73-24-18-171.hsd1.mn.comcast.net. [73.24.18.171]) by smtp.gmail.com with ESMTPSA id qs10sm822348igb.7.2016.03.01.17.30.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Mar 2016 17:30:26 -0800 (PST) From: Mitch Tishmack X-Google-Original-From: Mitch Tishmack To: alpine-aports@lists.alpinelinux.org Cc: Mitch Tishmack Subject: [alpine-aports] [PATCH 1/3] testing/ghc-llvm35 new aport Date: Tue, 1 Mar 2016 19:28:54 -0600 Message-Id: <1456882136-88608-2-git-send-email-mitch.tishmack@gmail.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456882136-88608-1-git-send-email-mitch.tishmack@gmail.com> References: <1456882136-88608-1-git-send-email-mitch.tishmack@gmail.com> X-Virus-Scanned: ClamAV using ClamSMTP X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: From: Mitch Tishmack --- testing/ghc-llvm35/APKBUILD | 175 +++++++++++++++++++++ .../ghc-llvm35/llvm-0001-fix-shared-build.patch | 48 ++++++ testing/ghc-llvm35/llvm-0002-musl-triple.patch | 74 +++++++++ testing/ghc-llvm35/llvm-0003-musl-hacks.patch | 82 ++++++++++ 4 files changed, 379 insertions(+) create mode 100755 testing/ghc-llvm35/APKBUILD create mode 100644 testing/ghc-llvm35/llvm-0001-fix-shared-build.patch create mode 100644 testing/ghc-llvm35/llvm-0002-musl-triple.patch create mode 100644 testing/ghc-llvm35/llvm-0003-musl-hacks.patch diff --git a/testing/ghc-llvm35/APKBUILD b/testing/ghc-llvm35/APKBUILD new file mode 100755 index 0000000..e85b324 --- /dev/null +++ b/testing/ghc-llvm35/APKBUILD @@ -0,0 +1,175 @@ +# Contributor: Mitch Tishmack +# Maintainer: Mitch Tishmack +# +# Note, this ONLY compiles llvm for opt/llc and moves the +# suffixed binaries to /usr/lib/ghc +# +# This allows the ghc/ghc-bootstrap portx to use the correct llvm. +_pkgname=llvm +llvm_major=3.5 +llvm_version=${llvm_major}.2 +suffix="-${llvm_major}" +opt=opt${suffix} +llc=llc${suffix} +pkgname=ghc-${_pkgname}-${llvm_major} +pkgver=$llvm_version +pkgrel=0 +pkgdesc="ghc required llvm binaries" +url="n/a" +arch="x86_64 armhf" +license="UIO-NCSA" +depends="" +install="" +subpackages="" +# llvm build dependencies +makedepends=" + $depends + $makedepends + perl + cmake + make + flex + bison + groff + musl-dev + binutils-dev + libffi-dev + zlib-dev + ncurses-dev + python + python-dev + gmp-dev + git + libtool + autoconf + automake +" +_builddir="$srcdir/$pkgname-$pkgver" + +# musl patches for 3.5.2 +source=" + llvm-0001-fix-shared-build.patch + llvm-0002-musl-triple.patch + llvm-0003-musl-hacks.patch +" + +# llvm/polly +source=" + $source + http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.xz + http://llvm.org/releases/$pkgver/polly-$pkgver.src.tar.xz +" +_builddir="$srcdir"/build +llvm_srcdir="$srcdir/llvm-$llvm_version.src" +llvm_builddir="$srcdir/build" +srcdir_polly="$srcdir"/polly-$llvm_version.src + +_cmake_flags="\ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_VERBOSE_MAKEFILE=NO \ + -DLLVM_DEFAULT_TARGET_TRIPLE=$CBUILD \ + -DLLVM_HOST_TRIPLE=$CHOST \ + -DLLVM_BINUTILS_INCDIR=/usr/include \ + -DLLVM_ENABLE_ASSERTIONS=NO \ + -DLLVM_ENABLE_LIBCXX=NO \ + -DLLVM_ENABLE_PIC=YES \ + -DLLVM_ENABLE_ZLIB=YES \ + -DLLVM_ENABLE_RTTI=YES \ + -DLLVM_BUILD_EXAMPLES=NO \ + -DLLVM_INCLUDE_EXAMPLES=NO \ + -DLIBXML2_INCLUDE_DIR=/usr/include/libxml2 \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLLVM_TARGETS_TO_BUILD='all' \ + -DLLVM_BUILD_EXTERNAL_COMPILER_RT=NO \ + -DBUILD_SHARED_LIBS=NO \ + -DWITH_POLLY=YES \ + -DLLVM_BUILD_DOCS=NO \ + -DLLVM_BUILD_TESTS=NO \ + -DLLVM_ENABLE_CXX1Y=NO \ + -DLLVM_ENABLE_FFI=YES \ + -DLLVM_ENABLE_SPHINX=NO \ + -DLLVM_INCLUDE_EXAMPLES=NO \ + -DLLVM_INCLUDE_TESTS=NO \ + -DLLVM_ENABLE_CURSES=NO \ + -DLLVM_ENABLE_TERMINFO=NO \ +" + +prepare() { + msg "Patching LLVM core..." + cd "$llvm_srcdir" || return 1 + for i in $source; do + case $i in + llvm-*.patch) + msg "Applying $i..." + patch -s -p1 -N -i "$srcdir"/$i || return 1 + ;; + esac + done +} + +build() { + msg "building isl" + # Note, isl is now too new for 3.5.2 in alpine linux. + # compile the right version into $srcdir so we can use polly + tmp="$srcdir/tmp" + install -d ${tmp} || return 1 + isl_srcdir="$tmp/isl" + cloog_srcdir="$tmp/cloog" + cd "$srcdir_polly/utils" + ./checkout_cloog.sh ${tmp} || return 1 + cd "$isl_srcdir" + ./configure --build=$CBUILD \ + --host=$CHOST \ + --prefix=$tmp || return 1 + make || return 1 + make -j1 INSTALL="install -D" install || return 1 + mv "$srcdir"/polly-$llvm_version.src ""$llvm_srcdir"/tools/polly" || return 1 + ( + OCFLAGS="${CFLAGS}" + OCXXFLAGS="${CXXFLAGS}" + unset CFLAGS + unset CXXFLAGS + + test -z "${OCFLAGS}" && OCFLAGS="-O3" + test -z "${OCXXFLAGS}" && OCXXFLAGS="-O3" + + cflags="${OCFLAGS} -DNDEBUG -I$srcdir/tmp/include" + cxxflags="${OCXXFLAGS} -DNDEBUG -fno-devirtualize" + + export CBUILD + + ffi_include_dir="$(pkg-config --cflags-only-I libffi | sed 's|^-I||g')" + + cflags="${OCFLAGS} -DNDEBUG" + cxxflags="${OCXXFLAGS} -DNDEBUG" + CC="gcc" + CXX="g++" + + msg "Compiling llvm" + install -d "${llvm_builddir}" + cd "${llvm_builddir}" + cmake -G "Unix Makefiles" -Wno-dev ${_cmake_flags} \ + -DCMAKE_C_COMPILER="${CC}" \ + -DCMAKE_CXX_COMPILER="${CXX}" \ + -DCMAKE_C_FLAGS_RELEASE="${cflags}" \ + -DCMAKE_CXX_FLAGS_RELEASE="${cxxflags}" \ + -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS} -L$srcdir/tmp/lib -static" \ + -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ + -DFFI_INCLUDE_DIR="$ffi_include_dir" \ + -DCMAKE_PREFIX_PATH="$srcdir/tmp" \ + "${llvm_srcdir}" || return 1 + + ( + export LD_LIBRARY_PATH="$srcdir/tmp/lib:$LD_LIBRARY_PATH" + make llvm-tblgen opt llc || return 1 + ) || return 1 + ) || return 1 +} + +package() { + cd "$_builddir" + install -d "$pkgdir/usr/lib/ghc" + for x in opt llc; do + install -Dm755 "$srcdir/build/bin/${x}" "$pkgdir/usr/lib/ghc/${x}${suffix}" || return 1 + done +} diff --git a/testing/ghc-llvm35/llvm-0001-fix-shared-build.patch b/testing/ghc-llvm35/llvm-0001-fix-shared-build.patch new file mode 100644 index 0000000..492c439 --- /dev/null +++ b/testing/ghc-llvm35/llvm-0001-fix-shared-build.patch @@ -0,0 +1,48 @@ +From 0d03d2ea17b66d8cb0f6ca5f2181237228535845 Mon Sep 17 00:00:00 2001 +From: Sanjoy Das +Date: Thu Jun 19 15:38:02 2014 -0700 +Subject: Fix the --enable-shared build. + +Currently a build configured with ./configure --enable-shared breaks +with an undefined "llvm::cl::parser::getOption(unsigned int) const" symbol when linking opt. This +body for this symbol gets emitted into Pass.o (along with the destructor +for PassNameParser), but gets linked into libLLVM-3.5svn.so with local +visibility, causing the link error. + +This fix uses the existing EXTERN_TEMPLATE machinery to force a globally +visible definition for the functions in parser into +Pass.o. +--- + include/llvm/IR/LegacyPassNameParser.h | 2 ++ + lib/IR/Pass.cpp | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/include/llvm/IR/LegacyPassNameParser.h b/include/llvm/IR/LegacyPassNameParser.h +index e2e4912..a07e3fd 100644 +--- a/include/llvm/IR/LegacyPassNameParser.h ++++ b/include/llvm/IR/LegacyPassNameParser.h +@@ -95,6 +95,8 @@ private: + } + }; + ++EXTERN_TEMPLATE_INSTANTIATION(class cl::parser); ++ + ///===----------------------------------------------------------------------===// + /// FilteredPassNameParser class - Make use of the pass registration + /// mechanism to automatically add a command line argument to opt for +diff --git a/lib/IR/Pass.cpp b/lib/IR/Pass.cpp +index 91d86ae..00ce223 100644 +--- a/lib/IR/Pass.cpp ++++ b/lib/IR/Pass.cpp +@@ -234,6 +234,8 @@ PassNameParser::~PassNameParser() { + // attempting to remove the registration listener is an error. + } + ++TEMPLATE_INSTANTIATION(class cl::parser); ++ + //===----------------------------------------------------------------------===// + // AnalysisUsage Class Implementation + // +-- +2.1.4 diff --git a/testing/ghc-llvm35/llvm-0002-musl-triple.patch b/testing/ghc-llvm35/llvm-0002-musl-triple.patch new file mode 100644 index 0000000..7ef97be --- /dev/null +++ b/testing/ghc-llvm35/llvm-0002-musl-triple.patch @@ -0,0 +1,74 @@ +diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h +index 8a68599..072623c 100644 +--- a/include/llvm/ADT/Triple.h ++++ b/include/llvm/ADT/Triple.h +@@ -154,6 +154,10 @@ public: + EABIHF, + Android, + ++ Musl, ++ MuslEABI, ++ MuslEABIHF, ++ + MSVC, + Itanium, + Cygnus, +diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp +index 0838e90..4be78e5 100644 +--- a/lib/Support/Triple.cpp ++++ b/lib/Support/Triple.cpp +@@ -175,6 +175,9 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { + case CODE16: return "code16"; + case EABI: return "eabi"; + case EABIHF: return "eabihf"; ++ case Musl: return "musl"; ++ case MuslEABIHF: return "muslgnueabihf"; ++ case MuslEABI: return "muslgnueabi"; + case Android: return "android"; + case MSVC: return "msvc"; + case Itanium: return "itanium"; +@@ -375,6 +378,9 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { + .StartsWith("code16", Triple::CODE16) + .StartsWith("gnu", Triple::GNU) + .StartsWith("android", Triple::Android) ++ .StartsWith("muslgnueabihf", Triple::MuslEABIHF) ++ .StartsWith("muslgnueabi", Triple::MuslEABI) ++ .StartsWith("musl", Triple::Musl) + .StartsWith("msvc", Triple::MSVC) + .StartsWith("itanium", Triple::Itanium) + .StartsWith("cygnus", Triple::Cygnus) +--- llvm-3.6.1.src.orig/lib/Support/Triple.cpp ++++ llvm-3.6.1.src/lib/Support/Triple.cpp +@@ -1094,6 +1094,7 @@ + switch (getEnvironment()) { + case llvm::Triple::EABIHF: + case llvm::Triple::GNUEABIHF: ++ case llvm::Triple::MuslEABIHF: + return "arm1176jzf-s"; + default: + return "arm7tdmi"; +diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h +index dbacd4d..b330be5 100644 +--- a/lib/Target/ARM/ARMSubtarget.h ++++ b/lib/Target/ARM/ARMSubtarget.h +@@ -369,8 +369,10 @@ public: + bool isTargetEHABICompatible() const { + return (TargetTriple.getEnvironment() == Triple::EABI || + TargetTriple.getEnvironment() == Triple::GNUEABI || ++ TargetTriple.getEnvironment() == Triple::MuslEABI || + TargetTriple.getEnvironment() == Triple::EABIHF || + TargetTriple.getEnvironment() == Triple::GNUEABIHF || ++ TargetTriple.getEnvironment() == Triple::MuslEABIHF || + TargetTriple.getEnvironment() == Triple::Android) && + !isTargetDarwin() && !isTargetWindows(); + } +@@ -379,6 +381,7 @@ public: + // FIXME: this is invalid for WindowsCE + return TargetTriple.getEnvironment() == Triple::GNUEABIHF || + TargetTriple.getEnvironment() == Triple::EABIHF || ++ TargetTriple.getEnvironment() == Triple::MuslEABIHF || + isTargetWindows(); + } + bool isTargetAndroid() const { +-- +2.1.4 diff --git a/testing/ghc-llvm35/llvm-0003-musl-hacks.patch b/testing/ghc-llvm35/llvm-0003-musl-hacks.patch new file mode 100644 index 0000000..7d3e0a6 --- /dev/null +++ b/testing/ghc-llvm35/llvm-0003-musl-hacks.patch @@ -0,0 +1,82 @@ +diff --git a/include/llvm/Target/TargetLibraryInfo.h b/include/llvm/Target/TargetLibraryInfo.h +index 46f87b9..41ac5fd 100644 +--- a/include/llvm/Target/TargetLibraryInfo.h ++++ b/include/llvm/Target/TargetLibraryInfo.h +@@ -13,6 +13,15 @@ + #include "llvm/ADT/DenseMap.h" + #include "llvm/Pass.h" + ++#undef fopen64 ++#undef fseeko64 ++#undef fstat64 ++#undef fstatvfs64 ++#undef ftello64 ++#undef lstat64 ++#undef stat64 ++#undef tmpfile64 ++ + namespace llvm { + class Triple; + +diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp +index d2b551e..4634a13 100644 +--- a/lib/Support/DynamicLibrary.cpp ++++ b/lib/Support/DynamicLibrary.cpp +@@ -138,7 +138,7 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { + + // This macro returns the address of a well-known, explicit symbol + #define EXPLICIT_SYMBOL(SYM) \ +- if (!strcmp(symbolName, #SYM)) return &SYM ++ if (!strcmp(symbolName, #SYM)) return (void *) &SYM + + // On linux we have a weird situation. The stderr/out/in symbols are both + // macros and global variables because of standards requirements. So, we +diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc +index e8f4643..8a320ef 100644 +--- a/lib/Support/Unix/Signals.inc ++++ b/lib/Support/Unix/Signals.inc +@@ -416,7 +416,7 @@ static bool printSymbolizedStackTrace(void **StackTrace, int Depth, FILE *FD) { + // On glibc systems we have the 'backtrace' function, which works nicely, but + // doesn't demangle symbols. + void llvm::sys::PrintStackTrace(FILE *FD) { +-#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES) ++#if defined(__GLIBC__) && defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES) + static void* StackTrace[256]; + // Use backtrace() to output a backtrace on Linux systems with glibc. + int depth = backtrace(StackTrace, +diff --git a/lib/Target/TargetLibraryInfo.cpp b/lib/Target/TargetLibraryInfo.cpp +index c0abdbd..ed908f8 100644 +--- a/lib/Target/TargetLibraryInfo.cpp ++++ b/lib/Target/TargetLibraryInfo.cpp +@@ -664,14 +664,15 @@ static void initialize(TargetLibraryInfo &TLI, const Triple &T, + } + + // The following functions are available on at least Linux: +- if (!T.isOSLinux()) { ++ if (!T.isOSLinux()) ++ TLI.setUnavailable(LibFunc::memalign); ++ if (1 /*!T.isGlibc()*/) { + TLI.setUnavailable(LibFunc::dunder_strdup); + TLI.setUnavailable(LibFunc::dunder_strtok_r); + TLI.setUnavailable(LibFunc::dunder_isoc99_scanf); + TLI.setUnavailable(LibFunc::dunder_isoc99_sscanf); + TLI.setUnavailable(LibFunc::under_IO_getc); + TLI.setUnavailable(LibFunc::under_IO_putc); +- TLI.setUnavailable(LibFunc::memalign); + TLI.setUnavailable(LibFunc::fopen64); + TLI.setUnavailable(LibFunc::fseeko64); + TLI.setUnavailable(LibFunc::fstat64); +diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc +index bf850c6..9e9088c 100644 +--- a/utils/unittest/googletest/src/gtest.cc ++++ b/utils/unittest/googletest/src/gtest.cc +@@ -120,6 +120,7 @@ + + #if GTEST_CAN_STREAM_RESULTS_ + # include // NOLINT ++# include // NOLINT + # include // NOLINT + #endif + +-- +2.1.4 -- 2.7.0 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---