Compare commits

..

15 commits

Author SHA1 Message Date
Thomas Hobson
9706f2fab8
pkg(gitignore): add pkg-info.json to gitignore 2021-03-06 01:39:05 +13:00
Thomas Hobson
9d61aba24e
pkg(python-3.9.1): remove temp file 2021-03-06 01:38:47 +13:00
Thomas Hobson
083793ee43
pkg(php-8.0.2): switch to new build system 2021-03-06 01:35:35 +13:00
Thomas Hobson
a0e7d1b736
pkg(node-15.10.0): switch to new build system 2021-03-06 01:23:51 +13:00
Thomas Hobson
d36c23a5bf
pkg(python-3.9.1): switch to new build system 2021-03-06 01:12:19 +13:00
Thomas Hobson
f592bbb971
pkg(mono-6.12.0): use many core to build 2021-03-06 01:10:44 +13:00
Thomas Hobson
ebe869aefa
pkg(contributing): update commit format 2021-03-06 01:10:18 +13:00
Thomas Hobson
51666c2d5a
pkg(mono-6.12.0): change to new build system 2021-03-06 01:06:00 +13:00
Thomas Hobson
66fd00e410
repo: add unzip to build tools 2021-03-06 00:45:14 +13:00
Thomas Hobson
7ec714723b
cli: fix execute not working 2021-03-06 00:44:35 +13:00
Thomas Hobson
21af84aaab
pkg(deno-1.7.5): Migrate to new version 2021-03-06 00:44:25 +13:00
Thomas Hobson
49c761311b
api: fix bugs introduced in code cleanup 2021-03-06 00:31:51 +13:00
Thomas Hobson
4732681864
pkg(contributing): update guide for new format 2021-03-06 00:27:24 +13:00
Thomas Hobson
34fbda0772
repo: use new build system 2021-03-05 22:16:42 +13:00
Thomas Hobson
eba1d3abcd
pkg: new build system 2021-03-05 22:16:17 +13:00
42 changed files with 206 additions and 307 deletions

View file

@ -129,11 +129,11 @@ function make_default_config(){
content.concat(option.desc.split('\n').map(x=>`# ${x}`));
if(option.options)
content.append('# Options: ' + option.options.join(', '));
content.push('# Options: ' + option.options.join(', '));
content.append(`${option.key}: ${option.default}`);
content.append(''); // New line between
content.push(`${option.key}: ${option.default}`);
content.push(''); // New line between
});
return content.join('\n');

View file

