1
0

rewriting in makefile

This commit is contained in:
dtb 2022-01-29 16:46:15 -05:00
parent 49901a7a95
commit 7b6e55522b
9 changed files with 115 additions and 144 deletions

112
lsd/dist/Makefile vendored Normal file
View File

@ -0,0 +1,112 @@
include mk.conf
all: fhs learn
destroy:
cd "$(PREFIX)"
git clean -f -d
fhs:
# Filesystem Hierarchy Standard 3.0, 2015
# https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf
# section 3.2
mkdir -p "$(PREFIX)/bin"
mkdir -p "$(PREFIX)/boot"
mkdir -p "$(PREFIX)/dev"
mkdir -p "$(PREFIX)/etc"
mkdir -p "$(PREFIX)/lib"
mkdir -p "$(PREFIX)/media"
mkdir -p "$(PREFIX)/mnt"
mkdir -p "$(PREFIX)/opt"
mkdir -p "$(PREFIX)/run"
mkdir -p "$(PREFIX)/sbin"
mkdir -p "$(PREFIX)/srv"
mkdir -p "$(PREFIX)/tmp"
mkdir -p "$(PREFIX)/usr"
mkdir -p "$(PREFIX)/var"
# section 3.7.4
mkdir -p "$(PREFIX)/etc/opt"
# section 4.2
mkdir -p "$(PREFIX)/usr/bin"
mkdir -p "$(PREFIX)/usr/lib"
mkdir -p "$(PREFIX)/usr/local"
mkdir -p "$(PREFIX)/usr/sbin"
mkdir -p "$(PREFIX)/usr/share"
# section 4.3
mkdir -p "$(PREFIX)/usr/include"
mkdir -p "$(PREFIX)/var/spool"
mkdir -p "$(PREFIX)/var/tmp"
mkdir -p "$(PREFIX)/var/lock"
ln -s "$(PREFIX)/usr/spool" "$(PREFIX)/var/spool"
ln -s "$(PREFIX)/usr/tmp" "$(PREFIX)/var/tmp"
ln -s "$(PREFIX)/usr/spool/locks" "$(PREFIX)/var/lock"
# section 4.6
mkdir -p "$(PREFIX)/usr/lib"
# section 4.9
mkdir -p "$(PREFIX)/usr/local"
# section 4.9.2
mkdir -p "$(PREFIX)/usr/local/bin"
#mkdir -p "$(PREFIX)/usr/local/etc" # see section 4.9.3
mkdir -p "$(PREFIX)/usr/local/games"
mkdir -p "$(PREFIX)/usr/local/include"
mkdir -p "$(PREFIX)/usr/local/lib"
mkdir -p "$(PREFIX)/usr/local/man"
mkdir -p "$(PREFIX)/usr/local/sbin"
mkdir -p "$(PREFIX)/usr/local/share"
mkdir -p "$(PREFIX)/usr/local/src"
# section 4.9.3
ln -s "$(PREFIX)/usr/local/etc" "$(PREFIX)/etc/local"
# section 4.11.6
mkdir -p "$(PREFIX)/usr/share/man"
# section 4.11.7
mkdir -p "$(PREFIX)/usr/share/misc"
# section 4.12
mkdir -p "$(PREFIX)/usr/src"
# section 5.2
mkdir -p "$(PREFIX)/var/lib"
mkdir -p "$(PREFIX)/var/local"
mkdir -p "$(PREFIX)/var/log"
mkdir -p "$(PREFIX)/var/opt"
#mkdir -p "$(PREFIX)/var/run" # see section 5.13.2
# section 5.8.2
mkdir -p "$(PREFIX)/var/lib/misc"
# section 5.13.2
ln -s "$(PREFIX)/var/run" "$(PREFIX)/run"
# section 6.1.10
mkdir -p "$(PREFIX)/var/spool/cron"
learn: fhs
mkdir -p "$(PREFIX)/usr/man/man1"
cp "$(PREFIX)/dist/doc/*.1" "$(PREFIX)/usr/man/man1/"
mkdir -p "$(PREFIX)/usr/man/man7"
cp "$(PREFIX)/dist/doc/*.7" "$(PREFIX)/usr/man/man7/"
musl_fetch:
git clone "$(MUSL_UPSTREAM)" "$(PREFIX)/usr/src/musl" || true
musl: musl_fetch
cd "$(PREFIX)/usr/src/musl"
./configure --prefix="$(PREFIX)"
$(MAKE) install
unrepo:
rm -rf "$(PREFIX)/.git"
rm -f "$(PREFIX)/LICENSE"
rm -f "$(PREFIX)/README.md"
.PHONY: all destroy

5
lsd/dist/config.sh vendored
View File

@ -1,5 +0,0 @@
#!/bin/false
GCC_UPSTREAM="git://gcc.gnu.org/git/gcc.git"
MUSL_UPSTREAM="git://git.musl-libc.org/musl"
PKGSRC_UPSTREAM="https://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.xz"

4
lsd/dist/destroy vendored
View File

@ -1,4 +0,0 @@
#!/bin/false
cd "$PREFIX"
git clean -f -d

85
lsd/dist/fhs vendored
View File

