Skip to content
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

Nopfs plugin builds (DNM) #857

Closed
wants to merge 6 commits 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
29 changes: 25 additions & 4 deletions build-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -124,6 +137,7 @@ function doBuild() {
local package=$3
local output=$4
local version=$5
local plugin=$6

local dir name binname

Expand All @@ -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'"
Expand Down Expand Up @@ -211,6 +225,7 @@ function printInitialDistfile() {
"owner": "$(< repo-owner)",
"description": "$(< description)",
"date": "$(date -u '+%B %d, %Y')",
"plugin": "$plugin",
"platforms": {}
}
EOF
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions dists/nopfs/Makefile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions dists/nopfs/build_matrix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linux amd64
1 change: 1 addition & 0 deletions dists/nopfs/current
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.21.0-rc2
1 change: 1 addition & 0 deletions dists/nopfs/description
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NOpfs provides content-blocking-layer capabilities for IPFS (Kubo)
Empty file added dists/nopfs/plugin
Empty file.
1 change: 1 addition & 0 deletions dists/nopfs/repo-owner
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs-shipyard
2 changes: 2 additions & 0 deletions dists/nopfs/versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
v0.21.0-rc1.3
v0.21.0-rc2
1 change: 1 addition & 0 deletions dists/nopfs/vtag
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nopfs-kubo-plugin