From 6e2fbaf2fdc32f14a73ed0c7b81e2cd132edbed7 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Thu, 1 Jan 2015 13:16:37 +0100 Subject: [PATCH] [PATCH 2/5] build/ruby: make use of -Wl,--no-undefined configurable --- 90/b41b472e42f4eef787b5fb693adf071b7ea7f9 | 121 ++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 90/b41b472e42f4eef787b5fb693adf071b7ea7f9 diff --git a/90/b41b472e42f4eef787b5fb693adf071b7ea7f9 b/90/b41b472e42f4eef787b5fb693adf071b7ea7f9 new file mode 100644 index 000000000..318228efa --- /dev/null +++ b/90/b41b472e42f4eef787b5fb693adf071b7ea7f9 @@ -0,0 +1,121 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id E91D3429E2E + for ; Thu, 1 Jan 2015 04:17:21 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id alBPRuaZkeXo for ; + Thu, 1 Jan 2015 04:17:21 -0800 (PST) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 97CBD429E29 + for ; Thu, 1 Jan 2015 04:17:17 -0800 (PST) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1Y6egn-00054A-15; Thu, 01 Jan 2015 08:17:17 -0400 +Received: (nullmailer pid 28811 invoked by uid 1000); Thu, 01 Jan 2015 + 12:16:50 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH 2/5] build/ruby: make use of -Wl,--no-undefined configurable +Date: Thu, 1 Jan 2015 13:16:37 +0100 +Message-Id: <1420114600-28396-3-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.1.3 +In-Reply-To: <1420114600-28396-1-git-send-email-david@tethera.net> +References: <1420114600-28396-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 01 Jan 2015 12:17:22 -0000 + +In particular this is supposed to help build on systems (presumably +using a non-gnu ld) where this flag is not available. +--- + bindings/Makefile.local | 4 +++- + bindings/ruby/extconf.rb | 5 +++-- + configure | 13 +++++++++++++ + 3 files changed, 19 insertions(+), 3 deletions(-) + +diff --git a/bindings/Makefile.local b/bindings/Makefile.local +index 6ed1344..210055f 100644 +--- a/bindings/Makefile.local ++++ b/bindings/Makefile.local +@@ -5,7 +5,9 @@ dir := bindings + # force the shared library to be build + ruby-bindings: lib/libnotmuch.so + ifeq ($(HAVE_RUBY_DEV),1) +- cd $(dir)/ruby && ruby extconf.rb --vendor ++ cd $(dir)/ruby && \ ++ EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \ ++ ruby extconf.rb --vendor + $(MAKE) -C $(dir)/ruby + else + @echo Missing dependency, skipping ruby bindings +diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb +index 6160db2..6d5607e 100644 +--- a/bindings/ruby/extconf.rb ++++ b/bindings/ruby/extconf.rb +@@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib') + # includes + $INCFLAGS = "-I#{dir} #{$INCFLAGS}" + +-# make sure there are no undefined symbols +-$LDFLAGS += ' -Wl,--no-undefined' ++if ENV['EXTRA_LDFLAGS'] ++ $LDFLAGS += " " + ENV['EXTRA_LDFLAGS'] ++end + + def have_local_library(lib, path, func, headers = nil) + checking_for checking_message(func, lib) do +diff --git a/configure b/configure +index 7df3b29..1a4c956 100755 +--- a/configure ++++ b/configure +@@ -712,6 +712,16 @@ else + as_needed_ldflags="" + fi + ++printf "Checking for -Wl,--no-undefined... " ++if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1 ++then ++ printf "Yes.\n" ++ no_undefined_ldflags="-Wl,--no-undefined" ++else ++ printf "No (nothing to worry about).\n" ++ no_undefined_ldflags="" ++fi ++ + WARN_CXXFLAGS="" + printf "Checking for available C++ compiler warning flags... " + for flag in -Wall -Wextra -Wwrite-strings; do +@@ -916,6 +926,9 @@ RPATH_LDFLAGS = ${rpath_ldflags} + # Flags needed to have linker link only to necessary libraries + AS_NEEDED_LDFLAGS = ${as_needed_ldflags} + ++# Flags to have the linker flag undefined symbols in object files ++NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags} ++ + # Whether valgrind header files are available + HAVE_VALGRIND = ${have_valgrind} + +-- +2.1.3 + -- 2.26.2