Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only use one build machine for all architectures #5

Open
probonopd opened this issue Nov 2, 2019 · 1 comment
Open

Only use one build machine for all architectures #5

probonopd opened this issue Nov 2, 2019 · 1 comment

Comments

@probonopd
Copy link
Owner

With the cross-compiler built into Go, it should be possible to only use one build machine for all architectures, hence saving Travis CI resources.

However, as long as we are using come C (currently for the calculation of the ELF size), we need to install a C crosscompiler toolchain, and this is where the usual Linux complexity begins.

dist: xenial
language: go

go:
- "1.13"

git:
  depth: 1

script:
  - sudo apt-get -y update
  - sudo apt-get -y install gcc-multilib g++-multilib gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu psmisc dbus-x11
  - if [ $(go env GOHOSTARCH) == "amd64" ] ; then wget -c -q https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz ; fi
  - if [ $(go env GOHOSTARCH) == "arm64" ] ; then wget -c -q https://github.com/upx/upx/releases/download/v3.95/upx-3.95-arm64_linux.tar.xz ; fi
  - tar xf upx-*_linux.tar.xz
  - export PATH=$(readlink -f upx-*_linux/):$PATH
  - export GO111MODULE=off # Needed?
  - go get github.com/probonopd/appimage/src/appimagetool
  - env CGO_ENABLED=1 GOOS=linux GOARCH=386 go build -trimpath -ldflags="-s -w" github.com/probonopd/appimage/src/appimaged
  - upx -9 appimagetool
  - mv ./appimagetool ./appimagetool-386
  - go build -trimpath -ldflags="-s -w" appimagetool.go
  - upx -9 appimagetool
  - mv ./appimagetool ./appimagetool-amd64
  - env CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm32 go build -trimpath -ldflags="-s -w" github.com/probonopd/appimage/src/appimaged
  - upx -9 appimagetool
  - mv ./appimagetool ./appimagetool-arm32
  - env CC=aarch64-linux-gnu CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="-s -w" github.com/probonopd/appimage/src/appimaged
  - upx -9 appimagetool
  - mv ./appimagetool ./appimagetool-arm64
  - go get github.com/probonopd/appimage/src/zsyncmake
  - env CGO_ENABLED=1 GOOS=linux GOARCH=386 go build -trimpath -ldflags="-s -w" github.com/probonopd/appimage/src/appimaged
  - upx -9 zsyncmake
  - mv ./zsyncmake ./zsyncmake-386
  - go build -trimpath -ldflags="-s -w" zsyncmake.go
  - upx -9 zsyncmake
  - mv ./zsyncmake ./zsyncmake-amd64
  - env CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm32 go build -trimpath -ldflags="-s -w" github.com/probonopd/appimage/src/appimaged
  - upx -9 zsyncmake
  - mv ./zsyncmake ./zsyncmake-arm32
  - env CC=aarch64-linux-gnu CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="-s -w" github.com/probonopd/appimage/src/appimaged
  - upx -9 zsyncmake
  - mv ./zsyncmake ./zsyncmake-arm64
  - go get github.com/probonopd/appimage/src/appimaged
  - env CGO_ENABLED=1 GOOS=linux GOARCH=386 go build -trimpath -ldflags="-s -w" github.com/probonopd/appimage/src/appimaged
  - upx -9 appimaged
  - mv ./appimaged ./appimaged-386
  - go build -trimpath -ldflags="-s -w" appimaged.go
  - upx -9 appimaged
  - mv ./appimaged ./appimaged-amd64
  - env CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm32 go build -trimpath -ldflags="-s -w" github.com/probonopd/appimage/src/appimaged
  - upx -9 appimaged
  - mv ./appimaged ./appimaged-arm32
  - env CC=aarch64-linux-gnu CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -trimpath -ldflags="-s -w" github.com/probonopd/appimage/src/appimaged
  - upx -9 appimaged
  - mv ./appimaged ./appimaged-arm64
  # Test run
  - ./appimaged-amd64 &
  - sleep 10
  - killall appimaged

after_success:
  - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
  - bash upload.sh *.386 *amd64 *arm32 *arm64
  
branches:
  except:
    - # Do not build tags that we create when we upload to GitHub Releases
    - /^(?i:continuous)/

#cache:
#  directories:
#    - $HOME/gopath/src
The following packages have unmet dependencies:
 gcc-aarch64-linux-gnu : Depends: gcc-5-aarch64-linux-gnu (>= 5.3.1-3~)
 gcc-arm-linux-gnueabi : Depends: gcc-5-arm-linux-gnueabi (>= 5.3.1-3~)
E: Unable to correct problems, you have held broken packages.

We should definitely revisit this once we do not use any C anymore.

@probonopd
Copy link
Owner Author

Blocked by #6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant