diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-03-08 20:33:21 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-03-08 20:33:21 +0100 |
commit | 214d09891909ce5505d7bdbc5c848a9c4be23c0d (patch) | |
tree | 143098c6b3529debd326d6cee04d1bd18556a456 /build-aux | |
parent | d8f0fc6cb36a9d7c153a974b5095a4efb8c8add0 (diff) | |
download | blogc-214d09891909ce5505d7bdbc5c848a9c4be23c0d.tar.gz blogc-214d09891909ce5505d7bdbc5c848a9c4be23c0d.tar.bz2 blogc-214d09891909ce5505d7bdbc5c848a9c4be23c0d.zip |
travis: added script to upload distfiles
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/build-windows.sh | 48 | ||||
-rwxr-xr-x | build-aux/travis-build.sh (renamed from build-aux/build-travis.sh) | 8 | ||||
-rwxr-xr-x | build-aux/travis-deploy.sh | 59 |
3 files changed, 64 insertions, 51 deletions
diff --git a/build-aux/build-windows.sh b/build-aux/build-windows.sh deleted file mode 100755 index bdecc8b..0000000 --- a/build-aux/build-windows.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -# This script builds windows binaries, given a source tarball. -# It was designed to work on Fedora, and requires the following packages: -# -# mingw32-gcc mingw64-gcc zip -# -# This script must be called with the xz source tarball and the target version -# as arguments. - - -set -ex - -[[ $# -eq 2 ]] - - -build() { - local version=${2} - local arch=${3} - local build_dir="/tmp/blogc_build_${version}_${arch}" - local dest_dir="/tmp/blogc-${version}-w${arch}" - - rm -rf "${build_dir}" - mkdir -p "${build_dir}" - tar -xvf "${1}" -C "${build_dir}" - - pushd "${build_dir}/blogc-${version}" &> /dev/null - "mingw${arch}-configure" - make - popd &> /dev/null - - rm -rf "${dest_dir}" - mkdir -p "${dest_dir}" - cp "${build_dir}/blogc-${version}/.libs/blogc.exe" "${dest_dir}/" - cp "${build_dir}/blogc-${version}/LICENSE" "${dest_dir}/" - cp "${build_dir}/blogc-${version}/README.md" "${dest_dir}/" - - pushd "$(dirname ${dest_dir})" &> /dev/null - zip "$(basename ${dest_dir}).zip" "$(basename ${dest_dir})"/* - popd &> /dev/null - - mv "${dest_dir}.zip" . -} - - -for arch in 32 64; do - build "$1" "$2" "${arch}" -done diff --git a/build-aux/build-travis.sh b/build-aux/travis-build.sh index d400494..d03cafd 100755 --- a/build-aux/build-travis.sh +++ b/build-aux/travis-build.sh @@ -11,7 +11,7 @@ if [[ "x${TARGET}" = xw* ]]; then unset CC export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" export CHOST="x86_64-w64-mingw32" - test "x${TARGET}" = "xw32" && export CHOST="i686-w64-mingw32" + [[ "x${TARGET}" = "xw32" ]] && export CHOST="i686-w64-mingw32" MAKE_TARGET="all" else export CFLAGS="-Wall -g" @@ -23,6 +23,7 @@ pushd build > /dev/null ../configure \ ${CHOST:+--host=${CHOST} --target=${CHOST}} \ --enable-ronn \ + --with-squareball=internal \ --disable-silent-rules \ ${CONFIGURE_ARGS} @@ -31,8 +32,9 @@ popd > /dev/null make -C build "${MAKE_TARGET}" if [[ "x${TARGET}" = xw* ]]; then + TARNAME="$(grep PACKAGE_TARNAME build/config.h | cut -d\" -f2)" VERSION="$(grep PACKAGE_VERSION build/config.h | cut -d\" -f2)" - DEST_DIR="blogc-${VERSION}-${TARGET}" + DEST_DIR="${TARNAME}-${VERSION}-${TARGET}" rm -rf "${DEST_DIR}" mkdir -p "${DEST_DIR}" @@ -41,5 +43,5 @@ if [[ "x${TARGET}" = xw* ]]; then cp LICENSE "${DEST_DIR}/" cp README.md "${DEST_DIR}/" - zip "${DEST_DIR}.zip" "${DEST_DIR}"/* + zip "build/${DEST_DIR}.zip" "${DEST_DIR}"/* fi diff --git a/build-aux/travis-deploy.sh b/build-aux/travis-deploy.sh new file mode 100755 index 0000000..267c8d5 --- /dev/null +++ b/build-aux/travis-deploy.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +set -e + +if [[ "x${TARGET}" != xw* ]] && [[ "x${TARGET}" != xdist* ]]; then + echo "Nothing to deploy." + exit 0 +fi + +if [[ ! -d build ]]; then + echo "Build directory not found." + exit 1 +fi + +if [[ "x${TARGET}" = xw* ]]; then + FILES=( build/*.zip ) +elif [[ "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 |