Skip to content
Snippets Groups Projects
Commit fa038be2 authored by akiraohgaki's avatar akiraohgaki Committed by GitHub
Browse files

Merge pull request #49 from ocs-url/develop

Develop
parents 3b4a498a d9004aff
No related branches found
No related tags found
No related merge requests found
dist: trusty
sudo: required
services:
- docker
branches:
only:
- master
script:
- mntdir='/mnt/ocs-url'
- docker run --rm -v $(pwd):${mntdir} ubuntu:14.04 /bin/bash -c "sh ${mntdir}/scripts/build-docker.sh ubuntu"
- docker run --rm -v $(pwd):${mntdir} fedora:20 /bin/bash -c "sh ${mntdir}/scripts/build-docker.sh fedora"
- docker run --rm -v $(pwd):${mntdir} base/archlinux:latest /bin/bash -c "sh ${mntdir}/scripts/build-docker.sh archlinux"
#- docker run --rm -v $(pwd):${mntdir} ubuntu:16.04 /bin/bash -c "sh ${mntdir}/scripts/build-docker.sh snap"
#- docker run --rm -v $(pwd):${mntdir} --cap-add SYS_ADMIN --device /dev/fuse ubuntu:14.04 /bin/bash -c "sh ${mntdir}/scripts/build-docker.sh appimage"
......@@ -4,75 +4,33 @@ pipelines:
- step:
image: ubuntu:14.04
script:
- apt update -qq
- apt -y install sudo git curl
- apt -y install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev
- apt -y install devscripts debhelper fakeroot
- useradd -m pkgbuilder
- export HOME=/home/pkgbuilder
- chown -R pkgbuilder:pkgbuilder $(pwd)
- sudo -u pkgbuilder sh scripts/build.sh ubuntu
- sh scripts/build-docker.sh ubuntu
custom:
build-ubuntu:
- step:
image: ubuntu:14.04
script:
- apt update -qq
- apt -y install sudo git curl
- apt -y install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev
- apt -y install devscripts debhelper fakeroot
- useradd -m pkgbuilder
- export HOME=/home/pkgbuilder
- chown -R pkgbuilder:pkgbuilder $(pwd)
- sudo -u pkgbuilder sh scripts/build.sh ubuntu
- sh scripts/build-docker.sh ubuntu
build-fedora:
- step:
image: fedora:20
script:
# dnf >= fedora:22
- yum -y install sudo git curl
- yum -y install make automake gcc gcc-c++ libtool qt5-qtbase-devel qt5-qtsvg-devel qt5-qtdeclarative-devel
- yum -y install rpm-build
- useradd -m pkgbuilder
- export HOME=/home/pkgbuilder
- chown -R pkgbuilder:pkgbuilder $(pwd)
- sudo -u pkgbuilder sh scripts/build.sh fedora
- sh scripts/build-docker.sh fedora
build-archlinux:
- step:
image: base/archlinux:latest
script:
- pacman -Syu --noconfirm
- pacman -S --noconfirm sudo git curl
- pacman -S --noconfirm base-devel qt5-base qt5-svg qt5-declarative qt5-quickcontrols
- useradd -m pkgbuilder
- export HOME=/home/pkgbuilder
- chown -R pkgbuilder:pkgbuilder $(pwd)
- sudo -u pkgbuilder sh scripts/build.sh archlinux
- sh scripts/build-docker.sh archlinux
build-snap:
- step:
image: ubuntu:16.04
script:
- apt update -qq
- apt -y install sudo git curl
- apt -y install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev
- apt -y install snapcraft
- useradd -m pkgbuilder
- export HOME=/home/pkgbuilder
- chown -R pkgbuilder:pkgbuilder $(pwd)
- sudo -u pkgbuilder sh scripts/build.sh snap
- sh scripts/build-docker.sh snap
build-appimage:
- step:
image: ubuntu:14.04
script:
# Require docker run with --cap-add SYS_ADMIN --device /dev/fuse
# Require?: docker run with --cap-add SYS_ADMIN --device /dev/fuse
- echo 'appimage build is disabled currently'
- exit 1
- apt update -qq
- apt -y install sudo git curl
- apt -y install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev
- apt -y install fuse zsync desktop-file-utils
#- modprobe fuse
- useradd -m pkgbuilder
- export HOME=/home/pkgbuilder
- chown -R pkgbuilder:pkgbuilder $(pwd)
- sudo -u pkgbuilder sh scripts/build.sh appimage
- sh scripts/build-docker.sh appimage
#!/bin/bash
################################################################################
# This is wrapper script for build.sh use from inside docker container
################################################################################
PKGUSER='pkgbuilder'
BUILDTYPE=''
if [ "${1}" ]; then
BUILDTYPE="${1}"
fi
PROJDIR="$(cd "$(dirname "${0}")/../" && pwd)"
BUILDSCRIPT="${PROJDIR}/scripts/build.sh"
build_ubuntu() {
# docker-image: ubuntu:14.04
apt update -qq
apt -y install git curl
apt -y install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev
apt -y install devscripts debhelper fakeroot
useradd -m ${PKGUSER}
export HOME="/home/${PKGUSER}"
chown -R ${PKGUSER}:${PKGUSER} "${PROJDIR}"
su -c "sh ${BUILDSCRIPT} ${BUILDTYPE}" ${PKGUSER}
}
build_fedora() {
# docker-image: fedora:20
yum -y install git curl
yum -y install make automake gcc gcc-c++ libtool qt5-qtbase-devel qt5-qtsvg-devel qt5-qtdeclarative-devel
yum -y install rpm-build
# docker-image: fedora:22
#dnf -y install git curl
#dnf -y install make automake gcc gcc-c++ libtool qt5-qtbase-devel qt5-qtsvg-devel qt5-qtdeclarative-devel
#dnf -y install rpm-build
useradd -m ${PKGUSER}
export HOME="/home/${PKGUSER}"
chown -R ${PKGUSER}:${PKGUSER} "${PROJDIR}"
su -c "sh ${BUILDSCRIPT} ${BUILDTYPE}" ${PKGUSER}
}
build_archlinux() {
# docker-image: base/archlinux:latest
pacman -Syu --noconfirm
pacman -S --noconfirm git curl
pacman -S --noconfirm base-devel qt5-base qt5-svg qt5-declarative qt5-quickcontrols
useradd -m ${PKGUSER}
export HOME="/home/${PKGUSER}"
chown -R ${PKGUSER}:${PKGUSER} "${PROJDIR}"
su -c "sh ${BUILDSCRIPT} ${BUILDTYPE}" ${PKGUSER}
}
build_snap() {
# docker-image: ubuntu:16.04
apt update -qq
apt -y install git curl
apt -y install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev
apt -y install snapcraft
useradd -m ${PKGUSER}
export HOME="/home/${PKGUSER}"
chown -R ${PKGUSER}:${PKGUSER} "${PROJDIR}"
su -c "sh ${BUILDSCRIPT} ${BUILDTYPE}" ${PKGUSER}
}
build_appimage() {
# docker-image: ubuntu:14.04
apt update -qq
apt -y install git curl
apt -y install build-essential qt5-default libqt5svg5-dev qtdeclarative5-dev
apt -y install fuse zsync desktop-file-utils
modprobe fuse
useradd -m ${PKGUSER}
export HOME="/home/${PKGUSER}"
chown -R ${PKGUSER}:${PKGUSER} "${PROJDIR}"
su -c "sh ${BUILDSCRIPT} ${BUILDTYPE}" ${PKGUSER}
}
if [ "${BUILDTYPE}" = 'ubuntu' ]; then
build_ubuntu
elif [ "${BUILDTYPE}" = 'fedora' ]; then
build_fedora
elif [ "${BUILDTYPE}" = 'archlinux' ]; then
build_archlinux
elif [ "${BUILDTYPE}" = 'snap' ]; then
build_snap
elif [ "${BUILDTYPE}" = 'appimage' ]; then
build_appimage
else
echo "sh $(basename "${0}") [ubuntu|fedora|archlinux|snap|appimage]"
exit 1
fi
#!/bin/bash
################################################################################
# This is utility script to make distribution packages
# This is utility script to build distribution packages
################################################################################
PKGNAME='ocs-url'
......@@ -19,9 +19,6 @@ BUILDDIR="${PROJDIR}/build_${PKGNAME}_${BUILDVER}_${BUILDTYPE}"
SRCARCHIVE="${BUILDDIR}/${PKGNAME}.tar.gz"
################################################################################
# Utility functions
################################################################################
export_srcarchive() {
filepath="${1}"
$(cd "${PROJDIR}" && git archive --prefix="${PKGNAME}/" --output="${filepath}" HEAD)
......@@ -36,98 +33,65 @@ transfer_file() {
fi
}
################################################################################
# ubuntu
################################################################################
pre_ubuntu() {
build_ubuntu() {
cd "${PROJDIR}"
mkdir -p "${BUILDDIR}"
export_srcarchive "${SRCARCHIVE}"
}
build_ubuntu() {
tar -xzvf "${SRCARCHIVE}" -C "${BUILDDIR}"
cp -r "${PROJDIR}/pkg/ubuntu/debian" "${BUILDDIR}/${PKGNAME}"
cd "${BUILDDIR}/${PKGNAME}"
debuild -uc -us -b
}
post_ubuntu() {
transfer_file "$(find ${BUILDDIR} -type f -name "${PKGNAME}*.deb")"
}
################################################################################
# fedora
################################################################################
pre_fedora() {
build_fedora() {
cd "${PROJDIR}"
mkdir -p "${BUILDDIR}"
export_srcarchive "${SRCARCHIVE}"
}
build_fedora() {
mkdir "${BUILDDIR}/SOURCES"
mkdir "${BUILDDIR}/SPECS"
mv "${SRCARCHIVE}" "${BUILDDIR}/SOURCES"
cp "${PROJDIR}/pkg/fedora/${PKGNAME}.spec" "${BUILDDIR}/SPECS"
rpmbuild --define "_topdir ${BUILDDIR}" -bb "${BUILDDIR}/SPECS/${PKGNAME}.spec"
}
post_fedora() {
transfer_file "$(find ${BUILDDIR} -type f -name "${PKGNAME}*.rpm")"
}
################################################################################
# archlinux
################################################################################
pre_archlinux() {
build_archlinux() {
cd "${PROJDIR}"
mkdir -p "${BUILDDIR}"
export_srcarchive "${SRCARCHIVE}"
}
build_archlinux() {
cp "${PROJDIR}/pkg/archlinux/PKGBUILD" "${BUILDDIR}"
cd "${BUILDDIR}"
updpkgsums
makepkg -s
}
post_archlinux() {
transfer_file "$(find ${BUILDDIR} -type f -name "${PKGNAME}*.pkg.tar.xz")"
}
################################################################################
# snap
################################################################################
pre_snap() {
build_snap() {
cd "${PROJDIR}"
mkdir -p "${BUILDDIR}"
export_srcarchive "${SRCARCHIVE}"
}
build_snap() {
tar -xzvf "${SRCARCHIVE}" -C "${BUILDDIR}"
cp "${PROJDIR}/pkg/snap/snapcraft.yaml" "${BUILDDIR}/${PKGNAME}"
cp -r "${PROJDIR}/pkg/snap/setup" "${BUILDDIR}/${PKGNAME}"
cd "${BUILDDIR}/${PKGNAME}"
snapcraft
}
post_snap() {
transfer_file "$(find ${BUILDDIR} -type f -name "${PKGNAME}*.snap")"
}
################################################################################
# appimage
################################################################################
pre_appimage() {
build_appimage() {
cd "${PROJDIR}"
mkdir -p "${BUILDDIR}"
export_srcarchive "${SRCARCHIVE}"
}
build_appimage() {
tar -xzvf "${SRCARCHIVE}" -C "${BUILDDIR}"
cd "${BUILDDIR}/${PKGNAME}"
sh scripts/import.sh
......@@ -154,25 +118,20 @@ build_appimage() {
install -m 755 -p "${BUILDDIR}/${PKGNAME}/pkg/appimage/appimage-desktopintegration_${PKGNAME}" "${BUILDDIR}/${PKGNAME}.AppDir/AppRun"
./linuxdeployqt --appimage-extract
./squashfs-root/usr/bin/appimagetool "${BUILDDIR}/${PKGNAME}.AppDir"
}
post_appimage() {
transfer_file "$(find ${BUILDDIR} -type f -name "${PKGNAME}*.AppImage")"
}
################################################################################
# Make package
################################################################################
if [ "${BUILDTYPE}" = 'ubuntu' ]; then
pre_ubuntu && build_ubuntu && post_ubuntu
build_ubuntu
elif [ "${BUILDTYPE}" = 'fedora' ]; then
pre_fedora && build_fedora && post_fedora
build_fedora
elif [ "${BUILDTYPE}" = 'archlinux' ]; then
pre_archlinux && build_archlinux && post_archlinux
build_archlinux
elif [ "${BUILDTYPE}" = 'snap' ]; then
pre_snap && build_snap && post_snap
build_snap
elif [ "${BUILDTYPE}" = 'appimage' ]; then
pre_appimage && build_appimage && post_appimage
build_appimage
else
echo "sh $(basename "${0}") [ubuntu|fedora|archlinux|snap|appimage]"
exit 1
......
DISTFILES += \
$${PWD}/build-docker.sh \
$${PWD}/build.sh \
$${PWD}/import.sh
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment