From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id AB8813857C48 for ; Wed, 19 May 2021 11:50:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AB8813857C48 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (ip-213-127-36-226.ip.prioritytelecom.net [213.127.36.226]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 085A4302BBED; Wed, 19 May 2021 13:49:55 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id DAA7C413CD48; Wed, 19 May 2021 13:49:54 +0200 (CEST) From: Mark Wielaard To: debugedit@sourceware.org Cc: Mark Wielaard Subject: [COMMITTED] find-debuginfo: Generate and install as top-level build file. Date: Wed, 19 May 2021 13:49:53 +0200 Message-Id: <20210519114953.6772-1-mark@klomp.org> X-Mailer: git-send-email 2.18.4 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: debugedit@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: debugedit development mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 May 2021 11:50:06 -0000 find-debuginfo relied on lib_rpm_dir to find other debugedit tools. But the script itself was generated at configure time in a subdir. This makes testing the (non-installed) build slightly inconvenient. Add a automake rule to generate find-debuginfo at build time, instead of configure time, in the top-level builddir next to the other tools. * .gitignore: Move scripts/find-debuginfo to find-debuginfo. * configure.ac: Explicitly check we have SED. * Makefile.am (bin_SCRIPTS): Drop subdir scripts. (CLEANFILES): New. (do_subst): New. (find-debuginfo): New generate using do_subst. (find-debuginfo.1): Adjust location and protect against parallel builds. (EXTRA_DIST): Add .in suffix to scripts/find-debuginfo. * scripts/find-debuginfo.in (lib_rpm_dir): Rename to... (install_dir): ...this. Signed-off-by: Mark Wielaard --- .gitignore | 2 +- Makefile.am | 29 +++++++++++++++++++++-------- configure.ac | 2 +- scripts/find-debuginfo.in | 12 +++++++----- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index ae33e64..9868abc 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ debugedit.1 sepdebugcrcfix sepdebugcrcfix.1 -scripts/find-debuginfo +find-debuginfo find-debuginfo.1 atconfig diff --git a/Makefile.am b/Makefile.am index 645a502..98b2f20 100644 --- a/Makefile.am +++ b/Makefile.am @@ -24,8 +24,19 @@ AM_CFLAGS = -Wall # All our programs bin_PROGRAMS = debugedit sepdebugcrcfix -# Install find-debuginfo in $(bindir) and distribute it. -bin_SCRIPTS = $(top_srcdir)/scripts/find-debuginfo +# Install find-debuginfo in $(bindir) +bin_SCRIPTS = find-debuginfo + +# All our scripts are generated, so need to be explicitly cleaned +CLEANFILES = $(bin_SCRIPTS) + +# Some standard substitutions for scripts +do_subst = ($(SED) -e 's,[@]PACKAGE[@],$(PACKAGE),g' \ + -e 's,[@]VERSION[@],$(VERSION),g') + +find-debuginfo: $(top_srcdir)/scripts/find-debuginfo.in Makefile + $(do_subst) < "$(top_srcdir)/scripts/$@.in" > "$@" + chmod +x "$@" debugedit_SOURCES = tools/debugedit.c \ tools/hashtab.c \ @@ -63,15 +74,17 @@ sepdebugcrcfix.1: tools/sepdebugcrcfix.c configure.ac sepdebugcrcfix$(EXEEXT) * ) : ;; \ esac -# Since the script isn't generated this doesn't need any special casing. -find-debuginfo.1: $(top_srcdir)/scripts/find-debuginfo - $(HELP2MAN) -N --output=$@ \ - --name='finds debuginfo and processes it' \ - $(top_srcdir)/scripts/find-debuginfo +find-debuginfo.1: $(top_srcdir)/scripts/find-debuginfo.in configure.ac find-debuginfo + @case '$?' in \ + *$<* | *configure.ac* ) $(HELP2MAN) -N --output=$@ \ + --name='finds debuginfo and processes it' \ + ./find-debuginfo ;;\ + * ) : ;; \ + esac noinst_HEADERS= tools/ansidecl.h \ tools/hashtab.h \ tools/md5.h \ tools/sha1.h -EXTRA_DIST = README COPYING COPYING3 COPYING.LIB scripts/find-debuginfo +EXTRA_DIST = README COPYING COPYING3 COPYING.LIB scripts/find-debuginfo.in diff --git a/configure.ac b/configure.ac index d1d8969..65cec5e 100644 --- a/configure.ac +++ b/configure.ac @@ -40,6 +40,7 @@ AC_USE_SYSTEM_EXTENSIONS # Checks for programs. AC_PROG_AWK +AC_PROG_SED AC_PROG_CC_C99 AC_PROG_LN_S AC_CHECK_TOOL([LD], [ld]) @@ -100,5 +101,4 @@ AC_SUBST([GZ_NONE_FLAG]) # And generate the output files. AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([scripts/find-debuginfo], [chmod +x scripts/find-debuginfo]) AC_OUTPUT diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in index 82fac25..828fd09 100755 --- a/scripts/find-debuginfo.in +++ b/scripts/find-debuginfo.in @@ -1,6 +1,8 @@ #!/bin/bash -#find-debuginfo - automagically generate debug info and file list -#for inclusion in an rpm spec file. + +# @PACKAGE@ @VERSION@ +# find-debuginfo - automagically generate debug info and file list +# for inclusion in package file lists. # Copyright (C) 2002-2021 rpm and debugedit contributors # @@ -97,7 +99,7 @@ EOF } # Figure out where we are installed so we can call other helper scripts. -lib_rpm_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +install_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # With -g arg, pass it to strip on libraries or executables. strip_g=false @@ -436,7 +438,7 @@ do_file() if [ "$no_recompute_build_id" = "true" ]; then no_recompute="-n" fi - id=$(${lib_rpm_dir}/debugedit -b "$debug_base_name" -d "$debug_dest_name" \ + id=$(${install_dir}/debugedit -b "$debug_base_name" -d "$debug_dest_name" \ $no_recompute -i \ ${build_id_seed:+--build-id-seed="$build_id_seed"} \ -l "$SOURCEFILE" "$f") || exit @@ -594,7 +596,7 @@ if $run_dwz \ # dwz invalidates .gnu_debuglink CRC32 in the main files. cat "$ELFBINSFILE" | (cd "$RPM_BUILD_ROOT"; \ - tr '\n' '\0' | xargs -0 ${lib_rpm_dir}/sepdebugcrcfix usr/lib/debug) + tr '\n' '\0' | xargs -0 ${install_dir}/sepdebugcrcfix usr/lib/debug) fi fi -- 2.18.4