diff options
author | Moses Narrow | 2022-08-19 13:23:01 -0500 |
---|---|---|
committer | Moses Narrow | 2022-08-19 13:23:01 -0500 |
commit | 17b532da0bce200dce53b6c7b731e72c55c49e99 (patch) | |
tree | 23715f19ebf6e50f05d4b0c1b488d8dbe83288e0 | |
parent | 2aed8ed476654be2b87e3b13ab45680970f04d93 (diff) | |
download | aur-17b532da0bce200dce53b6c7b731e72c55c49e99.tar.gz |
add cc.dev.PKGBUILD to create testing .deb package of skywire-bin
-rw-r--r-- | cc.dev.PKGBUILD | 231 | ||||
-rwxr-xr-x | updates.sh | 1 |
2 files changed, 232 insertions, 0 deletions
diff --git a/cc.dev.PKGBUILD b/cc.dev.PKGBUILD new file mode 100644 index 000000000000..68c207c68c63 --- /dev/null +++ b/cc.dev.PKGBUILD @@ -0,0 +1,231 @@ + # Maintainer: Moses Narrow <moe_narrow@use.startmail.com> +# Maintainer: Rudi [KittyCash] <rudi@skycoinmail.com> +_projectname=skycoin +pkgname=skywire-bin +_pkgname=${pkgname/-bin/} +_githuborg=${_projectname} +pkgdesc="Skywire Mainnet Node implementation; develop branch - Debian testing package." +_pkggopath="github.com/${_githuborg}/${_pkgname}" +pkgver='1.1.0' +pkgrel=1 +#pkgrel=1 +_pkgarch=$(dpkg --print-architecture) +_pkgarches=('armhf' 'arm64' 'amd64' 'armel') +_pkgver=${pkgver} +_pkgrel=${pkgrel} +arch=( 'i686' 'x86_64' 'aarch64' 'armv8' 'armv7' 'armv7l' 'armv7h' 'armv6h' 'armhf' 'armel' 'arm' ) +url="https://${_pkggopath}" +license=() +makedepends=('dpkg' 'git' 'go' 'musl' 'kernel-headers-musl' 'aarch64-linux-musl' 'arm-linux-gnueabihf-musl') +depends=() +_debdeps="" +install=skywire.install +source=("git+${url}.git#branch=develop" +"skywire-autoconfig" +"com.skywire.Skywire.desktop" +"com.skywirevpn.SkywireVPN.desktop" +"skywirevpn.png" +"skywire.png" +"skywire.service" +"skywire-autoconfig.service" +"postinst.sh" +"prerm.sh" +) +sha256sums=('SKIP' + '57eeac39adb3d801ca0cac5c069fdc14add4e9c182569b58fcc4d41aac8efec4' + 'f0300bcde06b6818b637ccc23fa8206a40e67f63815781d265bd10d2cda93e65' + 'e6ea2c7471bcf5bc83e8fd831c047ba61b98eab58ca7c055475714dcf6066539' + 'ec24750a99f5cda8d8a8dc94743943218e1b2088c2b2c7dc1644ee78d954fe7e' + 'a6941680b5858ca3e0c85d9bf5824455a0c95524b61e42352462f2abbb750495' + 'c8d9f7394763997bb3917c55dd288d431d7054c7f1edec55540a4c02600dd7d3' + '55293e05c5d6c877397eb4c52123bb02e8bc92aeaf663ba70e1cfab318ce727c' + '7b17a55e64d1371fecd24edc3da7c6a762cf2b3d058f6fc4a5dc7c5f9b4cff09' + '233ccf0e87b37e782828f53960e05e478cf381f61bbfdb16a0cc0254ee8be7c2') + +pkgver() { +_version=$(git ls-remote --tags --refs --sort="version:refname" ${url}.git | tail -n1) +_version=${_version##*/} +_version=${_version%%-*} +_version=${_version//v/} +echo ${_version} +} + +prepare() { +for _i in ${_pkgarches[@]}; do +_msg2 "$_i" +done +# https://wiki.archlinux.org/index.php/Go_package_guidelines +mkdir -p ${srcdir}/go/src/github.com/${_githuborg}/ +for _i in ${_pkgarches[@]}; do +mkdir -p ${srcdir}/go/bin.${_i} +mkdir -p ${srcdir}/go/apps.${_i} +done +ln -rTsf ${srcdir}/${_pkgname} ${srcdir}/go/src/${_pkggopath} +cd ${srcdir}/go/src/${_pkggopath}/ +} + +build() { +export GOPATH=${srcdir}/go +export GOOS=linux +export CGO_ENABLED=1 #default anyways + +local _version="${pkgver}" +DMSG_BASE="github.com/skycoin/dmsg" +BUILDINFO_PATH="${DMSG_BASE}/buildinfo" +BUILDINFO_VERSION="${BUILDINFO_PATH}.version=${_version}" +BUILDINFO=${BUILDINFO_VERSION} ${BUILDINFO_DATE} ${BUILDINFO_COMMIT} +#use musl-gcc for static compilation +for _i in ${_pkgarches[@]}; do +msg2 "_pkgarch=$_i" +local _pkgarch=$_i +export GOBIN=${GOPATH}/bin.${_pkgarch} +export _GOAPPS=${GOPATH}/apps.${_pkgarch} +export GOOS=linux +#static cross-compilation +[[ $_pkgarch == "amd64" ]] && export GOARCH=amd64 && export CC=musl-gcc +[[ $_pkgarch == "arm64" ]] && export GOARCH=arm64 && export CC=aarch64-linux-musl-gcc +[[ $_pkgarch == "armhf" ]] && export GOARCH=arm && export GOARM=6 && export CC=arm-linux-gnueabihf-musl-gcc +[[ $_pkgarch == "armel" ]] && export GOARCH=arm && export GOARM=5 && export CC=arm-linux-gnueabihf-musl-gcc +#_ldflags=('-linkmode external -extldflags "-static" -buildid=') +#create the skywire binaries + + +#create the skywire binaries +cd ${srcdir}/go/src/${_pkggopath} +_cmddir=${srcdir}/go/src/${_pkggopath}/cmd + +_msg2 "building skychat binary" +cd ${_cmddir}/apps/skychat +go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $_GOAPPS . +_msg2 "building skysocks binary" +cd ${_cmddir}/apps/skysocks +go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $_GOAPPS . +_msg2 "building skysocks-client binary" +cd ${_cmddir}/apps/skysocks-client +go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $_GOAPPS . +_msg2 "building vpn-client binary" +cd ${_cmddir}/apps/vpn-client +go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $_GOAPPS . +_msg2 "building vpn-server binary" +cd ${_cmddir}/apps/vpn-server +go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $_GOAPPS . +_msg2 "building skywire-cli binary" +cd ${_cmddir}/skywire-cli +go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $GOBIN . +_msg2 "building skywire-visor binary" +cd ${_cmddir}/skywire-visor +go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $GOBIN . +_msg2 "building setup-node binary" +cd ${_cmddir}/setup-node +go build -trimpath --ldflags="" --ldflags "${BUILDINFO} -s -w -linkmode external -extldflags '-static' -buildid=" -o $GOBIN . + +#binary transparency +cd $GOBIN +_msg2 'binary sha256sums' +echo -e "$_pkgarch" +sha256sum $(ls) +cd $_GOAPPS +sha256sum $(ls) + +_msg2 'creating the DEBIAN/control files' +#create control file for the debian package +#this is not actually a binary release but is used for pre-release testing, so must have the same name +echo "Package: skywire-bin" > ${srcdir}/${_pkgarch}.control +echo "Version: ${_pkgver}-${_pkgrel}" >> ${srcdir}/${_pkgarch}.control +echo "Priority: optional" >> ${srcdir}/${_pkgarch}.control +echo "Section: web" >> ${srcdir}/${_pkgarch}.control +echo "Architecture: ${_pkgarch}" >> ${srcdir}/${_pkgarch}.control +echo "Depends: ${_debdeps}" >> ${srcdir}/${_pkgarch}.control +echo "Maintainer: github.com/the-skycoin-project" >> ${srcdir}/${_pkgarch}.control +echo "Description: ${pkgdesc}" >> ${srcdir}/${_pkgarch}.control + done +} + +package() { +for _i in ${_pkgarches[@]}; do +msg2 "_pkgarch=${_i}" +local _pkgarch=${_i} +GOPATH=${srcdir}/go +GOBIN=${GOPATH}/bin.${_pkgarch} +_GOAPPS=${GOPATH}/apps.${_pkgarch} +_msg2 'creating dirs' +#set up to create a .deb package +_debpkgdir="${_pkgname}-${pkgver}-${_pkgrel}-${_pkgarch}" +_pkgdir="${pkgdir}/${_debpkgdir}" +_skydir="opt/skywire" +_skyapps="${_skydir}/apps" +_skyscripts="${_skydir}/scripts" +_systemddir="etc/systemd/system" +_skybin="${_skydir}/bin" +[[ -d ${_pkgdir} ]] && rm -rf ${_pkgdir} +mkdir -p ${_pkgdir}/usr/bin +mkdir -p ${_pkgdir}/${_skydir}/bin +mkdir -p ${_pkgdir}/${_skydir}/apps +mkdir -p ${_pkgdir}/${_skydir}/local +mkdir -p ${_pkgdir}/${_skydir}/scripts +mkdir -p ${_pkgdir}/${_systemddir} + +cd $_pkgdir +_msg2 'installing binaries' + install -Dm755 ${GOBIN}/* ${_pkgdir}/${_skybin}/ +for _j in ${_pkgdir}/${_skybin}/* ; do + ln -rTsf ${_j} ${_pkgdir}/usr/bin/${_j##*/} +done + +_msg2 'installing app binaries' +_apps=${pkgdir}/test/apps +install -Dm755 ${_GOAPPS}/* ${_pkgdir}/${_skyapps}/ +for _j in ${_pkgdir}/${_skyapps}/* ; do + ln -rTsf ${_j} ${_pkgdir}/usr/bin/${_j##*/} +done + +_msg2 'Installing scripts' +install -Dm755 ${srcdir}/skywire-autoconfig ${_pkgdir}/${_skyscripts}/ +ln -rTsf ${_pkgdir}/${_skyscripts}/skywire-autoconfig ${_pkgdir}/usr/bin/skywire-autoconfig + +_msg2 'Correcting symlink names' +ln -rTsf ${_pkgdir}/${_skybin}/${_pkgname}-visor ${_pkgdir}/usr/bin/${_pkgname} + +#make sure everything is executable +chmod +x ${_pkgdir}/usr/bin/* + +_msg2 'installing dmsghttp-config.json' +install -Dm644 ${srcdir}/${_pkgname}/dmsghttp-config.json ${_pkgdir}/${_skydir}/dmsghttp-config.json + +#install systemd services +_msg2 'Installing systemd services' +install -Dm644 ${srcdir}/*.service ${_pkgdir}/${_systemddir}/ + +_msg2 'installing desktop files and icons' +mkdir -p ${_pkgdir}/usr/share/applications/ ${_pkgdir}/usr/share/icons/hicolor/48x48/apps/ +install -Dm644 ${srcdir}/*.desktop ${_pkgdir}/usr/share/applications/ +install -Dm644 ${srcdir}/*.png ${_pkgdir}/usr/share/icons/hicolor/48x48/apps/ + +_msg2 'installing control file and install scripts' +install -Dm755 ${srcdir}/${_pkgarch}.control ${_pkgdir}/DEBIAN/control +#install -Dm755 ${srcdir}/${_scripts}/preinst.sh ${_pkgdir}/DEBIAN/preinst +install -Dm755 ${srcdir}/postinst.sh ${_pkgdir}/DEBIAN/postinst +install -Dm755 ${srcdir}/prerm.sh ${_pkgdir}/DEBIAN/prerm +#install -Dm755 ${srcdir}/${_scripts}/postrm.sh ${_pkgdir}/DEBIAN/postrm + +_msg2 'creating the debian package' +#create the debian package +cd $pkgdir +dpkg-deb --build -z9 ${_debpkgdir} +mv *.deb ../../ +done +#exit so the arch package doesn't get built +exit +} + +_msg2() { +(( QUIET )) && return +local mesg=$1; shift +printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" +} + +_msg3() { +(( QUIET )) && return +local mesg=$1; shift +printf "${BLUE} -->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" +} diff --git a/updates.sh b/updates.sh index 779fa27b0740..55086d0110f7 100755 --- a/updates.sh +++ b/updates.sh @@ -24,6 +24,7 @@ echo ${_vrc} echo "updating checksums and version for PKGBUILD" sed -i "s/^pkgver=.*/pkgver='${_version}'/" PKGBUILD && sed -i "s/^_rc=.*/_rc='${_vrc}'/" PKGBUILD && updpkgsums [[ -f cc.deb.PKGBUILD ]] && echo "updating checksums and version for cc.deb.PKGBUILD" && sed -i "s/^pkgver=.*/pkgver='${_version}'/" cc.deb.PKGBUILD && sed -i "s/^_rc=.*/_rc='${_vrc}'/" cc.deb.PKGBUILD && updpkgsums cc.deb.PKGBUILD && _ccdebPKGBUILD="cc.deb.PKGBUILD" +[[ -f cc.dev.PKGBUILD ]] && echo "updating checksums and version for cc.dev.PKGBUILD" && sed -i "s/^pkgver=.*/pkgver='${_version}'/" cc.dev.PKGBUILD && sed -i "s/^_rc=.*/_rc='${_vrc}'/" cc.dev.PKGBUILD && updpkgsums cc.dev.PKGBUILD && _ccdebPKGBUILD="cc.dev.PKGBUILD" [[ -f deb.PKGBUILD ]] &&echo "updating checksums and version for deb.PKGBUILD" && sed -i "s/^pkgver=.*/pkgver='${_version}'/" deb.PKGBUILD && sed -i "s/^_rc=.*/_rc='${_vrc}'/" deb.PKGBUILD && updpkgsums deb.PKGBUILD && _debPKGBUILD="deb.PKGBUILD" [[ -f dev.PKGBUILD ]] && echo "updating checksums and version for dev.PKGBUILD" && sed -i "s/^pkgver=.*/pkgver='autogenerated'/" dev.PKGBUILD && updpkgsums dev.PKGBUILD && _devPKGBUILD="dev.PKGBUILD" [[ -f git.PKGBUILD ]] && echo "updating checksums and version for git.PKGBUILD" && sed -i "s/^pkgver=.*/pkgver='autogenerated'/" git.PKGBUILD && updpkgsums git.PKGBUILD && _gitPKGBUILD="git.PKGBUILD" |