-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b0a6bb0
Showing
18 changed files
with
1,227 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
if [[ ! -d tools ]] ; then | ||
printf "This script needs to be run from the root of the repo, like ./tools/travis-setup\n" | ||
exit 1 | ||
fi | ||
|
||
mkdir -p tools/downloads | ||
mkdir -p tools/cross/bin | ||
mkdir -p dist | ||
|
||
export PATH="$(pwd)/tools/cross/bin:$PATH" | ||
|
||
targets=( | ||
'x86_64-linux-musl' | ||
'i486-linux-musl' | ||
'aarch64-linux-musl' | ||
'arm-linux-musleabi' | ||
'arm-linux-musleabihf' | ||
'powerpc64le-linux-musl' | ||
) | ||
|
||
declare -A target_short | ||
target_short[x86_64-linux-musl]="amd64" | ||
target_short[i486-linux-musl]="x86" | ||
target_short[aarch64-linux-musl]="aarch64" | ||
target_short[arm-linux-musleabi]="arm" | ||
target_short[arm-linux-musleabihf]="armhf" | ||
target_short[powerpc64le-linux-musl]="ppc64le" | ||
|
||
declare -A versions | ||
versions[justc-forstdin]=$(grep version package/info | cut -d'=' -f2) | ||
|
||
skaware_release=v2.0.7 | ||
musl_make_release=v15 | ||
gccver=7.3.0 | ||
|
||
musl_cross_make="https://github.com/just-containers/musl-cross-make/releases/download/$musl_make_release" | ||
skaware="https://github.com/just-containers/skaware/releases/download/$skaware_release" | ||
|
||
manifesturl="$skaware/manifest.txt" | ||
rm -f "tools/downloads/manifest.txt" | ||
curl -s -R -L -o "tools/downloads/manifest.txt" "$manifesturl" | ||
|
||
while read -r line ; do | ||
key=$(printf "${line}" | cut -d"=" -f1) | ||
value=$(printf "${line}" | cut -d"=" -f2) | ||
if [[ -n "${key}" && -n "${value}" ]] ; then | ||
versions[$key]="$value" | ||
fi | ||
done < tools/downloads/manifest.txt | ||
|
||
|
||
for target in "${targets[@]}" ; do | ||
gccurl="$musl_cross_make/gcc-${gccver}-${target}.tar.xz" | ||
gccfile=$(basename $gccurl) | ||
if [[ ! -f "tools/downloads/$gccfile" ]] ; then | ||
printf "Downloading tools/downloads/$gccfile\n" | ||
curl -s -R -L -o "tools/downloads/$gccfile" "$gccurl" | ||
fi | ||
skawareurl="$skaware/skalibs-${versions[skalibs]}-linux-${target_short[$target]}-dev.tar.gz" | ||
skafile=$(basename $skawareurl) | ||
if [[ ! -f "tools/downloads/$skafile" ]] ; then | ||
printf "Downloading tools/downloads/$skafile\n" | ||
curl -s -R -L -o "tools/downloads/$skafile" "$skawareurl" | ||
fi | ||
|
||
execlineurl="$skaware/execline-${versions[execline]}-linux-${target_short[$target]}-dev.tar.gz" | ||
execlinefile=$(basename $execlineurl) | ||
if [[ ! -f "tools/downloads/$execlinefile" ]] ; then | ||
printf "Downloading tools/downloads/$execlinefile\n" | ||
curl -s -R -L -o "tools/downloads/$execlinefile" "$execlineurl" | ||
fi | ||
|
||
tar xf "tools/downloads/$gccfile" -C tools/cross | ||
tar xf "tools/downloads/$skafile" -C tools/cross/${target} --strip-components=1 | ||
tar xf "tools/downloads/$execlinefile" -C tools/cross/${target} --strip-components=1 | ||
|
||
mkdir -p dist/${target} | ||
|
||
CFLAGS="-g0 -Os" \ | ||
./configure \ | ||
--target=$target \ | ||
--prefix=/usr \ | ||
--with-include=$(pwd)/tools/cross/${target}/include \ | ||
--with-lib=$(pwd)/tools/cross/${target}/lib \ | ||
--with-sysdeps=$(pwd)/tools/cross/${target}/lib/skalibs/sysdeps \ | ||
--enable-static-libc | ||
make | ||
${target}-strip justc-forstdin | ||
make DESTDIR=dist/${target} install | ||
make clean | ||
rm -rf dist/${target}/usr/include | ||
|
||
printf "Making tarball for $target\n" | ||
tar cvzf dist/justc-forstdin-${versions[justc-forstdin]}-linux-${target_short[$target]}.tar.gz \ | ||
-C dist/${target} \ | ||
--owner 0 \ | ||
--group 0 \ | ||
usr | ||
done | ||
|
||
printf 'Built using `skalibs-%s`\n' "${versions[skalibs]}" > dist/release.md | ||
|
||
printf 'Compiling source tarball\n' | ||
|
||
make tgz | ||
cp /tmp/justc-forstdin-${versions[justc-forstdin]}.tar.gz dist/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# don't loop if files don't exist | ||
shopt -s nullglob | ||
|
||
mkdir -p tools/downloads | ||
mkdir -p tools/cross/bin | ||
|
||
if [[ ! -f "tools/downloads/linux-amd64-github-release.bz2" ]] ; then | ||
printf "Downloading tools/downloads/linux-amd64-github-release.bz2\n" | ||
curl -s -R -L -o "tools/downloads/linux-amd64-github-release.bz2" \ | ||
"https://github.com/github-release/github-release/releases/download/v0.8.1/linux-amd64-github-release.bz2" | ||
fi | ||
|
||
bunzip2 "tools/downloads/linux-amd64-github-release.bz2" | ||
mv "tools/downloads/linux-amd64-github-release" "tools/cross/bin/github-release" | ||
chmod +x "tools/cross/bin/github-release" | ||
|
||
export PATH="$(pwd)/tools/cross/bin:$PATH" | ||
|
||
if [[ ! -d dist ]] ; then | ||
printf "This needs to be run from the root of the repo\n" | ||
exit 1 | ||
fi | ||
|
||
# exit if TRAVIS_TAG is empty, no need to release anything | ||
if [ -z "${TRAVIS_TAG}" ]; then | ||
exit 0 | ||
fi | ||
|
||
export "PATH=$(pwd)/tools/cross/bin:$PATH" | ||
|
||
# get user and repo names | ||
USERNAME=$(echo ${TRAVIS_REPO_SLUG} | cut -d"/" -f1) | ||
REPONAME=$(echo ${TRAVIS_REPO_SLUG} | cut -d"/" -f2) | ||
|
||
# release | ||
github-release release \ | ||
--user "${USERNAME}" \ | ||
--repo "${REPONAME}" \ | ||
--tag "${TRAVIS_TAG##*/}" \ | ||
--name "${TRAVIS_TAG##*/}" \ | ||
--description "$(cat $(pwd)/dist/release.md)" || true | ||
|
||
# binaries | ||
for i in "$(pwd)/dist/"*.tar.gz; do | ||
name=$(basename ${i}) | ||
gpg -u 0x3B2FD161 --output "${i}.sig" --detach-sig "${i}" | ||
github-release upload \ | ||
--user "${USERNAME}" \ | ||
--repo "${REPONAME}" \ | ||
--tag "${TRAVIS_TAG##*/}" \ | ||
--name "${name}" \ | ||
--file "${i}" | ||
github-release upload \ | ||
--user "${USERNAME}" \ | ||
--repo "${REPONAME}" \ | ||
--tag "${TRAVIS_TAG##*/}" \ | ||
--name "${name}.sig" \ | ||
--file "${i}.sig" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: build | ||
run: .github/build | ||
|
||
- name: upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: dist | ||
path: | | ||
dist/*.tar.gz | ||
dist/*.md | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: download artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
- name: decrypt signing keys | ||
env: | ||
OPENSSL_KEY: ${{ secrets.OPENSSL_KEY }} | ||
OPENSSL_IV: ${{ secrets.OPENSSL_IV }} | ||
run: openssl aes-256-cbc -K $OPENSSL_KEY -iv $OPENSSL_IV -in tools/keys.tar.xz.enc -out tools/keys.tar.xz -d | ||
|
||
- name: extract signing keys | ||
run: tar xf tools/keys.tar.xz -C tools | ||
|
||
- name: import public key | ||
run: gpg --import tools/keys/public.key | ||
|
||
- name: import private key | ||
run: gpg --allow-secret-key-import --import tools/keys/private.key | ||
|
||
- name: create and upload release | ||
run: .github/release | ||
env: | ||
TRAVIS_REPO_SLUG: just-containers/justc-forstdin | ||
TRAVIS_TAG: ${{ github.ref }} | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/config.mak | ||
/justc-forstdin | ||
*.o | ||
/src/include/justc-forstdin/config.h | ||
/tools/downloads | ||
/tools/cross | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Internet Systems Consortium license | ||
=================================== | ||
|
||
Copyright (c) `2021`, `Laurent Bercot <ska at skarnet.org>`, `John Regan <john at jrjrtech.com>` | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any purpose | ||
with or without fee is hereby granted, provided that the above copyright notice | ||
and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS | ||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | ||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF | ||
THIS SOFTWARE. |
Oops, something went wrong.