-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jenkins: fix cleanup permission issue (#19)
* arm64 support Replace build.sh script by Makefile (god help us) so part of it can be run on a different platform or container. The new release contains 2 binaries, one for each of the supported platforms. I tested this on a Dragonboard 410c. * jenkins: fix cleanup permission
- Loading branch information
Showing
6 changed files
with
103 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
SHELL = /bin/bash | ||
|
||
ifndef GOMODCACHE | ||
$(eval GOMODCACHE=$(shell go env | grep GOMODCACHE | sed -E 's/GOMODCACHE="(.*)"/\1/')) | ||
endif | ||
|
||
UID := $(shell id -u) | ||
|
||
tmp/uplink-c: | ||
mkdir -p tmp | ||
git clone --branch v1.5.0 https://github.com/storj/uplink-c.git ./tmp/uplink-c | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf build tmp | ||
|
||
build/libuplink-x86_64-linux.so tmp/uplink-c/.build/uplink/uplink.h tmp/uplink-c/.build/uplink/uplink_definitions.h: tmp/uplink-c | ||
cd tmp/uplink-c && make build | ||
mkdir -p build | ||
cat tmp/uplink-c/.build/libuplink.so > build/libuplink-x86_64-linux.so | ||
|
||
build/libuplink-aarch64-linux.so: tmp/uplink-c | ||
docker run --rm \ | ||
-v $(GOMODCACHE):/go/pkg/mod \ | ||
-v $(PWD)/tmp:$(PWD)/tmp \ | ||
--workdir $(PWD)/tmp/uplink-c \ | ||
-e CGO_ENABLED=1 \ | ||
docker.elastic.co/beats-dev/golang-crossbuild:1.17.1-arm \ | ||
--build-cmd "useradd --create-home --uid $(UID) jenkins && su jenkins -c 'PATH=\$$PATH:/go/bin:/usr/local/go/bin make build'" \ | ||
-p "linux/arm64" | ||
mkdir -p build | ||
cat ./tmp/uplink-c/.build/libuplink.so > build/libuplink-aarch64-linux.so | ||
|
||
build/uplink-php.h: tmp/uplink-c/.build/uplink/uplink.h tmp/uplink-c/.build/uplink/uplink_definitions.h | ||
## create C header file | ||
cat ./tmp/uplink-c/.build/uplink/uplink_definitions.h \ | ||
./tmp/uplink-c/.build/uplink/uplink.h \ | ||
> build/uplink-php.h | ||
## remove stuff PHP can't handle | ||
sed -i 's/typedef __SIZE_TYPE__ GoUintptr;//g' build/uplink-php.h | ||
sed -i 's/typedef float _Complex GoComplex64;//g' build/uplink-php.h | ||
sed -i 's/typedef double _Complex GoComplex128;//g' build/uplink-php.h | ||
sed -i 's/#ifdef __cplusplus//g' build/uplink-php.h | ||
sed -i 's/extern "C" {//g' build/uplink-php.h | ||
sed -i 's/#endif//g' build/uplink-php.h | ||
sed -zi 's/}\n//g' build/uplink-php.h | ||
|
||
.PHONY: | ||
build: build-x64 build-arm64 | ||
|
||
.PHONY: | ||
build-x64: build/libuplink-x86_64-linux.so build/uplink-php.h | ||
|
||
.PHONY: | ||
build-arm64: build/libuplink-aarch64-linux.so build/uplink-php.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM golang:1.17.2 | ||
|
||
RUN apt update | ||
RUN apt install -y docker.io |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters