Skip to content

Commit

Permalink
build: use TARNAME instead of NAME for paths
Browse files Browse the repository at this point in the history
PACKAGE_TARNAME is the same as PACKAGE_NAME but normalized, so it should
be safer to use in paths.  For example, on a downstream project, if
spaces or shell metacharacters are added to the package name, a path
that uses PACKAGE_TARNAME should keep working.

From the manual of GNU Autoconf (version 2.69):

>  -- Macro: AC_INIT (PACKAGE, VERSION, [BUG-REPORT], [TARNAME], [URL])
>      Process any command-line arguments and perform initialization and
>      verification.
>
>      Set the name of the PACKAGE and its VERSION.  These are typically
>      used in '--version' support, including that of 'configure'.  The
>      optional argument BUG-REPORT should be the email to which users
>      should send bug reports.  The package TARNAME differs from
>      PACKAGE: the latter designates the full package name (e.g., 'GNU
>      Autoconf'), while the former is meant for distribution tar ball
>      names (e.g., 'autoconf').  It defaults to PACKAGE with 'GNU '
>      stripped, lower-cased, and all characters other than
>      alphanumerics and underscores are changed to '-'.

Note also that by default (on autoconf v2.69), `docdir=@DocDir@` in
config.mk.in expands to the following in config.mk:

    docdir=${datarootdir}/doc/${PACKAGE_TARNAME}
  • Loading branch information
kmk3 committed Aug 14, 2022
1 parent 891fd02 commit 7bbcf7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ dist: config.mk
make distclean
mv config.status.old config.status
mv config.sh.old config.sh
rm -fr $(NAME)-$(VERSION) $(NAME)-$(VERSION).tar.xz
mkdir -p $(NAME)-$(VERSION)/test
cp -a $(DISTFILES) $(NAME)-$(VERSION)
cp -a $(DISTFILES_TEST) $(NAME)-$(VERSION)/test
rm -rf $(NAME)-$(VERSION)/src/tools
find $(NAME)-$(VERSION) -name .svn -delete
tar -cJvf $(NAME)-$(VERSION).tar.xz $(NAME)-$(VERSION)
rm -fr $(NAME)-$(VERSION)
rm -fr $(TARNAME)-$(VERSION) $(TARNAME)-$(VERSION).tar.xz
mkdir -p $(TARNAME)-$(VERSION)/test
cp -a $(DISTFILES) $(TARNAME)-$(VERSION)
cp -a $(DISTFILES_TEST) $(TARNAME)-$(VERSION)/test
rm -rf $(TARNAME)-$(VERSION)/src/tools
find $(TARNAME)-$(VERSION) -name .svn -delete
tar -cJvf $(TARNAME)-$(VERSION).tar.xz $(TARNAME)-$(VERSION)
rm -fr $(TARNAME)-$(VERSION)

asc: config.mk
./mkasc.sh $(VERSION)
Expand All @@ -240,11 +240,11 @@ deb-apparmor: dist config.sh
./mkdeb.sh -apparmor --enable-apparmor

test-compile: dist config.mk
cd test/compile; ./compile.sh $(NAME)-$(VERSION)
cd test/compile; ./compile.sh $(TARNAME)-$(VERSION)

.PHONY: rpms
rpms: src/man config.mk
./platform/rpm/mkrpm.sh $(NAME) $(VERSION)
./platform/rpm/mkrpm.sh $(TARNAME) $(VERSION)

extras: all
$(MAKE) -C extras/firetools
Expand Down
4 changes: 2 additions & 2 deletions mkdeb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ EXTRA_VERSION=$1

test "$#" -gt 0 && shift

CODE_ARCHIVE="$NAME-$VERSION.tar.xz"
CODE_DIR="$NAME-$VERSION"
CODE_ARCHIVE="$TARNAME-$VERSION.tar.xz"
CODE_DIR="$TARNAME-$VERSION"
INSTALL_DIR="${INSTALL_DIR}${CODE_DIR}/debian"
DEBIAN_CTRL_DIR="${DEBIAN_CTRL_DIR}${CODE_DIR}/debian/DEBIAN"

Expand Down

0 comments on commit 7bbcf7e

Please sign in to comment.