summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Symon2017-05-06 23:18:22 +1200
committerJeremy Symon2017-05-06 23:25:24 +1200
commit5b902348cf3275423c84a471b5799dc1f3ef6391 (patch)
treeb2e6f12710d79ec4e03fb7018f5beecf0819a8b2
parent042eb664ad045eea6717ee75ab4ed9c3006694d9 (diff)
downloadaur-5b902348cf3275423c84a471b5799dc1f3ef6391.tar.gz
Patch cmakefile to use pkg-config to locate libffi
Currently in a patch until it gets accepted upstream
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD10
-rw-r--r--pkg-config.patch65
3 files changed, 75 insertions, 2 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 6f4f741dd4b6..f0c600a3774e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -16,7 +16,9 @@ pkgbase = dale-git
depends = ncurses
provides = dale
source = git+https://github.com/tomhrr/dale.git
+ source = pkg-config.patch
sha512sums = SKIP
+ sha512sums = 718a22bd9386d6ba6daf1ea30dd4d18df3a1adc5e9b0cb65cc254aea23f3cb051648010738e589952f794df67cf15e2fa3555005372f96bfffb9fea01cd1b8a7
pkgname = dale-git
diff --git a/PKGBUILD b/PKGBUILD
index 620b98aec413..03f0c1e4aaf2 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -12,9 +12,11 @@ makedepends=('git' 'cmake' 'pkg-config' 'llvm35')
provides=('dale')
source=(
"git+https://github.com/tomhrr/${_gitname}.git"
+ 'pkg-config.patch'
)
sha512sums=(
'SKIP'
+ '718a22bd9386d6ba6daf1ea30dd4d18df3a1adc5e9b0cb65cc254aea23f3cb051648010738e589952f794df67cf15e2fa3555005372f96bfffb9fea01cd1b8a7'
)
pkgver() {
@@ -22,11 +24,15 @@ pkgver() {
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
+prepare() {
+ cd "$_gitname"
+ patch -Np1 -i "${srcdir}/pkg-config.patch"
+}
+
build() {
mkdir -p build
cd build
- # for some reason cmake can't find libffi... this is probably a problem with CMakeLists.txt, but for now I'm working around it:
- cmake ../$_gitname -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_MANDIR=/usr/share/man -DFFI_INCLUDE_DIR=$(pkg-config --cflags-only-I libffi | cut -b3-)
+ cmake ../$_gitname -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_MANDIR=/usr/share/man
make
}
diff --git a/pkg-config.patch b/pkg-config.patch
new file mode 100644
index 000000000000..100be64421d9
--- /dev/null
+++ b/pkg-config.patch
@@ -0,0 +1,65 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e30b9df..a38f1f5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -90,39 +90,9 @@ execute_process (COMMAND ${LLVM_CONFIG} --cppflags
+ OUTPUT_VARIABLE LLVM_CXX_FLAGS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+-# Confirm that ffi.h and libffi are present. (Added two common ffi.h
+-# path, would be nice if this were a bit more robust.)
+-
+-find_path (FFI_INCLUDE_PATH ffi.h PATHS /usr/include/i386-linux-gnu /usr/include/x86_64-linux-gnu ${FFI_INCLUDE_DIR})
+-if (FFI_INCLUDE_PATH)
+- set (FFI_HEADER ffi.h)
+-else ()
+- find_path (FFI_INCLUDE_PATH ffi/ffi.h PATHS ${FFI_INCLUDE_DIR})
+- if (FFI_INCLUDE_PATH)
+- set (FFI_HEADER ffi/ffi.h)
+- endif ()
+-endif ()
+-
+-if (NOT FFI_HEADER)
+- message (FATAL_ERROR "libffi includes (ffi.h) are not found. Re-run cmake with -DFFI_INCLUDE_DIR={path-to-include-dir}")
+-endif ()
+-
+-find_library(FFI_LIBRARY_PATH ffi PATHS ${FFI_LIBRARY_DIR})
+-if (NOT FFI_LIBRARY_PATH)
+- message (FATAL_ERROR "libffi is not found. Re-run cmake with -DFFI_LIBRARY_DIR.")
+-endif ()
+-
+-if (NOT FFI_LIBRARY_DIR)
+- set (FFI_LIBRARY_DIR "")
+-else ()
+- set (FFI_LIBRARY_DIR "-L${FFI_LIBRARY_DIR}")
+-endif ()
+-
+-if (NOT FFI_INCLUDE_DIR)
+- set (FFI_INCLUDE_DIR "")
+-else ()
+- set (FFI_INCLUDE_DIR "-I${FFI_INCLUDE_DIR}")
+-endif ()
++# Confirm that ffi.h and libffi are present.
++find_package(PkgConfig REQUIRED)
++pkg_search_module(FFI REQUIRED libffi)
+
+ # Populate the configuration header.
+
+@@ -155,7 +125,7 @@ if (IS_DEBUG)
+ endif ()
+
+ # Set compile/link flags.
+-set (DALEC_LIBDIR_FLAGS_ "$ENV{LDFLAGS} ${FFI_LIBRARY_DIR}")
++set (DALEC_LIBDIR_FLAGS_ "$ENV{LDFLAGS} ${FFI_LDFLAGS}")
+ set (DALEC_LIB_FLAGS_ "")
+
+ if (${D_LLVM_VERSION_MINOR} GREATER 4)
+@@ -176,7 +146,7 @@ else ()
+ endif ()
+
+ string(REGEX REPLACE "^ +" "" DALEC_LINK_FLAGS ${DALEC_LINK_FLAGS_})
+-set (CMAKE_CXX_FLAGS "$ENV{CPPFLAGS} ${FFI_INCLUDE_DIR} -Wall -ansi")
++set (CMAKE_CXX_FLAGS "$ENV{CPPFLAGS} ${FFI_CFLAGS} -Wall -ansi")
+ set (CMAKE_CXX_FLAGS_DEBUG "-g -ggdb -O0 -fno-inline -Wextra -Wno-unused-parameter ${CXX_FLAGS_EXTRA}")
+ set (CMAKE_CXX_FLAGS_RELEASE "-O3 -fomit-frame-pointer ${CXX_FLAGS_EXTRA}")
+