pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/llvm Create and use shared library libLLVM; fix i...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/52ecbdf02d4c
branches:  trunk
changeset: 359846:52ecbdf02d4c
user:      adam <adam%pkgsrc.org@localhost>
date:      Sun Mar 19 19:01:48 2017 +0000

description:
Create and use shared library libLLVM; fix install_name for shared object on Darwin.

diffstat:

 lang/llvm/Makefile                                            |  16 ++-----
 lang/llvm/PLIST                                               |   5 +-
 lang/llvm/distinfo                                            |   6 +-
 lang/llvm/patches/patch-cmake_modules_AddLLVM.cmake           |  16 ++++++-
 lang/llvm/patches/patch-cmake_modules_HandleLLVMOptions.cmake |  14 ++++++
 lang/llvm/patches/patch-tools_llvm-shlib_CMakeLists.txt       |  23 +++++++++++
 6 files changed, 63 insertions(+), 17 deletions(-)

diffs (156 lines):

diff -r 9e37f785c840 -r 52ecbdf02d4c lang/llvm/Makefile
--- a/lang/llvm/Makefile        Sun Mar 19 17:06:34 2017 +0000
+++ b/lang/llvm/Makefile        Sun Mar 19 19:01:48 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2017/03/17 22:38:17 adam Exp $
+# $NetBSD: Makefile,v 1.16 2017/03/19 19:01:48 adam Exp $
 #
 # when updating this, please also update:
 # devel/include-what-you-use