@ -30,12 +30,12 @@ module.exports = {
async load(data_file){
if(fss.exists_sync(data_file)){
logger.info('Loading state from file');
const content = await fs.read_file(data_file);
const obj = JSON.parse(content.toString(), reviver);
var content = await fs.read_file(data_file);
var obj = JSON.parse(content.toString(), reviver);
[...obj.keys()].forEach(k => state.set(k, obj.get(k)));
}else{
logger.info('Creating new state file');
state.set('repositories', new Map());
}
},
async save(data_file){

View file

@ -55,7 +55,7 @@ exports.handler = async function(argv){
version: argv['language-version'],
files: files,
main: argv.file,
arsg: argv.args,
args: argv.args,
stdin,
compile_timeout: argv.ct,
run_timeout: argv.rt

5
packages/.gitignore vendored
View file

@ -1,3 +1,4 @@
build/
*/build
*/output
*.pkg.tar.gz
*.tf
*/pkg-info.json

View file

@ -1,66 +1,33 @@
# Contributing packages to the Piston Repository
## Naming Lanaguages
## Naming Languages
Some languages have multiple different wide-spread interpreters (node/deno for example) which need to be accounted for.
If the given language has multiple incompatiable interpreters (e.g. deno/node/v8), these should be named as `[language]-[interpreter]`.
For cases where the language has many compatable interpreters (e.g. gcc/llvm), pick one and name it `[language]`.
For languages with only 1 wide-spread interpreter (e.g. Kotlin), name it `[language]`
## File Naming Rules
Different versions of interpreters require different steps to build, and in this case they should be given 2 different files, but keep the same language name.
Use `[language-name].mk` (see naming languages) for languages with a common build script.
When the build steps become obsolete, create a new file named `[language-name]-[version].mk`, with the first version where the new build steps were required.
Languages should be named after their interpreters, and the command line binaries you call.
For example, the full name of the standard python interpreter is `CPython`, however we would name it `python`, after the main binary which it provides.
In the example of NodeJS, we would call this `node`, after the main binary.
## Creating new languages
See [python.mk](python.mk) or any other `.mk` file (except `common.mk`) for an example.
Please note that this is a regular Makefile, with a few extra varibles added by `common.mk`, any additional variables not listed here can be located in there.
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
2. Create a new file for your language, following the naming rules as listed above
2. Create a directory named `[language]-[version]`. See Naming Languages for how to determine the name for your language
3. Add `NAME=[language name]` to this file, replacing `[language name]` with the language name all in lowercase, removing any punctuation and numbers (e.g. 05AB1E becomes osabie).
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.
It is allowed to use 2 directories, `output` and `build`, the former which contains files which should get packaged into the final output, and the latter containing intermediate build files.
4. Add `AUTHOR=[author]` to this file, replacing `[author]` with your name and email address in the format `Full Name <your@email.address>` (standard git format).
4. Create a file named `run`, containing bash script to run the interpreter.
The first argument given to this script (`$1`) is the name of the main file, with the remaining ones as program arguments.
STDIN is piped directly into the run file, and as such nothing special is required to deal with STDIN, except leaving it open.
5. Add `DEPENDENCIES=[dependencies list]` to this file, replacing `[dependencies list]` with a list of dependencies, seperated by spaces in the format `[language]==[version]`. If there are none, simply leave this as `DEPENDENCIES=`
5. Create a file named `compile`, containing bash script to compile sources into binaries. This is only required if the language requires a compling stage.
The first argument is always the main file, followed the names of the other files as additional arguements. If the language does not require a compile stage, don't create a compile file.
6. Add `COMPILED=[true/false]` to this file, set this to true if the language requires the compile stage, and false if it only requires run.
6. Create a file named `environment`, containing `export` statements which edit the environment variables accordingly. The `$PWD` variable should be used, and is set inside the `output` directory, but when running on the target system.
7. Add `VERSIONS=[version list]` to this file, replacing `[version list]` with a list of [SemVer](https://semver.org/) compilant version numbers for the language which this build file can build. This value will be passed in as `${VERSION}` for you to access
8. Add `include common.mk`, to include all the common Makefile rules and variables.
9. Create the target for the run file by adding `${RUN_FILE}:`, followed by steps on new lines, indented by a tab (`\t`) to create a bash script, which is run for every job (`/execute` endpoint) for this language and returns on STDOUT/STDERR the output of the run.
The script is expected to take in the first argument (`$1`) as the main code file, with subsequent arguments being passed in from the execute endpoint.
The script is passed STDIN as specified in the job, and expects output on STDOUT/STDERR. It should also pass through the exit code from the interpreter.
It is recommended to use `echo` statements, redirecting output to `$@` (a special Makefile variable expanding to the target file, in this case RUN_FILE).
Make sure to escape any `$` with `$$`, as `$` will expand make variables.
10. (optional, only use if language requires compliation)
Create the target for the compile file by adding `${COMPILE_FILE}:`, followed by steps on new lines, indented by a tab (`\t`) to create a bash script, which is run for every job (`/execute` endpoint) for this language, if it requires compilation.
This script is expected to take all code files in as arguements, and output binary files. STDERR/STDOUT are captured and passed out, along with error code. The job STDIN and args are not passed in to this script.
This script should compile source code into a binary, and has a seperate time limit from run, and thus should split the stages.
Follow all priciples from step 9, using echo statements and escaping `$`.
11. Create the target for the environment file by adding `${ENV_FILE}:`, followed by steps on new lines, indented by a tab (`\t`) to create a bash script, which modifies environment variables exactly how you would a `.profile` or `.bashrc` file. Note that this file is only run at install time, and thus cannot dynamicly adjust to the arguements passed into it.
The environment file is also appended with all dependencies before being cached.
You should add in the path to any binaries. The current working directory for the script is contained within the `${BIN_DIR}` folder.
12. Create the target for the binaries by adding `${BIN_DIR}:`, followed by steps on new lines, indented by a tab (`\t`) which will download sources, compile and output binaries in to the `${BIN_DIR}` (`$@`)
13. Locally test your Makefile builds with `make build-[language]-[version]`.
If everything went well, you should now have a `[language]-[version].pkg.tar.gz` file sitting in the root.
If not, read through your error logs, and if in doubt ask for help in #emkc-felix-piston in Discord.
14. Create a source file for the app, which outputs `OK`, naming the file `[language-name].test`
For example, `mono` would have a file named `csharp-mono.test` containing:
7. Create a test script starting with test, with the file extension of the language. This script should simply output the phrase `OK`. For example, for mono we would create `test.cs` with the content:
```cs
using System;
@ -73,7 +40,22 @@ public class Test
}
```
15. Commit your changes, using message format of `pkg([language]): Added [language] [version]`
Any additional commits regarding this package should start with `pkg([language]): `
8. Create a `metadata.json` file which contains metadata about the language and interpreter. This simply contains the language name, as in the folder name, the version as in the folder name, the author's name and email address, aliases that can be used to call this package, and finally a dependencies map.
The dependencies map contains the keys as language names, and the values as semver selectors for packages.
```json
{
"language": "deno",
"version": "1.7.5",
"author": "Thomas Hobson <thomas@hexf.me>",
"dependencies": {},
"aliases": ["deno-ts", "deno-js"]
}
```
16. Create a pull request (currently to v3), referencing an Issue number (if there is one associated).
9. Test your package builds with running `make [language]-[version].pkg.tar.gz`.
If it all goes to plan, you should have a file named `[language]-[version].pkg.tar.gz`, in this case your good to go!
10. Commit your changes, using message format of `pkg([language]-[version]): Added [language] [version]`
Any additional commits regarding this package should start with `pkg([language]-[version]): `
11. Create a pull request (currently to v3 branch), referencing an Issue number (if there is one associated).

View file

@ -1,40 +1,29 @@
# Wraps all other Makefiles
PACKAGES=$(shell find * -maxdepth 0 -type d)
BUILD_PLATFORM=$(or ${PLATFORM},baremetal-$(shell grep -oP "^ID=\K.+" /etc/os-release))
# Variables
PKG_FILES=$(filter-out common.mk,$(wildcard *.mk))
PKG_SLUGS=$(foreach pkg, ${PKG_FILES}, $(addprefix $(shell make -f ${pkg} name VERSION=UNKNOWN)-, $(shell make -f ${pkg} versions VERSION=UNKNOWN)))
help:
@echo "You probably don't want to build all package"
@echo "If you do run $`make build-all$`"
@echo
@echo "Run $`make [language]-[version].pkg.tar.gz$` to build a specific language"
# Functions
CALL_MAKE=$(shell make -f $1 $2 VERSION=UNKNOWN)
build build-all: $(addsuffix .pkg.tar.gz, ${PACKAGES})
clean clean-all: $(addprefix clean-, ${PACKAGES})
define pkg_info
$(eval PKG_SLUG=$(patsubst $1-%,%,$2))
$(eval PKG_VERSION=$(lastword $(subst -, ,${PKG_SLUG})))
$(eval PKG_NAME=$(patsubst %-${PKG_VERSION},%,${PKG_SLUG}))
$(eval PKG_FILE=$(shell grep '^VERSIONS\s*=.*${PKG_VERSION}' $(shell grep "NAME\s*=\s*${PKG_NAME}" ${PKG_FILES} -l) -l))
endef
clean-%: %/
rm -rf $</build $</output
%.pkg.tar.gz: %/output %/run %/environment %/pkg-info.json
rm -f $@
tar czf $@ -C $* $(patsubst $*/%,%,output run environment pkg-info.json $(shell find $*/compile)) --transform='s|output|$*|;s|environment|$*/environment|'
%/pkg-info.json: %/metadata.json
jq '.build_platform="${BUILD_PLATFORM}"' $< > $@
%/output: %/ %/build.sh
cd $< && chmod +x ./build.sh && ./build.sh
define per-lang
build-$(call CALL_MAKE, $1, name):: $$(addprefix build-$(call CALL_MAKE, $1, name)-, $$(call CALL_MAKE, $1, versions))
clean-$(call CALL_MAKE, $1, name):: $$(addprefix clean-$(call CALL_MAKE, $1, name)-, $$(call CALL_MAKE, $1, versions))
endef
# Targets
$(foreach e,${PKG_FILES}, $(eval $(call per-lang,${e})))
build build-all: $(foreach pkg, ${PKG_FILES}, build-$(call CALL_MAKE, ${pkg}, name))
$(addprefix build-, ${PKG_SLUGS}):
$(call pkg_info,build,$@)
$(MAKE) -f ${PKG_FILE} VERSION=${PKG_VERSION} build
clean clean-all: $(foreach pkg, ${PKG_FILES}, clean-$(call CALL_MAKE, ${pkg}, name))
rm -rf build/
$(addprefix clean-, ${PKG_SLUGS}):
$(call pkg_info,clean,$@)
$(MAKE) -f ${PKG_FILE} VERSION=${PKG_VERSION} clean

View file

@ -1,79 +0,0 @@
# Variables
PKG_SLUG=${NAME}-${VERSION}
BUILD_DIR=build/${PKG_SLUG}/
BIN_DIR=${BUILD_DIR}${PKG_SLUG}/
RUN_FILE=${BUILD_DIR}run
COMPILE_FILE=${BUILD_DIR}compile
ENV_FILE=${BIN_DIR}environment
INFO_FILE=${BUILD_DIR}pkg-info.json
PREFIX=/piston/packages/${NAME}/${VERSION}/${PKG_SLUG}
PKG_FILE=${PKG_SLUG}.pkg.tar.gz
VERSION_MINOR=$(shell grep -oP "\d+.\d+"<<<${VERSION})
VERSION_MAJOR=$(shell grep -oP "\d+"<<<${VERSION})
PKG_TARGETS=${BIN_DIR} ${ENV_FILE} ${RUN_FILE} ${INFO_FILE}
# Command Targets
.PHONY: catch versions name build clean
catch:
# Catch manual calling
# This is done to make sure people don't call without ${VERSION}, which can cause problems
@echo "Don't directly call individual scripts, instead call the common Makefile"
@exit 1
versions:
@echo ${VERSIONS}
name:
@echo ${NAME}
.NOTPARALLEL: build
build: ${BUILD_DIR} ${PKG_FILE} ${PKG_SLUG}.tf
clean:
rm -rf ${BUILD_DIR}
rm -f ${PKG_FILE}
rm -f ${PKG_SLUG}.tf
# mkdir
${BUILD_DIR}:
mkdir -p ${BUILD_DIR}
# Generated files
ifeq (${COMPILED}, true)
${PKG_FILE}: ${PKG_TARGETS} ${COMPILE_FILE}
endif
${PKG_FILE}: ${PKG_TARGETS}
tar -czC ${BUILD_DIR} -f $@ ${patsubst ${BUILD_DIR}%,%,$?}
$(patsubst %.json,%.jq,${INFO_FILE}):
echo '.language="${NAME}"' > $@
echo '.version="${VERSION}"' >> $@
echo '.author="${AUTHOR}"' >> $@
echo '.dependencies={}' >> $@
echo '.build_platform="$(or ${PLATFORM}, baremetal-$(shell grep -oP "^ID=\K\w+" /etc/os-release ))"' >> $@
$(foreach dep, ${DEPENDENCIES}, echo '.dependencies.$(word 1,$(subst =, ,${dep}))="$(word 2,$(subst =, ,${dep}))"' >> $@)
${PKG_SLUG}.tf:
cp ${NAME}.test $@
# Helpers
%/: %.tar.gz
mkdir -p $@
tar xzf $< --strip-components=1 -C $@
%/: %.tar.xz
mkdir -p $@
tar xf $< --strip-components=1 -C $@
%/: %.zip
mkdir -p $@
unzip $< -d $@
%.json: %.jq
jq '$(shell tr '\n' '|' < $<).' <<< "{}" > $@

View file

@ -1,34 +0,0 @@
NAME=csharp-mono
AUTHOR=Thomas Hobson <thomas@hexf.me>
DEPENDENCIES=
COMPILED=true
VERSIONS=6.12.0
include common.mk
VERSION_6.12.0_FULL=6.12.0.122
VERSION_FULL=${VERSION_${VERSION}_FULL}
${RUN_FILE}:
echo 'CODE=$${1/cs/exe}' > $@
echo 'shift' >> $@
echo 'mono $$CODE $$*' >> $@
${COMPILE_FILE}:
echo 'csc $$*' > $@
${ENV_FILE}:
echo 'export PATH=$$PWD/bin:$$PATH' > $@
${BIN_DIR}: ${BUILD_DIR}mono-${VERSION_FULL}/
$(eval TMP_DIR=${PWD}/${BUILD_DIR}tmpout/)
cd $< && ./configure --prefix ${PREFIX}
$(MAKE) -j64 -C $<
DESTDIR=${TMP_DIR} $(MAKE) -C $< install
mv ${TMP_DIR}${PREFIX} ${BIN_DIR} && rm -r ${TMP_DIR}
${BUILD_DIR}mono-${VERSION_FULL}.tar.xz:
curl "https://download.mono-project.com/sources/mono/mono-${VERSION_FULL}.tar.xz" -o $@

11
packages/deno-1.7.5/build.sh vendored Executable file
View file

@ -0,0 +1,11 @@
mkdir -p output build
cd build
curl -L https://github.com/denoland/deno/releases/download/v1.7.5/deno-x86_64-unknown-linux-gnu.zip --output deno.zip
unzip deno.zip
cd ..
mv build/deno output
chmod +x output/deno

1
packages/deno-1.7.5/environment vendored Normal file
View file

@ -0,0 +1 @@
export PATH=$PWD:$PATH

7
packages/deno-1.7.5/metadata.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"language": "deno",
"version": "1.7.5",
"author": "Thomas Hobson <thomas@hexf.me>",
"dependencies": {},
"aliases": ["deno-ts", "deno-js"]
}

2
packages/deno-1.7.5/run vendored Normal file
View file

@ -0,0 +1,2 @@
#!/bin/bash
DENO_DIR=$PWD deno run $*

View file

@ -1,22 +0,0 @@
NAME=deno
AUTHOR=Thomas Hobson <thomas@hexf.me>
DEPENDENCIES=
COMPILED=false
VERSIONS=1.7.5
include common.mk
${RUN_FILE}:
echo 'deno run $$*' > $@
${ENV_FILE}:
echo 'export PATH=$$PWD:$$PATH' > $@
${BIN_DIR}: ${BUILD_DIR}deno-x86_64-unknown-linux-gnu/
mkdir -p $@
mv $</deno $@
chmod +x $@/deno
${BUILD_DIR}deno-x86_64-unknown-linux-gnu.zip:
curl -L "https://github.com/denoland/deno/releases/download/v${VERSION}/deno-x86_64-unknown-linux-gnu.zip" -o $@

View file

@ -1,22 +0,0 @@
NAME=javascript-node
AUTHOR=Martin Kos <martinkos007@gmail.com>
DEPENDENCIES=
COMPILED=false
VERSIONS=14.16.0 15.10.0
include common.mk
${RUN_FILE}:
echo 'node $$*' > $@
${ENV_FILE}:
echo 'export PATH=$$PWD/bin:$$PATH' > $@
${BIN_DIR}: ${BUILD_DIR}node-${VERSION}-sources/
mkdir -p $@
mv $<bin/node $@
chmod +x $@/node
${BUILD_DIR}node-${VERSION}-sources.tar.xz:
curl "https://nodejs.org/dist/v${VERSION}/node-v${VERSION}-linux-x64.tar.xz" -o $@

View file

@ -1 +0,0 @@
console.log("OK")

16
packages/mono-6.12.0/build.sh vendored Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
mkdir -p build/tmp build/mono
cd build
curl "https://download.mono-project.com/sources/mono/mono-6.12.0.122.tar.xz" -o mono.tar.xz
tar xf mono.tar.xz --strip-components=1 -C mono
cd mono
./configure --prefix /piston/packages/mono/6.12.0/mono-6.12.0
make -j$(nproc)
DESTDIR=build/tmp make install -j$(nproc)
mv build/tmp/piston/packages/mono/6.12.0/mono-6.12.0 ../../output

3
packages/mono-6.12.0/compile vendored Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
csc $*

1
packages/mono-6.12.0/environment vendored Normal file
View file

@ -0,0 +1 @@
export PATH=$PWD:$PATH

7
packages/mono-6.12.0/metadata.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"language": "mono",
"version": "6.12.0",
"author": "Thomas Hobson <thomas@hexf.me>",
"dependencies": {},
"aliases": ["csharp", "cs"]
}

5
packages/mono-6.12.0/run vendored Normal file
View file

@ -0,0 +1,5 @@
#!/bin/bash
CODE=${1/cs/exe}
shift
mono $CODE $*

11
packages/node-15.10.0/build.sh vendored Executable file
View file

@ -0,0 +1,11 @@
#!/bin/bash
mkdir -p build output
cd build
curl "https://nodejs.org/dist/v15.10.0/node-v15.10.0-linux-x64.tar.xz" -o node.tar.xz
tar xf node.tar.xz --strip-components=1
cd ..
mv build/bin/node output

1
packages/node-15.10.0/environment vendored Normal file
View file

@ -0,0 +1 @@
export PATH=$PWD/bin:$PATH

7
packages/node-15.10.0/metadata.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"language": "node",
"version": "15.10.0",
"author": "Martin Kos <martinkos007@gmail.com>",
"dependencies": {},
"aliases": ["node-javascript", "node-js", "javascript", "js"]
}

3
packages/node-15.10.0/run vendored Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
node $*

1
packages/node-15.10.0/test.js vendored Normal file
View file

@ -0,0 +1 @@
console.log("OK")

20
packages/php-8.0.2/build.sh vendored Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
mkdir -p build/tmp build/php
cd build
curl "https://www.php.net/distributions/php-8.0.2.tar.gz" -o php.tar.gz
tar xzf php.tar.gz --strip-components=1 -C php
cd php
./configure --prefix /piston/packages/php/8.0.2/php-8.0.2
make -j$(nproc)
INSTALL_ROOT=build/tmp make install -j$(nproc)
mv build/tmp/piston/packages/php/8.0.2/php-8.0.2 ../../output

1
packages/php-8.0.2/environment vendored Normal file
View file

@ -0,0 +1 @@
export PATH=$PWD/bin:$PATH

7
packages/php-8.0.2/metadata.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"language": "php",
"version": "8.0.2",
"author": "Martin Kos <martinkos007@gmail.com>",
"dependencies": {},
"aliases": ["php8","html"]
}

