pkg: relocate package files

This commit is contained in:
Thomas Hobson 2021-03-13 19:50:05 +13:00
parent 5e400cb782
commit 98782b0a17
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
2 changed files with 12 additions and 10 deletions

View File

@ -8,11 +8,11 @@ In the example of NodeJS, we would call this `node`, after the main binary.
## Creating new languages ## Creating new languages
See [deno-1.7.5/](deno-1.7.5/) or any other directory for examples. See [deno/1.7.5/](deno/1.7.5/) or any other directory for examples.
1. Create a new branch on your fork of engineer-man/piston 1. Create a new branch on your fork of engineer-man/piston
2. Create a directory named `[language]-[version]`. See Naming Languages for how to determine the name for your language 2. Create directories named `[language]/[version]`. See Naming Languages for how to determine the name for your language
3. Create a file named `build.sh`, adding a shebang for bash `#!/bin/bash` on the first line. 3. Create a file named `build.sh`, adding a shebang for bash `#!/bin/bash` on the first line.
In this file put any steps to compile the specified langauge. In this file put any steps to compile the specified langauge.

View File

@ -1,4 +1,4 @@
PACKAGES=$(shell find * -maxdepth 0 -type d) PACKAGES=$(subst /,-,$(shell find * -maxdepth 1 -mindepth 1 -type d))
BUILD_PLATFORM=$(or ${PLATFORM},baremetal-$(shell grep -oP "^ID=\K.+" /etc/os-release)) BUILD_PLATFORM=$(or ${PLATFORM},baremetal-$(shell grep -oP "^ID=\K.+" /etc/os-release))
help: help:
@ -9,14 +9,16 @@ help:
build build-all: $(addsuffix .pkg.tar.gz, ${PACKAGES}) build build-all: $(addsuffix .pkg.tar.gz, ${PACKAGES})
%.pkg.tar.gz: %/ %/pkg-info.json
cd $< && chmod +x ./build.sh && ./build.sh define PKG_RULE
rm -f $@ $(1).pkg.tar.gz: $(subst -,/,$(1))/ $(subst -,/,$(1))/pkg-info.json
tar czf $@ $* --transform='s|$*||' cd $$< && chmod +x ./build.sh && ./build.sh
rm -f $$@
tar czf $$@ $$< --transform='s|$$<||'
endef
$(foreach pkg,$(PACKAGES),$(eval $(call PKG_RULE,$(pkg))))
%/pkg-info.json: %/metadata.json %/pkg-info.json: %/metadata.json
jq '.build_platform="${BUILD_PLATFORM}"' $< > $@ jq '.build_platform="${BUILD_PLATFORM}"' $< > $@