From 214d09891909ce5505d7bdbc5c848a9c4be23c0d Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Tue, 8 Mar 2016 20:33:21 +0100 Subject: travis: added script to upload distfiles --- build-aux/build-travis.sh | 45 ----------------------------------- build-aux/build-windows.sh | 48 ------------------------------------- build-aux/travis-build.sh | 47 ++++++++++++++++++++++++++++++++++++ build-aux/travis-deploy.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 93 deletions(-) delete mode 100755 build-aux/build-travis.sh delete mode 100755 build-aux/build-windows.sh create mode 100755 build-aux/travis-build.sh create mode 100755 build-aux/travis-deploy.sh (limited to 'build-aux') diff --git a/build-aux/build-travis.sh b/build-aux/build-travis.sh deleted file mode 100755 index d400494..0000000 --- a/build-aux/build-travis.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -set -ex - -rm -rf build -mkdir -p build - -MAKE_TARGET="${TARGET}" - -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" - MAKE_TARGET="all" -else - export CFLAGS="-Wall -g" - export CONFIGURE_ARGS="--enable-tests --enable-valgrind" -fi - -pushd build > /dev/null - -../configure \ - ${CHOST:+--host=${CHOST} --target=${CHOST}} \ - --enable-ronn \ - --disable-silent-rules \ - ${CONFIGURE_ARGS} - -popd > /dev/null - -make -C build "${MAKE_TARGET}" - -if [[ "x${TARGET}" = xw* ]]; then - VERSION="$(grep PACKAGE_VERSION build/config.h | cut -d\" -f2)" - DEST_DIR="blogc-${VERSION}-${TARGET}" - - rm -rf "${DEST_DIR}" - mkdir -p "${DEST_DIR}" - - cp build/.libs/blogc.exe "${DEST_DIR}/" - cp LICENSE "${DEST_DIR}/" - cp README.md "${DEST_DIR}/" - - zip "${DEST_DIR}.zip" "${DEST_DIR}"/* -fi 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/travis-build.sh b/build-aux/travis-build.sh new file mode 100755 index 0000000..d03cafd --- /dev/null +++ b/build-aux/travis-build.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +set -ex + +rm -rf build +mkdir -p build + +MAKE_TARGET="${TARGET}" + +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" + [[ "x${TARGET}" = "xw32" ]] && export CHOST="i686-w64-mingw32" + MAKE_TARGET="all" +else + export CFLAGS="-Wall -g" + export CONFIGURE_ARGS="--enable-tests --enable-valgrind" +fi + +pushd build > /dev/null + +../configure \ + ${CHOST:+--host=${CHOST} --target=${CHOST}} \ + --enable-ronn \ + --with-squareball=internal \ + --disable-silent-rules \ + ${CONFIGURE_ARGS} + +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="${TARNAME}-${VERSION}-${TARGET}" + + rm -rf "${DEST_DIR}" + mkdir -p "${DEST_DIR}" + + cp build/.libs/blogc.exe "${DEST_DIR}/" + cp LICENSE "${DEST_DIR}/" + cp README.md "${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 -- cgit v1.2.3-18-g5258