diff --git a/misc/build-cproc.sh b/misc/build-cproc.sh index fb5e597..3eb56b3 100755 --- a/misc/build-cproc.sh +++ b/misc/build-cproc.sh @@ -1,12 +1,12 @@ #!/bin/bash ## $1 : version, currently cproc does not have any and only uses master branch. -## $2 : destination: a directory or S3 path (eg. s3://...) +## $2 : destination: a directory ## $3 : last revision successfully build (optional) set -ex +source common.sh -ROOT=$PWD VERSION="${1}" LAST_REVISION="${3-}" @@ -17,67 +17,27 @@ fi URL="https://git.sr.ht/~mcf/cproc" BRANCH="master" +QBE_URL="git://c9x.me/qbe.git" +QBE_BRANCH="master" -BASENAME=cproc-${VERSION}-$(date +%Y%m%d) -FULLNAME=${BASENAME}.tar.xz -OUTPUT=${ROOT}/${FULLNAME} -S3OUTPUT= -if [[ $2 =~ ^s3:// ]]; then - S3OUTPUT=$2 -else - if [[ -d "${2}" ]]; then - OUTPUT=$2/${FULLNAME} - else - OUTPUT=${2-$OUTPUT} - fi -fi - -REVISION=$(git ls-remote --heads "${URL}" "refs/heads/${BRANCH}" | cut -f 1) -echo "ce-build-revision:${REVISION}" -echo "ce-build-output:${OUTPUT}" - -if [[ "${REVISION}" == "${LAST_REVISION}" ]]; then - echo "ce-build-status:SKIPPED" - exit -fi +CPROC_REVISION=$(get_remote_revision "${URL}" "heads/${BRANCH}") +QBE_REVISION=$(get_remote_revision "${QBE_URL}" "heads/${QBE_BRANCH}") +REVISION="${CPROC_REVISION}_qbe-${QBE_REVISION}" -## From now, no unset variable -set -u +FULLNAME=cproc-${VERSION}-$(date +%Y%m%d) +OUTPUT=$(realpath "$2/${FULLNAME}.tar.xz") -OUTPUT=$(realpath "${OUTPUT}") +initialise "${REVISION}" "${OUTPUT}" "${LAST_REVISION}" -rm -rf build-cproc -mkdir -p build-cproc - -pushd build-cproc +DESTDIR="${PWD}/stage" git clone --depth 1 "${URL}" --branch "${BRANCH}" pushd cproc - -## Temporary (hopefully) patch to support basic --version -## -## The following 2 lines are needed on virgin system where nothing is -## configured. git really needs something here, or it will fail. Even using -## --author is not enough. -git config user.email || git config user.email "none@example.com" -git config user.name || git config user.name "None" - -git am ../../cproc-version.patch - ./configure +make -j"$(nproc)" install DESTDIR="${DESTDIR}" BINDIR=/bin +popd -make -j"$(nproc)" -make install DESTDIR="$PWD/root" BINDIR=/bin - -pushd root - -export XZ_DEFAULTS="-T 0" -tar Jcf "${OUTPUT}" --transform "s,^./,./${BASENAME}/," ./ +git clone --depth 1 "${QBE_URL}" --branch "${QBE_BRANCH}" +make -C qbe -j"$(nproc)" install DESTDIR="${DESTDIR}" BINDIR=/bin -if [[ -n "${S3OUTPUT}" ]]; then - aws s3 cp --storage-class REDUCED_REDUNDANCY "${OUTPUT}" "${S3OUTPUT}" -fi - -popd -popd -echo "ce-build-status:OK" +complete "${DESTDIR}" "${FULLNAME}" "${OUTPUT}" diff --git a/misc/cproc-version.patch b/misc/cproc-version.patch deleted file mode 100644 index a2d5efc..0000000 --- a/misc/cproc-version.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 096c248718795c4b52df47dc16941615e6806a5c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= -Date: Tue, 19 Oct 2021 22:04:34 +0200 -Subject: [PATCH] Supports for getting version with --version -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Very basic support for getting version with --version. Currently configure gets -the current SHA1 from the git repository and use this as version. - -Signed-off-by: Marc Poulhiès ---- - configure | 6 ++++++ - driver.c | 10 ++++++++++ - 2 files changed, 16 insertions(+) - -diff --git a/configure b/configure -index be7a95b..615b23e 100755 ---- a/configure -+++ b/configure -@@ -164,6 +164,12 @@ static const char *const linkcmd[] = {"$DEFAULT_LINKER", $linkflags}; - EOF - echo done - -+VERSION_STRING=$(git rev-parse HEAD) -+printf "creating version.h..." -+cat >version.h <config.mk < - - #include "util.h" -+#include "version.h" - - enum filetype { - NONE, /* detect based on file extension */ -@@ -64,6 +65,13 @@ static struct stageinfo stages[] = { - [LINK] = {.name = "link"}, - }; - -+static void -+version(void) -+{ -+ fprintf(stderr, "version: " VERSION_STRING "\n"); -+ exit(2); -+} -+ - static void - usage(const char *fmt, ...) - { -@@ -448,6 +456,8 @@ main(int argc, char *argv[]) - } else if (strcmp(arg, "-pthread") == 0) { - arrayaddptr(&stages[LINK].cmd, "-l"); - arrayaddptr(&stages[LINK].cmd, "pthread"); -+ } else if (strcmp(arg, "--version") == 0) { -+ version(); - } else { - if (arg[2] != '\0' && strchr("cESsv", arg[1])) - usage(NULL); --- -2.33.0 -