build: Add "make dist"

git-version: Always skip creating version.ent if LFS-RELEASE exists
added .gitignore

For creating a tarball without .git directory easier.  The tarball will
include version.ent and LFS-RELEASE files so the book rendered from it
won't show "unknown" for all dates
This commit is contained in:
Poltern 2023-09-13 23:00:58 +03:00
parent b6ffaf1760
commit 458b3417be
3 changed files with 34 additions and 12 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
lfs-bootscripts-*.tar.xz
lfs-*.tar.xz
conditional.ent
version.ent
appendices/*.script
*.swp
fop.log

View File

@ -206,17 +206,26 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
version:
$(Q)./git-version.sh $(REV)
#dump-commands: validate
# @echo "Dumping book commands..."
#
# $(Q)rm -rf $(DUMPDIR)
#
# $(Q)xsltproc --output $(DUMPDIR)/ \
# stylesheets/dump-commands.xsl \
# $(RENDERTMP)/lfs-full.xml
# @echo "Dumping book commands complete in $(DUMPDIR)"
dump-commands: validate
@echo "Dumping book commands..."
all: book nochunks pdf # dump-commands
$(Q)rm -rf $(DUMPDIR)
.PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version
$(Q)xsltproc --output $(DUMPDIR)/ \
stylesheets/dump-commands.xsl \
$(RENDERTMP)/lfs-full.xml
@echo "Dumping book commands complete in $(DUMPDIR)"
all: book nochunks pdf dump-commands
dist:
$(Q)DIST=/tmp/LFS-RELEASE ./git-version.sh $(REV)
$(Q)rm -f lfs-$$(</tmp/LFS-RELEASE).tar.xz
$(Q)tar cJf lfs-$$(</tmp/LFS-RELEASE).tar.xz \
$(shell git ls-tree HEAD . --name-only) version.ent \
-C /tmp LFS-RELEASE \
--transform "s,^,lfs-$$(</tmp/LFS-RELEASE)/,"
$(Q)echo "Generated XML tarball lfs-$$(</tmp/LFS-RELEASE).tar.xz"
.PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version dist

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
if [ "$1" = sysv ]; then
SYSV="INCLUDE"
@ -14,6 +14,10 @@ fi
echo "<!ENTITY % sysv \"$SYSV\">" > conditional.ent
echo "<!ENTITY % systemd \"$SYSTEMD\">" >> conditional.ent
if [ -e LFS-RELEASE ]; then
exit 0
fi
if ! git status > /dev/null; then
# Either it's not a git repository, or git is unavaliable.
# Just workaround.
@ -65,3 +69,5 @@ echo "<!ENTITY version \"$versiond\">" >> version.ent
echo "]]>" >> version.ent
echo "<!ENTITY releasedate \"$full_date\">" >> version.ent
echo "<!ENTITY copyrightdate \"1999-$year\">" >> version.ent
[ -z "$DIST" ] || echo $version > "$DIST"