Move the pkgs.mk creation to it's own sh file

This commit is contained in:
Daniel Bainton 2014-03-09 20:42:56 +00:00
parent 3c2c0d24e1
commit 8aa7ece468
3 changed files with 30 additions and 21 deletions

20
mkfile
View File

@ -19,25 +19,11 @@ fetchpkgs = ${pkgs:%=%-fetch}
fetch-all fetch-world:VQ: ${fetchpkgs}
# generate a pkgs.mk file with the targets for all packages in pkgs/
`{ mkdir -p src }
`{ mkdir -p .cache }
`{ printf '# auto-generated file, do not edit\n' > pkgs.mk }
`{ cd pkgs && for pkg in *; do \
fdeps=`$top/stuff/get-fetch-deps $pkg` &&\
cat $pkg/build ../stuff/fetch-pkg.mk |\
sed -e "s,^build:,$pkg:QP./stuff/cmp-pkgs: $pkg-fetch pkgs/$pkg/build," |\
sed -e "s,^fetch-target:,$pkg-fetch:QP./stuff/cmp-fetch: $fdeps," |\
sed -e "s,^v=,_${pkg}_v=," |\
sed -e "s,^pkgdir=,_${pkg}_pkgdir=$top/pkgs/$pkg," |\
sed -e "s,\$v,\${_${pkg}_v},g" |\
sed -e "s,\$pkgdir,\${_${pkg}_pkgdir},g" |\
sed -e "s,\$url,\${_${pkg}_url},g" |\
sed -e "s, url=, _${pkg}_url=,g" |\
sed -e "s,\$git,\${_${pkg}_git},g" |\
sed -e "s,^git=,_${pkg}_git=," |\
sed -e "s,^url=,_${pkg}_url=," >> ../pkgs.mk; \
echo >> ../pkgs.mk; done }
# generate a pkgs.mk file with the targets for all packages in pkgs/
`{ stuff/generate-pkgs.sh pkgs > pkgs.mk }
<pkgs.mk

27
stuff/generate-pkgs.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
f=`pwd`/`dirname $0`
p=$1
printf '# auto-generated file, do not edit\n'
cd $p
for pkg in *; do
deps=$(cat $pkg/build | sed -n '1{x;d};${H;x;s/\\\n\t/ /g;p};{H}' | grep ^build: | cut -d ':' -f 2-)
fdeps=`for d in $deps; do echo -n "$d-fetch "; done`
cat $pkg/build $f/fetch-pkg.mk |
sed -e "s,^build:,$pkg:QP${f}/cmp-pkgs: $pkg-fetch `pwd`/$pkg/build," \
-e "s,^fetch-target:,$pkg-fetch:QP${f}/cmp-fetch: $fdeps," \
-e "s,^v=,_${pkg}_v=," \
-e "s,^pkgdir=,_${pkg}_pkgdir=`pwd`/$pkg," \
-e "s,\$v,\${_${pkg}_v},g" \
-e "s,\$pkgdir,\${_${pkg}_pkgdir},g" \
-e "s,\$url,\${_${pkg}_url},g" \
-e "s, url=, _${pkg}_url=,g" \
-e "s,\$git,\${_${pkg}_git},g" \
-e "s,^git=,_${pkg}_git=," \
-e "s,^url=,_${pkg}_url=,"
echo
done

View File

@ -1,4 +0,0 @@
#!/bin/sh
deps=$(cat $1/build | sed -n '1{x;d};${H;x;s/\\\n\t/ /g;p};{H}' | grep ^build: | cut -d ':' -f 2-)
for d in $deps; do echo -n "$d-fetch "; done