3
packages/php-8.0.2/run vendored Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
php $*

1
packages/php-8.0.2/test.php vendored Normal file
View file

@ -0,0 +1 @@
OK

View file

@ -1,24 +0,0 @@
NAME=php
AUTHOR=Martin Kos <martinkos007@gmail.com>
DEPENDENCIES=
COMPILED=false
VERSIONS=7.4.15 8.0.2
include common.mk
${RUN_FILE}:
echo 'php $$*' > $@
${ENV_FILE}:
echo 'export PATH=$$PWD/bin:$$PATH' > $@
${BIN_DIR}: ${BUILD_DIR}php-${VERSION}-sources/
$(eval TMP_DIR=${PWD}/${BUILD_DIR}tmpout)
cd $< && ./configure --prefix ${PREFIX}
$(MAKE) -C $<
INSTALL_ROOT=${TMP_DIR}/ $(MAKE) -C $< install
mv ${TMP_DIR}${PREFIX} ${BIN_DIR} && rm -r ${TMP_DIR}
${BUILD_DIR}php-${VERSION}-sources.tar.gz:
curl "https://www.php.net/distributions/php-${VERSION}.tar.gz" -o $@

View file

@ -1,3 +0,0 @@
<?php
echo "OK";
?>

19
packages/python-3.9.1/build.sh vendored Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
mkdir -p build/tmp build/python
cd build
curl "https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz" -o python.tar.gz
tar xzf python.tar.gz --strip-components=1 -C python
cd python
./configure --prefix /piston/packages/python/3.9.1/python-3.9.1
make -j$(nproc)
DESTDIR=build/tmp make altinstall -j$(nproc)
mv build/tmp/piston/packages/python/3.9.1/python-3.9.1 ../../output

