summaryrefslogtreecommitdiffstats
path: root/build-aux
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/build-debian.sh153
-rwxr-xr-xbuild-aux/build-static-all.sh12
-rwxr-xr-xbuild-aux/build-static.sh7
-rwxr-xr-xbuild-aux/build-windows.sh16
-rwxr-xr-xbuild-aux/check-make-embedded.sh5
-rwxr-xr-xbuild-aux/clang-analyzer.sh28
-rwxr-xr-xbuild-aux/travis-build.sh21
-rwxr-xr-xbuild-aux/travis-deploy.sh67
-rwxr-xr-xbuild-aux/valgrind.sh16
9 files changed, 88 insertions, 237 deletions
diff --git a/build-aux/build-debian.sh b/build-aux/build-debian.sh
deleted file mode 100755
index 44e9869..0000000
--- a/build-aux/build-debian.sh
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/bin/bash
-
-set -exo pipefail
-
-export DEBEMAIL="rafael+deb@rafaelmartins.eng.br"
-export DEBFULLNAME="Automatic Builder (github-actions)"
-export DEB_BUILD_OPTIONS="noddebs"
-
-export DIST="$(echo "${TARGET}" | cut -d- -f2)"
-
-MY_P="${PN}_${PV}"
-ARCH="$(echo "${TARGET}" | cut -d- -f3)"
-
-REV=
-case ${DIST} in
- bullseye)
- REV="1~11bullseye"
- ;;
- bookworm)
- REV="1~12bookworm"
- DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS} nocheck"
- ;;
- sid)
- REV="1~sid"
- DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS} nocheck"
- ;;
- focal)
- REV="1~11.0focal"
- ;;
- jammy)
- REV="1~12.0jammy"
- ;;
- kinetic)
- REV="1~12.1kinetic"
- DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS} nocheck"
- ;;
- *)
- echo "error: unsupported dist: ${DIST}"
- exit 1
- ;;
-esac
-
-download_pbuilder_chroot() {
- local index="$(wget -q -O- https://distfiles.rgm.io/pbuilder-chroots/LATEST/)"
- local archive="$(echo "${index}" | sed -n "s/.*\(pbuilder-chroot-${DIST}-${ARCH}-.*\)\.sha512.*/\1/p" | head -n 1)"
- local p="$(echo "${index}" | sed -n "s/.*pbuilder-chroot-${DIST}-${ARCH}-\(.*\)\.tar.*\.sha512.*/pbuilder-chroots-\1/p" | head -n 1)"
-
- pushd "${SRCDIR}" > /dev/null
-
- wget -c "https://distfiles.rgm.io/pbuilder-chroots/${p}/${archive}"{,.sha512}
- sha512sum --check --status "${archive}.sha512"
-
- sudo rm -rf /tmp/pbuilder
- mkdir /tmp/pbuilder
- fakeroot tar --checkpoint=1000 -xf "${archive}" -C /tmp/pbuilder
-
- popd > /dev/null
-}
-
-download_orig() {
- local i=0
- local out=0
- local url="https://distfiles.rgm.io/${PN}/${P}/${P}.tar.xz"
-
- while [[ $i -lt 20 ]]; do
- set +ex
- ((i++))
- echo "waiting for ${P}.tar.xz: $i/20"
- wget -q --spider --tries 1 "${url}"
- out=$?
- set -ex
-
- if [[ $out -eq 0 ]]; then
- wget -c "${url}"
- mv "${P}.tar.xz" "${BUILDDIR}/${MY_P}.orig.tar.xz"
- return
- fi
-
- if [[ $out -ne 8 ]]; then
- exit $out
- fi
-
- sleep 30
- done
-
- echo "failed to find orig distfile. please check if that task succeeded."
- exit 1
-}
-
-create_reprepro_conf() {
- echo "Origin: blogc"
- echo "Label: blogc"
- echo "Codename: ${DIST}"
- echo "Architectures: source amd64"
- echo "Components: main"
- echo "Description: Apt repository containing blogc snapshots"
- echo
-}
-
-download_orig
-
-rm -rf "${BUILDDIR}/${P}"
-tar -xf "${BUILDDIR}/${MY_P}.orig.tar.xz" -C "${BUILDDIR}"
-cp -r "${SRCDIR}/debian" "${BUILDDIR}/${P}/"
-
-pushd "${BUILDDIR}/${P}" > /dev/null
-
-## skip build silently when new version is older than last changelog version (version bump)
-if ! dch \
- --distribution "${DIST}" \
- --newversion "${PV}-${REV}" \
- "Automated build for ${DIST}"
-then
- exit 0
-fi
-
-download_pbuilder_chroot
-
-sudo cowbuilder \
- --update \
- --basepath "/tmp/pbuilder/${DIST}-${ARCH}/base.cow"
-
-RES="${BUILDDIR}/deb/${DIST}"
-mkdir -p "${RES}"
-
-pdebuild \
- --pbuilder cowbuilder \
- --buildresult "${RES}" \
- --debbuildopts -sa \
- -- --basepath "/tmp/pbuilder/${DIST}-${ARCH}/base.cow"
-
-popd > /dev/null
-
-mkdir -p "${BUILDDIR}/deb-repo/conf"
-create_reprepro_conf > "${BUILDDIR}/deb-repo/conf/distributions"
-
-pushd "${BUILDDIR}/deb-repo" > /dev/null
-
-for i in "../deb/${DIST}"/*.changes; do
- reprepro include "${DIST}" "${i}"
-done
-
-popd > /dev/null
-
-tar \
- -cJf "blogc-deb-repo-${DIST}-${ARCH}-${PV}.tar.xz" \
- --exclude ./deb-repo/conf \
- --exclude ./deb-repo/db \
- ./deb-repo
-
-tar \
- -cJf "blogc-deb-${DIST}-${ARCH}-${PV}.tar.xz" \
- ./deb
diff --git a/build-aux/build-static-all.sh b/build-aux/build-static-all.sh
deleted file mode 100755
index 0cba1a3..0000000
--- a/build-aux/build-static-all.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-${MAKE_CMD:-make} LDFLAGS="-all-static"
-${MAKE_CMD:-make} DESTDIR="${PWD}/root" install
-install -m 644 ../LICENSE root/LICENSE
-echo "${PV}" > root/VERSION
-
-pushd root > /dev/null
-tar -cvJf "../${PN}-${TARGET}-amd64-${PV}.tar.xz" *
-popd > /dev/null
diff --git a/build-aux/build-static.sh b/build-aux/build-static.sh
deleted file mode 100755
index cacca1b..0000000
--- a/build-aux/build-static.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-${MAKE_CMD:-make} LDFLAGS="-all-static" blogc
-
-xz -zc blogc > "blogc-static-amd64-${PV}.xz"
diff --git a/build-aux/build-windows.sh b/build-aux/build-windows.sh
deleted file mode 100755
index b00fbe6..0000000
--- a/build-aux/build-windows.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-DESTDIR="${PN}-${TARGET}-${PV}"
-
-${MAKE_CMD:-make} blogc.exe
-
-rm -rf "${DESTDIR}"
-mkdir -p "${DESTDIR}"
-
-cp .libs/blogc.exe "${DESTDIR}/"
-cp ../LICENSE "${DESTDIR}/"
-cp ../README.md "${DESTDIR}/"
-
-zip "${DESTDIR}.zip" "${DESTDIR}"/*
diff --git a/build-aux/check-make-embedded.sh b/build-aux/check-make-embedded.sh
deleted file mode 100755
index d2e5fe4..0000000
--- a/build-aux/check-make-embedded.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-${MAKE_CMD:-make} check
diff --git a/build-aux/clang-analyzer.sh b/build-aux/clang-analyzer.sh
deleted file mode 100755
index e7820c4..0000000
--- a/build-aux/clang-analyzer.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-P="${PN}-clang-analyzer-${PV}"
-
-set +e
-scan-build \
- --use-cc="${CC:-clang}" \
- -o reports \
- make
-RV=$?
-set -e
-
-NUM_REPORTS=$(ls -1 reports | wc -l)
-[[ ${NUM_REPORTS} -eq 0 ]] && exit ${RV}
-[[ ${NUM_REPORTS} -eq 1 ]]
-
-REPORTS="reports/$(ls -1 reports)"
-if [[ -d "${REPORTS}" ]]; then
- mv "${REPORTS}" clang-analyzer
- tar \
- -cvJf "${P}.tar.xz" \
- clang-analyzer
- RV=1
-fi
-
-exit ${RV}
diff --git a/build-aux/travis-build.sh b/build-aux/travis-build.sh
new file mode 100755
index 0000000..53cf589
--- /dev/null
+++ b/build-aux/travis-build.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+set -ex
+
+rm -rf build
+mkdir -p build
+
+pushd build > /dev/null
+
+../configure \
+ CFLAGS="-Wall -g" \
+ --enable-ronn \
+ --disable-silent-rules \
+ --enable-tests \
+ --enable-valgrind \
+ --enable-git-receiver \
+ --enable-runserver
+
+popd > /dev/null
+
+make -C build "${TARGET}"
diff --git a/build-aux/travis-deploy.sh b/build-aux/travis-deploy.sh
new file mode 100755
index 0000000..51aac3e
--- /dev/null
+++ b/build-aux/travis-deploy.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+set -e
+
+if [[ "x${TRAVIS_PULL_REQUEST}" != "xfalse" ]]; then
+ echo "This is a pull request. skipping deploy ..."
+ exit 0
+fi
+
+if [[ "x${TRAVIS_BRANCH}" != "xmaster" ]] && [[ "x${TRAVIS_TAG}" != xv* ]]; then
+ echo "This isn't master branch nor a valid tag. skipping deploy ..."
+ exit 0
+fi
+
+if [[ "x${CC}" != "xgcc" ]] || [[ "x${TARGET}" = "xvalgrind" ]]; then
+ echo "Invalid target for deploy. skipping ..."
+ exit 0
+fi
+
+if [[ ! -d build ]]; then
+ echo "Build directory not found."
+ exit 1
+fi
+
+if [[ "x${TARGET}" = "xdist-srpm" ]]; then
+ FILES=( build/*.src.rpm )
+else
+ FILES=( build/*.{*.tar.{gz,bz2,xz},zip} )
+fi
+
+TARNAME="$(grep PACKAGE_TARNAME build/config.h | cut -d\" -f2)"
+VERSION="$(grep PACKAGE_VERSION build/config.h | cut -d\" -f2)"
+
+do_curl() {
+ curl \
+ --silent \
+ --ftp-create-dirs \
+ --upload-file "${1}" \
+ --user "${FTP_USER}:${FTP_PASSWORD}" \
+ "ftp://${FTP_HOST}/public_html/${TARNAME}/${TARNAME}-${VERSION}/$(basename ${1})"
+}
+
+echo " * Found files:"
+for f in "${FILES[@]}"; do
+ echo " $(basename ${f})"
+done
+echo
+
+for f in "${FILES[@]}"; do
+ echo " * Processing file: $(basename ${f}):"
+
+ echo -n " Generating SHA512 checksum ... "
+ pushd build > /dev/null
+ sha512sum "$(basename ${f})" > "$(basename ${f}).sha512"
+ popd > /dev/null
+ echo "done"
+
+ echo -n " Uploading file ... "
+ do_curl "${f}"
+ echo "done"
+
+ echo -n " Uploading SHA512 checksum ... "
+ do_curl "${f}.sha512"
+ echo "done"
+
+ echo
+done
diff --git a/build-aux/valgrind.sh b/build-aux/valgrind.sh
deleted file mode 100755
index 991b906..0000000
--- a/build-aux/valgrind.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-export TESTS_ENVIRONMENT="
- ${VALGRIND:-valgrind} \
- --tool=memcheck \
- --leak-check=full \
- --leak-resolution=high \
- --num-callers=20 \
- --error-exitcode=1 \
- --show-possibly-lost=no"
-
-if [[ "${1}" == *.sh ]]; then
- exec "${@}"
-else
- exec ${TESTS_ENVIRONMENT} "${@}"
-fi