Browse Source

added some cross-compiled binary outputs to the autobuild (#850)

* Add an example cross compile build

* Harmonise the naming to reflect full architecture and if it is a real package or not

* Add some more example cross compile targets

* Only one RPM package is created, so use the singular word

* Dont use build triplet for OS packages, use the OS prefered arch name

* Add some cross compiling documentation to the Building.md
pull/855/head
Hamish Coleman 3 years ago
committed by GitHub
parent
commit
f5b730baed
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 69
      .github/workflows/tests.yml
  2. 28
      doc/Building.md

69
.github/workflows/tests.yml

@ -99,7 +99,7 @@ jobs:
package_dpkg: package_dpkg:
needs: fulltest needs: fulltest
name: Create packages for Debian/Ubuntu name: Package for Debian/Ubuntu
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -126,12 +126,12 @@ jobs:
- name: Upload dpkg - name: Upload dpkg
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: package-amd64-dpkg name: package-dpkg-amd64
path: packages/debian/*.deb path: packages/debian/*.deb
package_rpm: package_rpm:
needs: fulltest needs: fulltest
name: Create packages for Redhat name: Package for Redhat/RPM
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -162,12 +162,12 @@ jobs:
- name: Upload rpm - name: Upload rpm
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: package-amd64-rpm name: package-rpm-x86_64
path: rpmbuild/RPMS/x86_64/*.rpm path: rpmbuild/RPMS/x86_64/*.rpm
package_windows: package_windows:
needs: fulltest needs: fulltest
name: Create packages for Windows name: Binaries for Windows (x86_64-pc-mingw64)
runs-on: windows-latest runs-on: windows-latest
steps: steps:
@ -182,17 +182,17 @@ jobs:
- name: Create binary dir - name: Create binary dir
shell: bash shell: bash
run: | run: |
make install DESTDIR=package make install DESTDIR=binaries
- name: Upload binary zip - name: Upload binary zip
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: package-amd64-windows name: binaries-x86_64-pc-mingw64
path: package path: binaries
package_macos: package_macos:
needs: fulltest needs: fulltest
name: Create packages for MacOS name: Binaries for MacOS (x86_64-apple-darwin)
runs-on: macos-latest runs-on: macos-latest
steps: steps:
@ -212,10 +212,55 @@ jobs:
- name: Create binary dir - name: Create binary dir
shell: bash shell: bash
run: | run: |
make install DESTDIR=package make install DESTDIR=binaries
- name: Upload binary zip - name: Upload binary zip
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: package-amd64-macos name: binaries-x86_64-apple-darwin
path: package path: binaries
package_crosscompile_linux:
needs: fulltest
name: Binaries for linux
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
arch:
- arm-linux-gnueabi
# I assume these architectures produce working code, but this has
# not been directly confirmed.
# They are compiled dynamically against normal libc, so will not
# work on openwrt.
- aarch64-linux-gnu
- mips-linux-gnu
- mipsel-linux-gnu
steps:
- uses: actions/checkout@v2
- name: Install cross compiler
run: |
sudo apt-get install binutils-${{ matrix.arch }} gcc-${{ matrix.arch }}
- name: Configure and Build
shell: bash
run: |
./autogen.sh
export CC=${{ matrix.arch }}-gcc
export AR=${{ matrix.arch }}-ar
./configure --host ${{ matrix.arch }}
make
- name: Create binary dir
shell: bash
run: |
make install DESTDIR=binaries
- name: Upload binary zip
uses: actions/upload-artifact@v2
with:
name: binaries-${{ matrix.arch }}
path: binaries

28
doc/Building.md

@ -207,3 +207,31 @@ n2n network, this behavior can be disabled, just add
to your `CFLAGS` when configuring, e.g. to your `CFLAGS` when configuring, e.g.
`./configure --with-zstd CFLAGS="-O3 -march=native -DSKIP_MULTICAST_PEERS_DISCOVERY"` `./configure --with-zstd CFLAGS="-O3 -march=native -DSKIP_MULTICAST_PEERS_DISCOVERY"`
# Cross compiling on Linux
## Using the Makefiles and Autoconf
The Makefiles are all setup to allow cross compiling of this code. You
will need to have the cross compiler, binutils and any additional libraries
desired installed for the target architecture. Then you can run the `./configure`
with the appropriate CC and AR environment and the right `--host` option.
If compiling on Debian or Ubuntu, this can be as simple as the following example:
```
HOST_TRIPLET=arm-linux-gnueabi
sudo apt-get install binutils-$HOST_TRIPLET gcc-$HOST_TRIPLET
./autogen.sh
export CC=$HOST_TRIPLET-gcc
export AR=$HOST_TRIPLET-ar
./configure --host $HOST_TRIPLET
make
```
A good starting point to determine the host triplet for your destination platform
can be found by copying the `./config.guess` script to it and running it on the
destination.
This is not a good way to produce binaries for embedded environments (like OpenWRT)
as they will often use a different libc environment.

Loading…
Cancel
Save