This project is now deprecated, please use https://github.com/muquit/go-xbuild-go instead
A bash script to ross compile Go projects without the complexity of GoReleaser. For Go port of this script, please look at: https://github.com/muquit/go-xbuild-go
It was written from the frustration of using GoReleaser. I don't release often, whenever the time comes to release using GoReleaser, something has changed. I got tired of dealing with GoReleaser's complexity when I only release software occasionally. When I release every 6-12 months or so, GoReleaser's config often needs updates due to changes. This simple script just works.
- Simple to use and maintain
- Cross compile for multiple platforms
- Special handling for Raspberry Pi (modern and Jessie)
- Generates checksums
- Creates archives (ZIP for Windows, tar.gz for others)
- No complex configuration files
- Just uncomment platforms in platforms.txt to build for them
- Go installed
- Bash shell
git clone https://github.com/muquit/go-xbuild.git
cp go-xbuild/go-xbuild.sh /your/go/project/
cp go-xbuild/platforms.txt /your/go/project/
- Copy go-xbuild.sh and platforms.txt to your project root
- Create a VERSION file with your version (e.g., v1.0.1)
- Edit platforms.txt to uncomment the platforms you want to build for
go programs can be cross compiled for more than 40 platforms. A few lines of platforms.txt is shown below:
########################################################################
# GOOS/GOARCH
# generated by running: go tool dist list
# Uncomment or add platforms if needed
########################################################################
#aix/ppc64
#android/386
darwin/amd64
darwin/arm64
windows/amd64
#linux/386
linux/amd64
#linux/arm
#linux/arm64
...
./go-xbuild.sh
The script will:
- Detect your project name from the directory
- Read version from VERSION file
- Build for all uncommented platforms in platforms.txt
- Create appropriate archives (ZIP for Windows, tar.gz for others)
- Generate checksums for all archives
- Place all artifacts in ./bin directory
bin/
├── project-v1.0.0-darwin-amd64.d.tar.gz
├── project-v1.0.0-darwin-arm64.d.tar.gz
├── project-v1.0.0-windows-amd64.d.zip
├── project-v1.0.0-linux-amd64.d.tar.gz
├── project-v1.0.0-raspberry-pi.d.tar.gz
├── project-v1.0.0-raspberry-pi-jessie.d.tar.gz
└── project-v1.0.0-checksums.txt
The following files will be included in archives if they exist:
- Compiled binary
- README.md
- LICENSE.txt
- docs/project-name.1 (man page)
Pull requests welcome! Please keep it simple.
MIT License - See LICENSE.txt file for details.