From 5fd77f3f437e9a648adc18efa8eb753b17915c9e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 18 Jun 2015 20:21:41 -0400 Subject: gnu: Make 'mount' interface in static Guile consistent with Guix API. Rather than expecting a pointer, the version of 'mount' in guile-static-stripped now takes a string for the 'options' argument, just like the 'mount' procedure in (guix build syscalls). * gnu/packages/patches/guile-linux-syscalls.patch (mount): Expect a string or #f for 'options' argument. * gnu/build/file-systems.scm (mount-file-system): Use new 'mount' interface. --- gnu/packages/patches/guile-linux-syscalls.patch | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'gnu/packages/patches') diff --git a/gnu/packages/patches/guile-linux-syscalls.patch b/gnu/packages/patches/guile-linux-syscalls.patch index 57c7f2589d..73a062bda1 100644 --- a/gnu/packages/patches/guile-linux-syscalls.patch +++ b/gnu/packages/patches/guile-linux-syscalls.patch @@ -7,10 +7,10 @@ diff --git a/libguile/posix.c b/libguile/posix.c index 324f21b..cbee94d 100644 --- a/libguile/posix.c +++ b/libguile/posix.c -@@ -2286,6 +2286,261 @@ scm_init_popen (void) +@@ -2245,6 +2245,267 @@ scm_init_popen (void) } #endif - + + +/* Linux! */ + @@ -25,15 +25,18 @@ index 324f21b..cbee94d 100644 +#define FUNC_NAME s_scm_mount +{ + int err; -+ char *c_source, *c_target, *c_type; ++ char *c_source, *c_target, *c_type, *c_data; + unsigned long c_flags; -+ void *c_data; + + c_source = scm_to_locale_string (source); + c_target = scm_to_locale_string (target); + c_type = scm_to_locale_string (type); + c_flags = SCM_UNBNDP (flags) ? 0 : scm_to_ulong (flags); -+ c_data = SCM_UNBNDP (data) ? NULL : scm_to_pointer (data); ++ ++ if (SCM_UNBNDP (data) || scm_is_false (data)) ++ c_data = NULL; ++ else ++ c_data = scm_to_locale_string (data); + + err = mount (c_source, c_target, c_type, c_flags, c_data); + if (err != 0) @@ -43,6 +46,9 @@ index 324f21b..cbee94d 100644 + free (c_target); + free (c_type); + ++ if (c_data != NULL) ++ free (c_data); ++ + if (err != 0) + { + errno = err; -- cgit v1.2.3 From fd6ae1b9836ffe74105f26930d101d1297849740 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 19 Jun 2015 17:18:03 +0200 Subject: gnu: clang: Allow 'clang' to link executables. * gnu/packages/patches/clang-libc-search-path.patch: New file. * gnu-system.am (dist_patch_DATA): Add it. * gnu/packages/llvm.scm (clang-from-llvm)[source]: Use it. [inputs]: Add "gcc-lib". [arguments]. Add -DGCC_INSTALL_PREFIX and -DC_INCLUDE_DIRS to #:configure-flags. Add #:phases argument. --- gnu-system.am | 1 + gnu/packages/llvm.scm | 37 +++++++++++++++++++++-- gnu/packages/patches/clang-libc-search-path.patch | 19 ++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/clang-libc-search-path.patch (limited to 'gnu/packages/patches') diff --git a/gnu-system.am b/gnu-system.am index 1f7c4e8490..c061747cd7 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -394,6 +394,7 @@ dist_patch_DATA = \ gnu/packages/patches/calibre-no-updates-dialog.patch \ gnu/packages/patches/cdparanoia-fpic.patch \ gnu/packages/patches/chmlib-inttypes.patch \ + gnu/packages/patches/clang-libc-search-path.patch \ gnu/packages/patches/clucene-pkgconfig.patch \ gnu/packages/patches/cmake-fix-tests.patch \ gnu/packages/patches/coreutils-dummy-man.patch \ diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 946773c91e..1755f9c014 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -26,6 +26,8 @@ #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (gnu packages) + #:use-module (gnu packages gcc) + #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker #:use-module (gnu packages perl) #:use-module (gnu packages python) #:use-module (gnu packages xml)) @@ -85,7 +87,8 @@ tools as well as libraries with equivalent functionality.") (method url-fetch) (uri (string-append "http://llvm.org/releases/" version "/cfe-" version ".src.tar.xz")) - (sha256 (base32 hash)))) + (sha256 (base32 hash)) + (patches (list (search-patch "clang-libc-search-path.patch"))))) ;; Using cmake allows us to treat llvm as an external library. There ;; doesn't seem to be any way to do this with clang's autotools-based ;; build system. @@ -93,10 +96,40 @@ tools as well as libraries with equivalent functionality.") (native-inputs (package-native-inputs llvm)) (inputs `(("libxml2" ,libxml2) + ("gcc-lib" ,gcc-4.9 "lib") ,@(package-inputs llvm))) (propagated-inputs `(("llvm" ,llvm))) - (arguments `(#:configure-flags '("-DCLANG_INCLUDE_TESTS=True"))) + (arguments + `(#:configure-flags + (list "-DCLANG_INCLUDE_TESTS=True" + + ;; Find libgcc_s, crtbegin.o, and crtend.o. + (string-append "-DGCC_INSTALL_PREFIX=" + (assoc-ref %build-inputs "gcc-lib")) + + ;; Use a sane default include directory. + (string-append "-DC_INCLUDE_DIRS=" + (assoc-ref %build-inputs "libc") + "/include")) + + #:phases (modify-phases %standard-phases + (add-after + 'unpack 'set-glibc-file-names + (lambda* (#:key inputs #:allow-other-keys) + (let ((libc (assoc-ref inputs "libc"))) + ;; Patch the 'getLinuxDynamicLinker' function to that + ;; it uses the right dynamic linker file name. + (substitute* "lib/Driver/Tools.cpp" + (("/lib64/ld-linux-x86-64.so.2") + (string-append libc + ,(glibc-dynamic-linker)))) + + ;; Same for libc's libdir, to allow crt1.o & co. to be + ;; found. + (substitute* "lib/Driver/ToolChains.cpp" + (("@GLIBC_LIBDIR@") + (string-append libc "/lib"))))))))) ;; Clang supports the same environment variables as GCC. (native-search-paths diff --git a/gnu/packages/patches/clang-libc-search-path.patch b/gnu/packages/patches/clang-libc-search-path.patch new file mode 100644 index 0000000000..327336ac09 --- /dev/null +++ b/gnu/packages/patches/clang-libc-search-path.patch @@ -0,0 +1,19 @@ +Clang attempts to guess file names based on the OS and distro (yes!), +but unfortunately, that doesn't work for us. + +This patch makes it easy to insert libc's $libdir so that Clang passes the +correct absolute file name of crt1.o etc. to 'ld'. + +--- cfe-3.6.0.src/lib/Driver/ToolChains.cpp 2015-02-18 22:03:07.000000000 +0100 ++++ cfe-3.6.0.src/lib/Driver/ToolChains.cpp 2015-06-19 16:37:20.459701044 +0200 +@@ -3085,6 +3085,10 @@ Linux::Linux(const Driver &D, const llvm + + addPathIfExists(SysRoot + "/lib", Paths); + addPathIfExists(SysRoot + "/usr/lib", Paths); ++ ++ // Add libc's lib/ directory to the search path, so that crt1.o, crti.o, ++ // and friends can be found. ++ addPathIfExists("@GLIBC_LIBDIR@", Paths); + } + + bool Linux::HasNativeLLVMSupport() const { -- cgit v1.2.3