Skip to content

Support cross-building for 32-bit arm #92

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ matrix:
dist: trusty
sudo: required
env: RID=linux-x64
- os: linux
dist: trusty
sudo: required
env: RID=ubuntu.16.04-arm
- os: linux
dist: trusty
sudo: required
Expand All @@ -25,6 +29,10 @@ matrix:
dist: trusty
sudo: required
env: RID=debian.9-x64
- os: linux
dist: trusty
sudo: required
env: RID=debian-arm
- os: linux
dist: trusty
sudo: required
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.arm.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SET(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(TARGET_ABI "linux-gnueabihf")

SET(CMAKE_C_COMPILER ${CMAKE_SYSTEM_PROCESSOR}-${TARGET_ABI}-gcc)
SET(CMAKE_CXX_COMPILER ${CMAKE_SYSTEM_PROCESSOR}-${TARGET_ABI}-g++)
14 changes: 14 additions & 0 deletions Dockerfile.debian-arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM debian:9

WORKDIR /nativebinaries
COPY . /nativebinaries/

RUN dpkg --add-architecture armhf

RUN apt update \
&& apt -y install cmake pkg-config \
crossbuild-essential-armhf \
# pkg-config-arm-linux-gnueabi \
libssl-dev:armhf

CMD ["/bin/bash", "-c", "./build.libgit2.sh"]
17 changes: 17 additions & 0 deletions Dockerfile.ubuntu.16.04-arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:16.04

WORKDIR /nativebinaries
COPY . /nativebinaries/

RUN dpkg --add-architecture armhf \
&& sed -i 's/deb/deb [arch=amd64]/g' /etc/apt/sources.list \
&& echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports xenial main universe" > /etc/apt/sources.list.d/armhf.list \
&& echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports xenial-updates main universe" > /etc/apt/sources.list.d/armhf-updates.list

RUN apt update \
&& apt -y install cmake pkg-config \
crossbuild-essential-armhf \
pkg-config-arm-linux-gnueabi \
libssl-dev:armhf

CMD ["/bin/bash", "-c", "./build.libgit2.sh"]
4 changes: 4 additions & 0 deletions build.libgit2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ pushd libgit2/build

export _BINPATH=`pwd`

if [[ $RID == *arm ]]; then
export TOOLCHAIN_FILE=/nativebinaries/CMakeLists.arm.txt
fi

if [[ $RID == *arm64 ]]; then
export TOOLCHAIN_FILE=/nativebinaries/CMakeLists.arm64.txt
fi
Expand Down