diff --git a/build-go.sh b/build-go.sh index 7715161e..c590282b 100755 --- a/build-go.sh +++ b/build-go.sh @@ -94,6 +94,8 @@ function goBuild() { local package="$1" local goos="$2" local goarch="$3" + local plugin="$4" + ( export GOOS="$goos" if [[ "$goarch" == amd64-* ]]; then @@ -106,10 +108,21 @@ function goBuild() { local output output="$(pwd)/$(basename "$package")$(go env GOEXE)" - go build -mod=mod -o "$output" \ + + local buildmode="default" + if [ "$plugin" = "true" ]; then + export CGO_ENABLED=1 + buildmode="plugin" + fi + + go build -buildmode="$buildmode" -mod=mod -o "$output" \ -trimpath \ "${package}" + if [ "$buildmode" = "plugin" ]; then + chmod +x "$output" + fi + if [ -x "$(which glibc-check)" ] && [ "$GOOS" == "linux" ] && [ "$GOARCH" == "amd64" ]; then echo "GLIBC versions:" glibc-check list-versions "$output" @@ -124,6 +137,7 @@ function doBuild() { local package=$3 local output=$4 local version=$5 + local plugin=$6 local dir name binname @@ -144,7 +158,7 @@ function doBuild() { mkdir -p "$dir" - if ! (cd "$build_dir_name" && goBuild "$package" "$goos" "$goarch") > build-log; then + if ! (cd "$build_dir_name" && goBuild "$package" "$goos" "$goarch" "$plugin") > build-log; then local logfi="$dir/build-log-$goos-$goarch" cp "$build_dir_name/build-log" "$logfi" warn " $binname failed. logfile at '$logfi'" @@ -211,6 +225,7 @@ function printInitialDistfile() { "owner": "$(< repo-owner)", "description": "$(< description)", "date": "$(date -u '+%B %d, %Y')", + "plugin": "$plugin", "platforms": {} } EOF @@ -240,13 +255,19 @@ function buildWithMatrix() { local distname distname=$(basename "$(pwd)") + local plugin="false" + if [ -e plugin ]; then + plugin="true" + fi + + printInitialDistfile "$distname" "$buildVersion" > dist.json printBuildInfo "$commit" > "$output/build-info" # build each os/arch combo while read -r goos goarch do - doBuild "$goos" "$goarch" "$package" "$output" "$buildVersion" + doBuild "$goos" "$goarch" "$package" "$output" "$buildVersion" "$plugin" done < "$matfile" # build the source @@ -451,7 +472,7 @@ function startGoBuilds() { if [ "$GO111MODULE" == "on" ]; then # Setup version information so we can build with go mod go mod init "ipfs-distributions" - go mod edit -require "$repo@$(git -C "$repopath" rev-parse HEAD)" + go mod edit -require "$repo/$package@$version" fi buildWithMatrix "$matfile" "$repo/$package" "$outputVersion" "$(currentSha "$repopath")" "$buildVersion" diff --git a/dists/nopfs/Makefile b/dists/nopfs/Makefile new file mode 100644 index 00000000..8ff184db --- /dev/null +++ b/dists/nopfs/Makefile @@ -0,0 +1,5 @@ +repo = github.com/ipfs-shipyard/nopfs +# sub-package to build (omit when building the main package) +package = nopfs-kubo-plugin + +include ../../common.mk diff --git a/dists/nopfs/build_matrix b/dists/nopfs/build_matrix new file mode 100644 index 00000000..6eb46b1b --- /dev/null +++ b/dists/nopfs/build_matrix @@ -0,0 +1 @@ +linux amd64 diff --git a/dists/nopfs/current b/dists/nopfs/current new file mode 100644 index 00000000..e97fd146 --- /dev/null +++ b/dists/nopfs/current @@ -0,0 +1 @@ +v0.21.0-rc2 \ No newline at end of file diff --git a/dists/nopfs/description b/dists/nopfs/description new file mode 100644 index 00000000..971124d3 --- /dev/null +++ b/dists/nopfs/description @@ -0,0 +1 @@ +NOpfs provides content-blocking-layer capabilities for IPFS (Kubo) diff --git a/dists/nopfs/plugin b/dists/nopfs/plugin new file mode 100644 index 00000000..e69de29b diff --git a/dists/nopfs/repo-owner b/dists/nopfs/repo-owner new file mode 100644 index 00000000..2353e13e --- /dev/null +++ b/dists/nopfs/repo-owner @@ -0,0 +1 @@ +ipfs-shipyard diff --git a/dists/nopfs/versions b/dists/nopfs/versions new file mode 100644 index 00000000..ad64ac8e --- /dev/null +++ b/dists/nopfs/versions @@ -0,0 +1,2 @@ +v0.21.0-rc1.3 +v0.21.0-rc2 diff --git a/dists/nopfs/vtag b/dists/nopfs/vtag new file mode 100644 index 00000000..49dbfb90 --- /dev/null +++ b/dists/nopfs/vtag @@ -0,0 +1 @@ +nopfs-kubo-plugin