Compare commits
4 Commits
0242c99388
...
d8239c2703
Author | SHA1 | Date |
---|---|---|
Thomas Hobson | d8239c2703 | |
Thomas Hobson | e83da209be | |
Thomas Hobson | 13d5191d77 | |
Thomas Hobson | 170dbc419e |
|
@ -0,0 +1 @@
|
|||
*/*/
|
|
@ -0,0 +1,43 @@
|
|||
# Contributing packages to the Piston Repository
|
||||
|
||||
## Creating new languages
|
||||
|
||||
1. Create a new branch on your fork of engineer-man/piston.
|
||||
2. Create a directory (all lowercase) with the name of the language.
|
||||
3. Create a Makefile containing the following, filling in the fields marked with %
|
||||
Versions can be a list of version numbers, separated by spaces.
|
||||
Quotes are not required.
|
||||
```makefile
|
||||
LANGUAGE=%
|
||||
VERSIONS=%
|
||||
|
||||
include ../secondary.mk
|
||||
```
|
||||
4. Create a `base.mk` file, this is the file which will hold the correct targets to make each build.
|
||||
It should download any sources it requires uring `curl` and use as much version templating as possible.
|
||||
You should include 3 variables: `AUTHOR`, `DEPS` and `COMPILED`.
|
||||
|
||||
`AUTHOR` is simply your name, and email address formatted as `Your Name <your@email>`.
|
||||
`DEPS` is a list (separated by spaces) of packages which are required with this one for it to work correctly.
|
||||
This is mainly used in the case of golfing languages, which use other languages (e.g. python and eilxar) to interpret them. Give a package name and a SemVer selector (e.g. `python==3.x.x` for any python3 build).
|
||||
`COMPILED` is simply a true or false field indicating if the package contains a `compile` target (see below).
|
||||
|
||||
You should also include 3/4 targets: `run`, `${NAME}-${VERSION}`, `${NAME}-${VERSION}/environment` and optionally `compile` (only if the language is a compiled language, e.g. cpp/c)
|
||||
|
||||
The `run` file is one which is passed the main source file (first argument) and the arguments for the process (remaining arguments). STDIN data is also piped in. Generate this by using either a `cat` or an `echo` statement(s) and piping them into `$@` (it means the target name in Makefiles). You have to escape `$` symbols with `$$`.
|
||||
|
||||
The `${NAME}-${VERSION}` directory should contain all the binaries required to run the language.
|
||||
You should use this target to compile all the sources, and installing them into the `$@` location
|
||||
|
||||
`${NAME}-${VERSION}/environment` should contain a bunch of environment variables which will be passed into the `run` and `compile` scripts of not only this language, but any which depend on it.
|
||||
If your package depends on any others, their environment variables are automatically sourced, then your packages ones are sourced after.
|
||||
|
||||
The `compile` file contains instructions to compile source files into a final binary which should be run by `run`. It's first argument is the main source file, with other source files being provided as other arguments. STDIN is left blank, but both STDOUT and STDERR are returned. The `run` file will be skipped if this file returns a non-zero error code.
|
||||
|
||||
5. Commit your new package with the following message format: `pkg([language name] [version(s)]): [description including versions]`
|
||||
|
||||
Examples:
|
||||
* `pkg(python 3.9.1): new version`
|
||||
* `pkg(python 3.9.1 2.7.1): refactor`
|
||||
|
||||
6. Create a pull request, referencing the issue number of the language
|
|
@ -1 +0,0 @@
|
|||
*/
|
|
@ -1,24 +1,4 @@
|
|||
LANGUAGE=python
|
||||
VERSIONS=2.7.1 3.9.1
|
||||
|
||||
.PHONY: build sign cleanup clean
|
||||
build: $(patsubst %,%/${LANGUAGE}-%.pkg.tar.gz,${VERSIONS})
|
||||
sign: $(patsubst %,%/${LANGUAGE}-%.pkg.tar.gz.asc,${VERSIONS})
|
||||
clean:
|
||||
rm -rf ${VERSIONS}
|
||||
cleanup: $(patsubst %,%/cleanup,${VERSIONS})
|
||||
|
||||
|
||||
%/cleanup: %/Makefile
|
||||
$(MAKE) -C $(shell dirname $<) cleanup
|
||||
rm $(shell dirname $<)/Makefile
|
||||
|
||||
%/${LANGUAGE}-%.pkg.tar.gz.asc: %/Makefile
|
||||
$(MAKE) -C $(shell dirname $<) sign
|
||||
%/${LANGUAGE}-%.pkg.tar.gz: %/Makefile
|
||||
$(MAKE) -C $(shell dirname $<)
|
||||
|
||||
%/Makefile:
|
||||
@mkdir -p $(shell dirname $@)
|
||||
@echo 'VERSION=$(patsubst %/Makefile,%,$@)' > $@
|
||||
@echo 'include ../base.mk' >> $@
|
||||
include ../secondary.mk
|
|
@ -1,7 +1,5 @@
|
|||
NAME=python
|
||||
AUTHOR=Thomas Hobson <thomas@hexf.me>
|
||||
DEPS=
|
||||
#VERSION=
|
||||
COMPILED=false
|
||||
|
||||
include ../../common.mk
|
||||
|
@ -9,13 +7,13 @@ include ../../common.mk
|
|||
run:
|
||||
echo 'python$(shell grep -oP "\d+.\d+"<<<${VERSION}) $$*' > run
|
||||
|
||||
python-${VERSION}/environment:
|
||||
${NAME}-${VERSION}/environment:
|
||||
echo 'export PATH=$$PWD/${NAME}-${VERSION}/bin:$$PATH' > $@
|
||||
|
||||
python-${VERSION}/: Python-${VERSION}/
|
||||
${NAME}-${VERSION}/: Python-${VERSION}/
|
||||
cd $< && ./configure --prefix /
|
||||
$(MAKE) -j$(or ${MAKE_JOBS},64) -C $<
|
||||
DESTDIR=../$@ $(MAKE) -j$(or ${MAKE_JOBS},64) -C $< altinstall || true
|
||||
|
||||
Python-${VERSION}.tgz:
|
||||
${NAME}-${VERSION}.tgz:
|
||||
curl "https://www.python.org/ftp/python/${VERSION}/$@" -o $@
|
|
@ -0,0 +1,22 @@
|
|||
.PHONY: build sign cleanup clean
|
||||
build: $(patsubst %,%/${LANGUAGE}-%.pkg.tar.gz,${VERSIONS})
|
||||
sign: $(patsubst %,%/${LANGUAGE}-%.pkg.tar.gz.asc,${VERSIONS})
|
||||
clean:
|
||||
rm -rf ${VERSIONS}
|
||||
cleanup: $(patsubst %,%/cleanup,${VERSIONS})
|
||||
|
||||
|
||||
%/cleanup: %/Makefile
|
||||
$(MAKE) -C $(shell dirname $<) cleanup
|
||||
rm $(shell dirname $<)/Makefile
|
||||
|
||||
%/${LANGUAGE}-%.pkg.tar.gz.asc: %/Makefile
|
||||
$(MAKE) -C $(shell dirname $<) sign
|
||||
%/${LANGUAGE}-%.pkg.tar.gz: %/Makefile
|
||||
$(MAKE) -C $(shell dirname $<)
|
||||
|
||||
%/Makefile:
|
||||
@mkdir -p $(shell dirname $@)
|
||||
@echo 'VERSION=$(patsubst %/Makefile,%,$@)' > $@
|
||||
@echo 'NAME=${LANGUAGE}' > $@
|
||||
@echo 'include ../base.mk' >> $@
|
Loading…
Reference in New Issue