@ -1,85 +0,0 @@
#!/bin/false
# Filesystem Hierarchy Standard 3.0, 2015
# https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf
# section 3.2
mkdir -p "$PREFIX/bin"
mkdir -p "$PREFIX/boot"
mkdir -p "$PREFIX/dev"
mkdir -p "$PREFIX/etc"
mkdir -p "$PREFIX/lib"
mkdir -p "$PREFIX/media"
mkdir -p "$PREFIX/mnt"
mkdir -p "$PREFIX/opt"
mkdir -p "$PREFIX/run"
mkdir -p "$PREFIX/sbin"
mkdir -p "$PREFIX/srv"
mkdir -p "$PREFIX/tmp"
mkdir -p "$PREFIX/usr"
mkdir -p "$PREFIX/var"
# section 3.7.4
mkdir -p "$PREFIX/etc/opt"
# section 4.2
mkdir -p "$PREFIX/usr/bin"
mkdir -p "$PREFIX/usr/lib"
mkdir -p "$PREFIX/usr/local"
mkdir -p "$PREFIX/usr/sbin"
mkdir -p "$PREFIX/usr/share"
# section 4.3
mkdir -p "$PREFIX/usr/include"
mkdir -p "$PREFIX/var/spool"
mkdir -p "$PREFIX/var/tmp"
mkdir -p "$PREFIX/var/lock"
ln -s "$PREFIX/usr/spool" "$PREFIX/var/spool"
ln -s "$PREFIX/usr/tmp" "$PREFIX/var/tmp"
ln -s "$PREFIX/usr/spool/locks" "$PREFIX/var/lock"
# section 4.6
mkdir -p "$PREFIX/usr/lib"
# section 4.9
mkdir -p "$PREFIX/usr/local"
# section 4.9.2
mkdir -p "$PREFIX/usr/local/bin"
#mkdir -p "$PREFIX/usr/local/etc" # see section 4.9.3
mkdir -p "$PREFIX/usr/local/games"
mkdir -p "$PREFIX/usr/local/include"
mkdir -p "$PREFIX/usr/local/lib"
mkdir -p "$PREFIX/usr/local/man"
mkdir -p "$PREFIX/usr/local/sbin"
mkdir -p "$PREFIX/usr/local/share"
mkdir -p "$PREFIX/usr/local/src"
# section 4.9.3
ln -s "$PREFIX/usr/local/etc" "$PREFIX/etc/local"
# section 4.11.6
mkdir -p "$PREFIX/usr/share/man"
# section 4.11.7
mkdir -p "$PREFIX/usr/share/misc"
# section 4.12
mkdir -p "$PREFIX/usr/src"
# section 5.2
mkdir -p "$PREFIX/var/cache"
mkdir -p "$PREFIX/var/lib"
mkdir -p "$PREFIX/var/local"
mkdir -p "$PREFIX/var/log"
mkdir -p "$PREFIX/var/opt"
#mkdir -p "$PREFIX/var/run" # see section 5.13.2
# section 5.8.2
mkdir -p "$PREFIX/var/lib/misc"
# section 5.13.2
ln -s "$PREFIX/var/run" "$PREFIX/run"
# section 6.1.10
mkdir -p "$PREFIX/var/spool/cron"

21
lsd/dist/install vendored
View File

@ -1,21 +0,0 @@
#!/bin/false
set -e
depend_on nonzero
if ! nonzero "$PREFIX"; then
printf 'Please select a $PREFIX for installation.
For example, "PREFIX=/ %s".\n' "$0" 1>&2
exit 1
fi
. "$PREFIX/dist/fhs"
. "$PREFIX/dist/sync_musl"
cd "$PREFIX/usr/src"
if [ -d gcc ]; then
cd gcc
git pull
else
fetch_upstream "$GCC_UPSTREAM"
fi

6
lsd/dist/learn vendored
View File

@ -1,6 +0,0 @@
#!/bin/false
mkdir -p "$PREFIX/usr/man/man1"
cp "$PREFIX/dist/doc/*.1" "$PREFIX/usr/man/man1/"
mkdir -p "$PREFIX/usr/man/man7"
cp "$PREFIX/dist/doc/*.7" "$PREFIX/usr/man/man7/"

3
lsd/dist/mk.conf vendored Normal file
View File

@ -0,0 +1,3 @@
GCC_UPSTREAM=git://gcc.gnu.org/git/gcc.git
MUSL_UPSTREAM=git://git.musl-libc.org/musl
PKGSRC_UPSTREAM=https://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc.tar.xz

16
lsd/dist/sync_musl vendored
View File

@ -1,16 +0,0 @@
#!/bin/false
set -e
depend_on cd
depend_on make
depend_on mkdir
cd "$PREFIX/usr/src"
if [ -d musl ]
then cd musl; git pull
else fetch_upstream "$MUSL_UPSTREAM"; fi
cd "$PREFIX/usr/src/musl"
./configure --prefix="$PREFIX"
make install

7
lsd/dist/unrepo vendored
View File

@ -1,7 +0,0 @@
#!/bin/false
depend_on rm
rm -rf "$PREFIX/.git"
rm -f "$PREFIX/LICENSE"
rm -f "$PREFIX/README.md"