From patchwork Sun Oct 15 17:17:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 77808 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0406385828E for ; Sun, 15 Oct 2023 17:17:47 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 9AF253858D33 for ; Sun, 15 Oct 2023 17:17:33 +0000 (GMT) ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9AF253858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697390254; cv=none; b=Vn208HmD1dDCyD0RRud5wlNtog6mZ7flrbRLeAPhUmiDadS5+xKHz60/A402BRQAtjE/4hdkY2fuA46IkW8kYjUG23/m34UqS25D74UjMh8RpfWJEp8ukwNdy/aAISsCLiyI7h4pCIop+a1dWPtmXl1FWC/kco3T1I1syXagQ1Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697390254; c=relaxed/simple; bh=QpDPBG+2j6gtq3dyUie/ep1hLokyc2wN7gp4Vk77Qy8=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=GtouAjTBQjD+O46F0BDoFWzbpzmLIw9wHAT5Jb/MaY9MlW0ZEh0dX6AmMpDr68mUxstRkL/NtuTRab7pxTxgvBMqMZus83sZvDbkQn5mFz91N+Sx3QsOn8zjsey/ru87zrC+/abte17YzXTxoB88ZVaAaKVKOeCQA5DbCIvlMRw= ARC-Authentication-Results: i=1; server2.sourceware.org DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9AF253858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 27C48335CCD; Sun, 15 Oct 2023 17:17:33 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH 1/3] gnulib: support building for --build [PR sim/30882] Date: Sun, 15 Oct 2023 23:02:26 +0545 Message-ID: <20231015171728.30138-1-vapier@gentoo.org> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org The sim tree has some build-time programs for generating source files that are a bit complicated and expect a POSIX-compatible system. But some targets (e.g. mingw) might not provide up-to-date support. Since we already have gnulib in the tree, leverage that to also build for the --build system. The top-level configure logic will pass down --with-build-subdir when the subdir is built for it. Use that to adjust the output variable names and paths. This allows us to include the gnulib makefile frags for both --host and --build simultaneously. --- gnulib/Makefile.gnulib.inc.in | 18 ++++++++----- gnulib/Makefile.in | 2 ++ gnulib/configure | 50 ++++++++++++++++++++++++++--------- gnulib/configure.ac | 12 +++++++++ gnulib/import/Makefile.in | 2 ++ 5 files changed, 65 insertions(+), 19 deletions(-) diff --git a/gnulib/Makefile.gnulib.inc.in b/gnulib/Makefile.gnulib.inc.in index 777a99c58d17..755516632f75 100644 --- a/gnulib/Makefile.gnulib.inc.in +++ b/gnulib/Makefile.gnulib.inc.in @@ -31,16 +31,20 @@ # # INCGNU: A list of -I.... include paths that should be passed to the # compiler, these are where the gnulib headers can be found. +# +# When building for --build, the variables will be prefixed with BUILD_. # Packages must define the relative path to gnulib's parent dir. ifndef GNULIB_PARENT_DIR $(error missing GNULIB_PARENT_DIR) endif -LIBGNU = $(GNULIB_PARENT_DIR)/gnulib/import/libgnu.a -LIBGNU_EXTRA_LIBS = @FREXPL_LIBM@ @FREXP_LIBM@ @INET_NTOP_LIB@ \ - @LIBTHREAD@ @LIB_GETLOGIN@ @LIB_GETRANDOM@ \ - @LIB_HARD_LOCALE@ @LIB_MBRTOWC@ \ - @LIB_SETLOCALE_NULL@ @LIBINTL@ @LIB_SELECT@ @LIBSOCKET@ -INCGNU = -I$(srcdir)/$(GNULIB_PARENT_DIR)/gnulib/import \ - -I$(GNULIB_PARENT_DIR)/gnulib/import +@VAR_PREFIX@LIBGNU = $(GNULIB_PARENT_DIR)/@BUILD_SUBDIR@gnulib/import/libgnu.a +@VAR_PREFIX@LIBGNU_EXTRA_LIBS = \ + @FREXPL_LIBM@ @FREXP_LIBM@ @INET_NTOP_LIB@ \ + @LIBTHREAD@ @LIB_GETLOGIN@ @LIB_GETRANDOM@ \ + @LIB_HARD_LOCALE@ @LIB_MBRTOWC@ \ + @LIB_SETLOCALE_NULL@ @LIBINTL@ @LIB_SELECT@ @LIBSOCKET@ +@VAR_PREFIX@INCGNU = \ + -I$(srcdir)/$(GNULIB_PARENT_DIR)/gnulib/import \ + -I$(GNULIB_PARENT_DIR)/@BUILD_SUBDIR@gnulib/import diff --git a/gnulib/configure.ac b/gnulib/configure.ac index 9f081614efd5..72a16d5ae6ea 100644 --- a/gnulib/configure.ac +++ b/gnulib/configure.ac @@ -56,6 +56,18 @@ AC_CHECK_TOOL(AR, ar) # Checks for libraries. # # ---------------------- # +AC_ARG_WITH(build-subdir, + [AS_HELP_STRING([--with-build-subdir=SUBDIR], [Configuring in a subdirectory for build])]) + +VAR_PREFIX= +BUILD_SUBDIR= +AS_IF([test -n "${with_build_subdir}"], [dnl + VAR_PREFIX="BUILD_" + BUILD_SUBDIR="${with_build_subdir}/" +]) +AC_SUBST(BUILD_SUBDIR) +AC_SUBST(VAR_PREFIX) + AC_CONFIG_FILES(Makefile.gnulib.inc) AC_OUTPUT(Makefile import/Makefile,