Upgrade to libgit2-1.1.1-6
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
This commit is contained in:
parent
c5e2e5e30b
commit
80e1d243e6
|
@ -57,7 +57,11 @@ jobs:
|
||||||
with:
|
with:
|
||||||
go-version: 1.17.x
|
go-version: 1.17.x
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: make test
|
run: |
|
||||||
|
mkdir tmp-download; cd tmp-download; go mod init go-download;
|
||||||
|
GOBIN="${GITHUB_WORKSPACE}/build/gobin" go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
|
||||||
|
cd ..; rm -rf tmp-download
|
||||||
|
make test
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
id: prep
|
id: prep
|
||||||
run: |
|
run: |
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -4,7 +4,7 @@ TAG ?= latest
|
||||||
|
|
||||||
# Base image used to build the Go binary
|
# Base image used to build the Go binary
|
||||||
LIBGIT2_IMG ?= ghcr.io/fluxcd/golang-with-libgit2
|
LIBGIT2_IMG ?= ghcr.io/fluxcd/golang-with-libgit2
|
||||||
LIBGIT2_TAG ?= libgit2-1.1.1-4
|
LIBGIT2_TAG ?= libgit2-1.1.1-6
|
||||||
|
|
||||||
# Allows for defining additional Docker buildx arguments,
|
# Allows for defining additional Docker buildx arguments,
|
||||||
# e.g. '--push'.
|
# e.g. '--push'.
|
||||||
|
@ -35,13 +35,14 @@ export LIBRARY_PATH=$(LIBGIT2_LIB_PATH)
|
||||||
export CGO_CFLAGS=-I$(LIBGIT2_PATH)/include -I$(LIBGIT2_PATH)/include/openssl
|
export CGO_CFLAGS=-I$(LIBGIT2_PATH)/include -I$(LIBGIT2_PATH)/include/openssl
|
||||||
|
|
||||||
|
|
||||||
|
# The pkg-config command will yield warning messages until libgit2 is downloaded.
|
||||||
ifeq ($(shell uname -s),Darwin)
|
ifeq ($(shell uname -s),Darwin)
|
||||||
export CGO_LDFLAGS=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs --static --cflags libssh2 openssl libgit2)
|
export CGO_LDFLAGS=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs --static --cflags libssh2 openssl libgit2 2>/dev/null)
|
||||||
GO_STATIC_FLAGS=-ldflags "-s -w" -tags 'netgo,osusergo,static_build'
|
GO_STATIC_FLAGS=-ldflags "-s -w" -tags 'netgo,osusergo,static_build'
|
||||||
else
|
else
|
||||||
export PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH):$(LIBGIT2_LIB64_PATH)/pkgconfig
|
export PKG_CONFIG_PATH:=$(PKG_CONFIG_PATH):$(LIBGIT2_LIB64_PATH)/pkgconfig
|
||||||
export LIBRARY_PATH:=$(LIBRARY_PATH):$(LIBGIT2_LIB64_PATH)
|
export LIBRARY_PATH:=$(LIBRARY_PATH):$(LIBGIT2_LIB64_PATH)
|
||||||
export CGO_LDFLAGS=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs --static --cflags libssh2 openssl libgit2)
|
export CGO_LDFLAGS=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs --static --cflags libssh2 openssl libgit2 2>/dev/null)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,22 +47,37 @@ function setup_current() {
|
||||||
# For MacOS development environments, download the amd64 static libraries released from from golang-with-libgit2.
|
# For MacOS development environments, download the amd64 static libraries released from from golang-with-libgit2.
|
||||||
|
|
||||||
#TODO: update URL with official URL + TAG:
|
#TODO: update URL with official URL + TAG:
|
||||||
curl -o output.tar.gz -LO "https://github.com/pjbgf/golang-with-libgit2/releases/download/1.1.1-6/darwin-libs.tar.gz"
|
curl -o output.tar.gz -LO "https://github.com/fluxcd/golang-with-libgit2/releases/download/${TAG}/darwin-libs.tar.gz"
|
||||||
|
|
||||||
DIR=libgit2-darwin
|
DIR=libgit2-darwin
|
||||||
NEW_DIR="$(/bin/pwd)/build/libgit2/${TAG}"
|
NEW_DIR="$(/bin/pwd)/build/libgit2/${TAG}"
|
||||||
INSTALLED_DIR="/Users/runner/work/golang-with-libgit2/golang-with-libgit2/build/${DIR}-amd64"
|
INSTALLED_DIR="/Users/runner/work/golang-with-libgit2/golang-with-libgit2/build/${DIR}-amd64"
|
||||||
|
|
||||||
tar -xf output.tar.gz
|
tar -xf output.tar.gz
|
||||||
|
rm output.tar.gz
|
||||||
mv "${DIR}" "${TAG}"
|
mv "${DIR}" "${TAG}"
|
||||||
mv "${TAG}/" "./build/libgit2"
|
mv "${TAG}/" "./build/libgit2"
|
||||||
|
|
||||||
sed -i "" "s;-L/Applications/Xcode_12.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/lib ;;g" "$(/bin/pwd)/build/libgit2/${TAG}/lib/pkgconfig/libgit2.pc"
|
LIBGIT2_SED="s;-L/Applications/Xcode_.* ;;g"
|
||||||
|
LIBGIT2PC="$(/bin/pwd)/build/libgit2/${TAG}/lib/pkgconfig/libgit2.pc"
|
||||||
|
# Some macOS users may override their sed with gsed. If gsed is the PATH, use that instead.
|
||||||
|
if command -v gsed &> /dev/null; then
|
||||||
|
# Removes abs path from build machine, and let iconv be resolved automatically by default search paths.
|
||||||
|
gsed -i "${LIBGIT2_SED}" "${LIBGIT2PC}"
|
||||||
|
|
||||||
# Update the prefix paths included in the .pc files.
|
# Update the prefix paths included in the .pc files.
|
||||||
# This will make it easier to update to the location in which they will be used.
|
# This will make it easier to update to the location in which they will be used.
|
||||||
# sed has a sight different behaviour in MacOS
|
# sed has a sight different behaviour in MacOS
|
||||||
find "${NEW_DIR}" -type f -name "*.pc" | xargs -I {} sed -i "" "s;${INSTALLED_DIR};${NEW_DIR};g" {}
|
find "${NEW_DIR}" -type f -name "*.pc" | xargs -I {} gsed -i "s;${INSTALLED_DIR};${NEW_DIR};g" {}
|
||||||
|
else
|
||||||
|
# Removes abs path from build machine, and let iconv be resolved automatically by default search paths.
|
||||||
|
sed -i "" "${LIBGIT2_SED}" "${LIBGIT2PC}"
|
||||||
|
|
||||||
|
# Update the prefix paths included in the .pc files.
|
||||||
|
# This will make it easier to update to the location in which they will be used.
|
||||||
|
# sed has a sight different behaviour in MacOS
|
||||||
|
find "${NEW_DIR}" -type f -name "*.pc" | xargs -I {} sed -i "" "s;${INSTALLED_DIR};${NEW_DIR};g" {}
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
# for linux development environments, use the static libraries from the official container images.
|
# for linux development environments, use the static libraries from the official container images.
|
||||||
DIR="x86_64-alpine-linux-musl"
|
DIR="x86_64-alpine-linux-musl"
|
||||||
|
|
Loading…
Reference in New Issue