build: Add "make dist"

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:
Xi Ruoyao 2023-09-13 14:08:06 +08:00
parent a9dc9724ae
commit c858ba4e17
No known key found for this signature in database
GPG Key ID: ACAAD20E19E710E3
3 changed files with 18 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
lfs-bootscripts-*.tar.xz lfs-bootscripts-*.tar.xz
lfs-*.tar.xz
conditional.ent conditional.ent
version.ent version.ent
appendices/*.script appendices/*.script

View File

@ -209,5 +209,14 @@ dump-commands: validate
all: book nochunks pdf dump-commands all: book nochunks pdf dump-commands
.PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list version 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

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