@@ -11,6 +11,7 @@
 
 DISTNAME=      llvm-4.0.0.src
 PKGNAME=       ${DISTNAME:S/.src//}
+PKGREVISION=   1
 CATEGORIES=    lang devel
 MASTER_SITES=  http://llvm.org/releases/${PKGVERSION_NOREV}/
 EXTRACT_SUFX=  .tar.xz
@@ -31,7 +32,10 @@
 CMAKE_ARGS+=   -DCMAKE_BUILD_TYPE=Release
 CMAKE_ARGS+=   -DCMAKE_C_COMPILER=gcc
 CMAKE_ARGS+=   -DCMAKE_CXX_COMPILER=g++
+CMAKE_ARGS+=   -DLLVM_BUILD_LLVM_DYLIB=ON
+CMAKE_ARGS+=   -DLLVM_INCLUDE_TESTS=OFF
 CMAKE_ARGS+=   -DLLVM_INSTALL_UTILS=ON
+CMAKE_ARGS+=   -DLLVM_LINK_LLVM_DYLIB=ON
 
 CMAKE_ARGS.Darwin+=    -DCMAKE_LIBTOOL=/usr/bin/libtool
 
@@ -100,16 +104,6 @@
 CXXFLAGS+=     -march=i586
 .endif
 
-.if ${OPSYS} == "Darwin"
-.PHONY: fix-darwin-install-name
-post-install: fix-darwin-install-name
-fix-darwin-install-name:
-.  for lib in BugpointPasses LLVMHello libLTO
-       install_name_tool -id ${PREFIX}/lib/${lib}.${SOEXT}     \
-               ${DESTDIR}${PREFIX}/lib/${lib}.${SOEXT}
-.  endfor
-.endif
-
 .include "options.mk"
 
 # replacing config.guess is required even for cmake.
diff -r 9e37f785c840 -r 52ecbdf02d4c lang/llvm/PLIST
--- a/lang/llvm/PLIST   Sun Mar 19 17:06:34 2017 +0000
+++ b/lang/llvm/PLIST   Sun Mar 19 19:01:48 2017 +0000
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.4 2017/03/17 22:38:17 adam Exp $
+@comment $NetBSD: PLIST,v 1.5 2017/03/19 19:01:48 adam Exp $
 bin/FileCheck
 bin/bugpoint
 bin/count
@@ -1236,6 +1236,9 @@
 ${PLIST.XCore}lib/libLLVMXCoreInfo.a
 lib/libLLVMXRay.a
 lib/libLLVMipo.a
+lib/libLLVM.${SOEXT}
+${PLIST.notdylib}lib/libLLVM-4.0.${SOEXT}
+${PLIST.notdylib}lib/libLLVM-${PKGVERSION}.${SOEXT}
 lib/libLTO.${SOEXT}
 ${PLIST.notdylib}lib/libLTO.${SOEXT}.4
 ${PLIST.notdylib}lib/libLTO.${SOEXT}.${PKGVERSION}
diff -r 9e37f785c840 -r 52ecbdf02d4c lang/llvm/distinfo
--- a/lang/llvm/distinfo        Sun Mar 19 17:06:34 2017 +0000
+++ b/lang/llvm/distinfo        Sun Mar 19 19:01:48 2017 +0000
@@ -1,8 +1,10 @@
-$NetBSD: distinfo,v 1.6 2017/03/17 22:38:17 adam Exp $
+$NetBSD: distinfo,v 1.7 2017/03/19 19:01:48 adam Exp $
 
 SHA1 (llvm-4.0.0.src.tar.xz) = aee4524e2407f9fe5afc6f70c753180b907011d0
 RMD160 (llvm-4.0.0.src.tar.xz) = 468ae2502ba523b35c5e8340724ddaa50b31ccb5
 SHA512 (llvm-4.0.0.src.tar.xz) = cf681f0626ef6d568d951cdc3e143471a1d7715a0ba11e52aa273cf5d8d421e1357ef2645cc85879eaefcd577e99e74d07b01566825b3d0461171ef2cbfc7704
 Size (llvm-4.0.0.src.tar.xz) = 21016340 bytes
-SHA1 (patch-cmake_modules_AddLLVM.cmake) = 73725f49c7814f54f9286afe796bc2a466ee9611
+SHA1 (patch-cmake_modules_AddLLVM.cmake) = 4bfb98c5d99797155d0fb13a43352d31f6cfe783
+SHA1 (patch-cmake_modules_HandleLLVMOptions.cmake) = 271e6f5a8cebf8162c4e3b758e96f451b434269b
 SHA1 (patch-include_llvm_Support_Host.h) = a4e19a72714084b211b0182c04ccc51bd606e150
+SHA1 (patch-tools_llvm-shlib_CMakeLists.txt) = 18e6ec7b8895e55ecdf93c9d4781e92052a6fcb1
diff -r 9e37f785c840 -r 52ecbdf02d4c lang/llvm/patches/patch-cmake_modules_AddLLVM.cmake
--- a/lang/llvm/patches/patch-cmake_modules_AddLLVM.cmake       Sun Mar 19 17:06:34 2017 +0000
+++ b/lang/llvm/patches/patch-cmake_modules_AddLLVM.cmake       Sun Mar 19 19:01:48 2017 +0000
@@ -1,10 +1,11 @@
-$NetBSD: patch-cmake_modules_AddLLVM.cmake,v 1.2 2017/03/17 22:38:17 adam Exp $
+$NetBSD: patch-cmake_modules_AddLLVM.cmake,v 1.3 2017/03/19 19:01:48 adam Exp $
 
 Don't use non-portable -z discard-unused on SunOS.
+On Darwin, use correct install-name for shared libraries.
 
---- cmake/modules/AddLLVM.cmake.orig   2016-02-12 17:52:29.000000000 +0000
+--- cmake/modules/AddLLVM.cmake.orig   2017-01-17 21:47:58.000000000 +0000
 +++ cmake/modules/AddLLVM.cmake
-@@ -174,9 +174,6 @@ function(add_link_opts target_name)
+@@ -182,9 +182,6 @@ function(add_link_opts target_name)
          # ld64's implementation of -dead_strip breaks tools that use plugins.
          set_property(TARGET ${target_name} APPEND_STRING PROPERTY
                       LINK_FLAGS " -Wl,-dead_strip")
@@ -14,3 +15,12 @@
        elseif(NOT WIN32 AND NOT LLVM_LINKER_IS_GOLD)
          # Object files are compiled with -ffunction-data-sections.
          # Versions of bfd ld < 2.23.1 have a bug in --gc-sections that breaks
+@@ -1419,7 +1416,7 @@ function(llvm_setup_rpath name)
+   endif()
+ 
+   if (APPLE)
+-    set(_install_name_dir INSTALL_NAME_DIR "@rpath")
++    set(_install_name_dir INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
+     set(_install_rpath "@loader_path/../lib" ${extra_libdir})
+   elseif(UNIX)
+     set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
diff -r 9e37f785c840 -r 52ecbdf02d4c lang/llvm/patches/patch-cmake_modules_HandleLLVMOptions.cmake
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/llvm/patches/patch-cmake_modules_HandleLLVMOptions.cmake     Sun Mar 19 19:01:48 2017 +0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-cmake_modules_HandleLLVMOptions.cmake,v 1.1 2017/03/19 19:01:48 adam Exp $
+
+DragonflyBSD support
+
+--- cmake/modules/HandleLLVMOptions.cmake.orig 2016-01-06 19:05:19.000000000 +0000
++++ cmake/modules/HandleLLVMOptions.cmake
+@@ -132,6 +132,7 @@ endif()
+ # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
+ # build might work on ELF but fail on MachO/COFF.
+ if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR
++        ${CMAKE_SYSTEM_NAME} MATCHES "DragonFly" OR
+         ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR
+         ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND
+    NOT LLVM_USE_SANITIZER)
diff -r 9e37f785c840 -r 52ecbdf02d4c lang/llvm/patches/patch-tools_llvm-shlib_CMakeLists.txt
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/llvm/patches/patch-tools_llvm-shlib_CMakeLists.txt   Sun Mar 19 19:01:48 2017 +0000
@@ -0,0 +1,23 @@
+$NetBSD: patch-tools_llvm-shlib_CMakeLists.txt,v 1.1 2017/03/19 19:01:48 adam Exp $
+
+Use the Linux style linking everywhere except Darwin and SunOS.
+
+--- tools/llvm-shlib/CMakeLists.txt.orig       2016-05-26 04:35:35.000000000 +0000
++++ tools/llvm-shlib/CMakeLists.txt
+@@ -37,11 +37,12 @@ endif()
+ add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
+ 
+ list(REMOVE_DUPLICATES LIB_NAMES)
+-if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR MINGW) # FIXME: It should be "GNU ld for elf"
+-  # GNU ld doesn't resolve symbols in the version script.
+-  set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
+-elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
++if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
+   set(LIB_NAMES -Wl,-all_load ${LIB_NAMES})
++elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
++  set(LIB_NAMES -Wl,-Bsymbolic -Wl,-z -Wl,allextract ${LIB_NAMES} -Wl,-z -Wl,defaultextract)
++else()
++  set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive)
+ endif()
+ 
+ target_link_libraries(LLVM PRIVATE ${LIB_NAMES})



Home | Main Index | Thread Index | Old Index