Build binaries from source - YunoHost-Apps/galene_ynh GitHub Wiki

Build Galène binaries

#!/bin/bash

version=0.5.2
archs=(amd64 i386 arm7 arm64)

curl https://codeload.github.com/jech/galene/tar.gz/galene-$version > galene.tar.gz
tar -zxf galene.tar.gz
mv galene-galene-$version galene
touch checksums.txt

for arch in ${archs[@]}; do
	cp -R galene galene_$arch
	cd galene_$arch
    
    echo "Building $arch binary..."
	if [ $arch = arm7 ]
	then
		CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags='-s -w'
	else
		CGO_ENABLED=0 GOOS=linux GOARCH=$arch go build -ldflags='-s -w'
	fi
	cd ..
    echo "Compacting $arch folder and generating shasum..."
	tar -czf galene_${version}_Linux_${arch}.tar.gz galene_$arch
	shasum -a 256 galene_${version}_Linux_${arch}.tar.gz >> checksums.txt
	rm -rf galene_${arch}
    echo "Done with $arch!"
done

rm -rf galene galene.tar.gz
echo
echo "Done all the tarballs!"