1
packages/python-3.9.1/environment vendored Normal file
View file

@ -0,0 +1 @@
export PATH=$PWD/bin:$PATH

7
packages/python-3.9.1/metadata.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"language": "python",
"version": "3.9.1",
"author": "Thomas Hobson <thomas@hexf.me>",
"dependencies": {},
"aliases": ["py", "python3"]
}

3
packages/python-3.9.1/run vendored Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
python3.9 $*

View file

@ -1,26 +0,0 @@
NAME=python
AUTHOR=Thomas Hobson <thomas@hexf.me>
DEPENDENCIES=
COMPILED=false
VERSIONS=3.5.1 3.9.1
include common.mk
${RUN_FILE}:
echo 'python${VERSION_MINOR} $$*' > $@
${ENV_FILE}:
echo 'export PATH=$$PWD/bin:$$PATH' > $@
${BIN_DIR}: ${BUILD_DIR}Python-${VERSION}/
$(eval TMP_DIR=${PWD}/${BUILD_DIR}tmpout/)
cd $< && ./configure --prefix ${PREFIX}
$(MAKE) -C $<
DESTDIR=${TMP_DIR} $(MAKE) -C $< altinstall
mv ${TMP_DIR}${PREFIX} ${BIN_DIR} && rm -rf ${TMP_DIR}
${BUILD_DIR}Python-${VERSION}.tar.gz:
curl "https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz" -o $@

