summaryrefslogtreecommitdiff
path: root/gen.rc
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-04-10 02:58:52 -0700
committerMichael Forney <mforney@mforney.org>2016-04-15 02:10:08 -0700
commitdbb513d4572e2eed5e540b7b7fb7e9c8f544cb04 (patch)
tree2260140732591d6ca455e493305884c21f063b3f /gen.rc
parent5f753e71fa37011b9bf7bcec482fe4a4a904dc9e (diff)
Add some initial packages
Diffstat (limited to 'gen.rc')
-rw-r--r--gen.rc110
1 files changed, 110 insertions, 0 deletions
diff --git a/gen.rc b/gen.rc
new file mode 100644
index 00000000..6617689f
--- /dev/null
+++ b/gen.rc
@@ -0,0 +1,110 @@
+fn stamp {
+ build '$outdir/stamp' stamp '$outdir'/$*
+}
+
+fn cflags {
+ set cflags '$cflags' $*
+}
+
+fn cc {
+ src=$1 obj=$src.o {
+ shift
+ if(! ~ $src '$'*) {
+ src='$srcdir'/src/$src
+ obj='$outdir'/$obj
+ }
+ build $obj cc $src $*
+ }
+}
+
+fn link {
+ out='$outdir'/$1 objs=() {
+ shift
+ for(obj in $*) {
+ if(! ~ $obj '$'*) obj='$outdir'/$obj
+ objs=( $objs $obj )
+ }
+ build $out link $objs
+ }
+}
+
+fn ar {
+ out='$outdir'/$1 objs=() {
+ shift
+ for(obj in $*) {
+ if(! ~ $obj '$'*) obj='$outdir'/$obj
+ objs=( $objs $obj )
+ }
+ build $out ar $objs
+ }
+}
+
+fn static_lib {
+ out=$1 {
+ shift
+ for(src) cc $src
+ ar $out $*.o
+ }
+}
+
+fn exe {
+ out=$1 objs=() {
+ shift
+ for(src) {
+ if(~ $src *.c) {
+ cc $src
+ obj=$src.o
+ }
+ if not obj=$src
+ objs=( $objs $obj )
+ }
+ link $out $objs
+ }
+}
+
+fn file {
+ out='$hash_root'/$1
+ ninja_vars='args = 100'$3' '$1 build $out githash $2 '| $repo.stamp'
+ root_inputs=( $root_inputs $out )
+
+ if(! ~ $3 755 644) root_perms=( $root_perms 100$3' '$1 )
+ true
+}
+
+fn dir {
+ root_perms=( $root_perms '010'$2' '$1 )
+}
+
+fn sym {
+ out='$hash_root'/$1
+ ninja_vars='args = 120000 '$1' '$2 build $out githash '| $repo.stamp'
+ root_inputs=( $root_inputs $out )
+}
+
+root_inputs=()
+root_perms=()
+
+packages=(\
+ cparser\
+ file\
+ libfirm\
+ loksh\
+ plan9port\
+ sbase\
+ skeleton\
+ tz\
+ ubase\
+ zlib\
+)
+
+set hash_root '$repo.hash'
+build '$repo.stamp' gitinit
+
+for(pkg in $packages) subgen core/$pkg
+
+printf '%s\n' $root_perms >$outdir/root_perms.txt
+file .perms '$outdir'/root_perms.txt 644
+
+build '$outdir'/root_tree.txt gittree $root_inputs '| $repo.stamp'
+
+for(pkg in $packages) subninja core/$pkg/local.ninja