From c1ae58638747a12a00848a1621f6b5bb898a6490 Mon Sep 17 00:00:00 2001 From: Butta Date: Tue, 3 Sep 2019 14:38:01 +0530 Subject: [PATCH] llbuild: add package --- packages/llbuild/CMakeLists.txt.patch | 14 ++++++++ packages/llbuild/build.sh | 7 ++++ ...ld-BuildSystem-BuildSystemFrontend.h.patch | 19 ++++++++++ .../include-llvm-Config-config.h.patch | 36 +++++++++++++++++++ .../lib-Basic-PlatformUtility.cpp.patch | 13 +++++++ .../lib-llvm-Support-CmakeLists.txt.patch | 12 +++++++ .../products-llbuild-CMakeLists.txt.patch | 12 +++++++ 7 files changed, 113 insertions(+) create mode 100644 packages/llbuild/CMakeLists.txt.patch create mode 100644 packages/llbuild/build.sh create mode 100644 packages/llbuild/include-llbuild-BuildSystem-BuildSystemFrontend.h.patch create mode 100644 packages/llbuild/include-llvm-Config-config.h.patch create mode 100644 packages/llbuild/lib-Basic-PlatformUtility.cpp.patch create mode 100644 packages/llbuild/lib-llvm-Support-CmakeLists.txt.patch create mode 100644 packages/llbuild/products-llbuild-CMakeLists.txt.patch diff --git a/packages/llbuild/CMakeLists.txt.patch b/packages/llbuild/CMakeLists.txt.patch new file mode 100644 index 000000000..9b367e3eb --- /dev/null +++ b/packages/llbuild/CMakeLists.txt.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0c30c55..26336a1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -202,7 +202,8 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + endif() + + # On BSD and Linux, always build with PIC. +-if(${CMAKE_SYSTEM_NAME} MATCHES ".*BSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux") ++if(${CMAKE_SYSTEM_NAME} MATCHES ".*BSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ++ CMAKE_SYSTEM_NAME STREQUAL Android) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + endif () diff --git a/packages/llbuild/build.sh b/packages/llbuild/build.sh new file mode 100644 index 000000000..ea6a5b2f6 --- /dev/null +++ b/packages/llbuild/build.sh @@ -0,0 +1,7 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/apple/swift-llbuild +TERMUX_PKG_DESCRIPTION="A low-level build system, used by the Swift Package Manager" +TERMUX_PKG_LICENSE="Apache-2.0, NCSA" +TERMUX_PKG_VERSION=0.1.1 +TERMUX_PKG_SRCURL=https://github.com/apple/swift-llbuild/archive/${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=8f04c76dcc65bd47e197574998b30dfef1eab10a81aba704b605d12bd9c31b68 +TERMUX_PKG_DEPENDS="libc++, libandroid-spawn, libsqlite" diff --git a/packages/llbuild/include-llbuild-BuildSystem-BuildSystemFrontend.h.patch b/packages/llbuild/include-llbuild-BuildSystem-BuildSystemFrontend.h.patch new file mode 100644 index 000000000..6dac4f42e --- /dev/null +++ b/packages/llbuild/include-llbuild-BuildSystem-BuildSystemFrontend.h.patch @@ -0,0 +1,19 @@ +commit 111d9828e6422447321196b1826c0a666a0632d2 +Author: Igor Makarov +Date: Wed Aug 21 15:06:30 2019 +0300 + + change ProcessHandle int width so it complies with platform int width + +diff --git a/include/llbuild/BuildSystem/BuildSystemFrontend.h b/include/llbuild/BuildSystem/BuildSystemFrontend.h +index b14e9c8..53bf570 100644 +--- a/include/llbuild/BuildSystem/BuildSystemFrontend.h ++++ b/include/llbuild/BuildSystem/BuildSystemFrontend.h +@@ -116,7 +116,7 @@ public: + /// Handle used to communicate information about a launched process. + struct ProcessHandle { + /// Opaque ID. +- uintptr_t id; ++ uint64_t id; + }; + + private: diff --git a/packages/llbuild/include-llvm-Config-config.h.patch b/packages/llbuild/include-llvm-Config-config.h.patch new file mode 100644 index 000000000..57550e3f8 --- /dev/null +++ b/packages/llbuild/include-llvm-Config-config.h.patch @@ -0,0 +1,36 @@ +diff --git a/include/llvm/Config/config.h b/include/llvm/Config/config.h +index f1fe468..18a2bd6 100644 +--- a/include/llvm/Config/config.h ++++ b/include/llvm/Config/config.h +@@ -23,7 +23,9 @@ + #endif + + /* Define to 1 if you have the `backtrace' function. */ ++#if !defined(__ANDROID__) + #define HAVE_BACKTRACE 1 ++#endif + + /* Define to 1 if you have the header file. */ + #define HAVE_CXXABI_H 1 +@@ -53,7 +55,9 @@ + #define HAVE_ERRNO_H 1 + + /* Define to 1 if you have the header file. */ ++#if !defined(__ANDROID__) + #define HAVE_EXECINFO_H 1 ++#endif + + /* Define to 1 if you have the header file. */ + #define HAVE_FCNTL_H 1 +@@ -62,7 +66,11 @@ + #define HAVE_FUTIMES 1 + + /* Define to 1 if you have the `futimens' function */ ++#if defined(__ANDROID__) ++#define HAVE_FUTIMENS 1 ++#else + /* #undef HAVE_FUTIMENS */ ++#endif + + /* Define to 1 if you have the `getpagesize' function. */ + #define HAVE_GETPAGESIZE 1 diff --git a/packages/llbuild/lib-Basic-PlatformUtility.cpp.patch b/packages/llbuild/lib-Basic-PlatformUtility.cpp.patch new file mode 100644 index 000000000..35024a9dd --- /dev/null +++ b/packages/llbuild/lib-Basic-PlatformUtility.cpp.patch @@ -0,0 +1,13 @@ +diff --git a/lib/Basic/PlatformUtility.cpp b/lib/Basic/PlatformUtility.cpp +index afbfa01..3a495b8 100644 +--- a/lib/Basic/PlatformUtility.cpp ++++ b/lib/Basic/PlatformUtility.cpp +@@ -324,7 +324,7 @@ std::string sys::makeTmpDir() { + CreateDirectoryW((LPCWSTR)wPath.data(), NULL); + return std::string(path); + #else +- char tmpDirPathBuf[] = "/tmp/fileXXXXXX"; ++ char tmpDirPathBuf[] = "@TERMUX_PREFIX@/tmp/fileXXXXXX"; + return std::string(mkdtemp(tmpDirPathBuf)); + #endif + } diff --git a/packages/llbuild/lib-llvm-Support-CmakeLists.txt.patch b/packages/llbuild/lib-llvm-Support-CmakeLists.txt.patch new file mode 100644 index 000000000..5ae7dadc8 --- /dev/null +++ b/packages/llbuild/lib-llvm-Support-CmakeLists.txt.patch @@ -0,0 +1,12 @@ +diff --git a/lib/llvm/Support/CMakeLists.txt b/lib/llvm/Support/CMakeLists.txt +index 8e79e18..a844183 100644 +--- a/lib/llvm/Support/CMakeLists.txt ++++ b/lib/llvm/Support/CMakeLists.txt +@@ -45,3 +45,7 @@ endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_link_libraries(llvmSupport pthread dl) + endif() ++ ++if(${CMAKE_SYSTEM_NAME} MATCHES "Android") ++ target_link_libraries(llvmSupport PRIVATE android-spawn) ++endif() diff --git a/packages/llbuild/products-llbuild-CMakeLists.txt.patch b/packages/llbuild/products-llbuild-CMakeLists.txt.patch new file mode 100644 index 000000000..7f3e93602 --- /dev/null +++ b/packages/llbuild/products-llbuild-CMakeLists.txt.patch @@ -0,0 +1,12 @@ +diff --git a/products/llbuild/CMakeLists.txt b/products/llbuild/CMakeLists.txt +index 6ec9d16..3d4b9dc 100644 +--- a/products/llbuild/CMakeLists.txt ++++ b/products/llbuild/CMakeLists.txt +@@ -13,3 +13,7 @@ target_link_libraries(llbuild + if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + target_link_libraries(llbuild curses) + endif() ++ ++install(TARGETS llbuild ++ COMPONENT llbuild ++ DESTINATION bin)