View file

@ -1,6 +1,6 @@
FROM debian:buster-slim
RUN apt-get update && apt-get install -y autoconf build-essential libssl-dev pkg-config zlib1g-dev libargon2-dev libsodium-dev libcurl4-openssl-dev sqlite3 libsqlite3-dev libonig-dev libxml2 libxml2-dev bc curl git linux-headers-amd64 perl xz-utils python3 python3-pip gnupg jq zlib1g-dev cmake cmake-doc extra-cmake-modules build-essential gcc binutils bash coreutils util-linux pciutils usbutils coreutils binutils findutils grep && \
RUN apt-get update && apt-get install -y unzip autoconf build-essential libssl-dev pkg-config zlib1g-dev libargon2-dev libsodium-dev libcurl4-openssl-dev sqlite3 libsqlite3-dev libonig-dev libxml2 libxml2-dev bc curl git linux-headers-amd64 perl xz-utils python3 python3-pip gnupg jq zlib1g-dev cmake cmake-doc extra-cmake-modules build-essential gcc binutils bash coreutils util-linux pciutils usbutils coreutils binutils findutils grep && \
ln -sf /bin/bash /bin/sh && \
pip3 install 'yq==2.12.0' && \
rm -rf /var/lib/apt/lists/*

View file

@ -2,7 +2,7 @@ cd /packages
for pkg in "$@"
do
make -j16 build-$pkg
make -j16 $pkg.pkg.tar.gz
done
cd /repo