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

Support FreeBSD build phase #1439

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

gogolok
Copy link
Contributor

@gogolok gogolok commented Dec 9, 2024

Summary

Make it possible to compile lifecycle and launcher for FreeBSD.

Related

Context

It 'just compiles' for FreeBSD. That's it :-) Other functionality can be added afterwards (priv/user.go functionality, maybe tests, correct launch/bash.go to use /usr/local/bin/bash and others).

If you would want to test the build phase under Linux or macOS for example:

diff --git a/Makefile b/Makefile
index 2501de30..b77141ea 100644
--- a/Makefile
+++ b/Makefile
@@ -39,9 +39,9 @@ GOFILES := $(shell $(GOCMD) run tools$/lister$/main.go)
 
 all: test build package
 
-GOOS_ARCHS = linux/amd64 linux/arm64 linux/ppc64le linux/s390x
+GOOS_ARCHS = freebsd/amd64 freebsd/arm64 linux/amd64 linux/arm64 linux/ppc64le linux/s390x
 
-build: build-linux-amd64 build-linux-arm64 build-windows-amd64 build-linux-ppc64le build-linux-s390x
+build: build-freebsd-amd64 build-freebsd-arm64 build-linux-amd64 build-linux-arm64 build-windows-amd64 build-linux-ppc64le build-linux-s390x
 
 build-windows-amd64: build-windows-amd64-lifecycle build-windows-amd64-symlinks build-windows-amd64-launcher
  • run make build
> Building lifecycle/lifecycle for freebsd/amd64...
mkdir -p /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle
GOARCH=amd64 CGO_ENABLED=0 go build  -ldflags "-s -w -X 'github.com/buildpacks/lifecycle/cmd.SCMRepository=github.com/buildpacks/lifecycle' -X 'github.com/buildpacks/lifecycle/cmd.SCMCommit=e5d402e1' -X 'github.com/buildpacks/lifecycle/cmd.Version='" -o /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/lifecycle -a ./cmd/lifecycle
> Creating phase symlinks for freebsd/amd64...
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/detector
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/analyzer
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/restorer
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/builder
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/exporter
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/rebaser
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/creator
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/extender
> Building lifecycle/launcher for freebsd/amd64...
mkdir -p /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle
GOARCH=amd64 CGO_ENABLED=0 go build  -ldflags "-s -w -X 'github.com/buildpacks/lifecycle/cmd.SCMRepository=github.com/buildpacks/lifecycle' -X 'github.com/buildpacks/lifecycle/cmd.SCMCommit=e5d402e1' -X 'github.com/buildpacks/lifecycle/cmd.Version='" -o /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/launcher -a ./cmd/launcher
test $(du -m /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/launcher|cut -f 1) -le 3
> Building lifecycle/lifecycle for freebsd/arm64...
mkdir -p /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle
GOARCH=arm64 CGO_ENABLED=0 go build  -ldflags "-s -w -X 'github.com/buildpacks/lifecycle/cmd.SCMRepository=github.com/buildpacks/lifecycle' -X 'github.com/buildpacks/lifecycle/cmd.SCMCommit=e5d402e1' -X 'github.com/buildpacks/lifecycle/cmd.Version='" -o /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/lifecycle -a ./cmd/lifecycle
> Creating phase symlinks for freebsd/arm64...
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/detector
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/analyzer
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/restorer
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/builder
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/exporter
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/rebaser
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/creator
ln -sf lifecycle /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/extender
> Building lifecycle/launcher for freebsd/arm64...
mkdir -p /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle
GOARCH=arm64 CGO_ENABLED=0 go build  -ldflags "-s -w -X 'github.com/buildpacks/lifecycle/cmd.SCMRepository=github.com/buildpacks/lifecycle' -X 'github.com/buildpacks/lifecycle/cmd.SCMCommit=e5d402e1' -X 'github.com/buildpacks/lifecycle/cmd.Version='" -o /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/launcher -a ./cmd/launcher
test $(du -m /Users/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/launcher|cut -f 1) -le 3
> Building lifecycle/lifecycle for linux/amd64...

......and so on.......

Signed-off-by: Robert Gogolok <robert.gogolok@stackit.cloud>
@gogolok gogolok requested a review from a team as a code owner December 9, 2024 22:31
@gogolok
Copy link
Contributor Author

gogolok commented Dec 9, 2024

And this is the run on FreeBSD:

$ uname -a
FreeBSD freebsd-desktop 14.2-RELEASE FreeBSD 14.2-RELEASE releng/14.2-n269506-c8918d6c7412 GENERIC amd64
$ gmake build
> Building lifecycle/lifecycle for freebsd/amd64...
mkdir -p /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle
GOARCH=amd64 CGO_ENABLED=0 go build  -ldflags "-s -w -X 'github.com/buildpacks/lifecycle/cmd.SCMRepository=github.com/buildpacks/lifecycle' -X 'github.com/buildpacks/lifecycle/cmd.SCMCommit=9409eec9' -X 'github.com/buildpacks/lifecycle/cmd.Version=0.20.4-13+9409eec9'" -o /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/lifecycle -a ./cmd/lifecycle
> Creating phase symlinks for freebsd/amd64...
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/detector
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/analyzer
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/restorer
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/builder
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/exporter
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/rebaser
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/creator
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/extender
> Building lifecycle/launcher for freebsd/amd64...
mkdir -p /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle
GOARCH=amd64 CGO_ENABLED=0 go build  -ldflags "-s -w -X 'github.com/buildpacks/lifecycle/cmd.SCMRepository=github.com/buildpacks/lifecycle' -X 'github.com/buildpacks/lifecycle/cmd.SCMCommit=9409eec9' -X 'github.com/buildpacks/lifecycle/cmd.Version=0.20.4-13+9409eec9'" -o /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/launcher -a ./cmd/launcher
test $(du -m /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-amd64/lifecycle/launcher|cut -f 1) -le 3
> Building lifecycle/lifecycle for freebsd/arm64...
mkdir -p /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle
GOARCH=arm64 CGO_ENABLED=0 go build  -ldflags "-s -w -X 'github.com/buildpacks/lifecycle/cmd.SCMRepository=github.com/buildpacks/lifecycle' -X 'github.com/buildpacks/lifecycle/cmd.SCMCommit=9409eec9' -X 'github.com/buildpacks/lifecycle/cmd.Version=0.20.4-13+9409eec9'" -o /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/lifecycle -a ./cmd/lifecycle
> Creating phase symlinks for freebsd/arm64...
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/detector
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/analyzer
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/restorer
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/builder
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/exporter
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/rebaser
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/creator
ln -sf lifecycle /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/extender
> Building lifecycle/launcher for freebsd/arm64...
mkdir -p /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle
GOARCH=arm64 CGO_ENABLED=0 go build  -ldflags "-s -w -X 'github.com/buildpacks/lifecycle/cmd.SCMRepository=github.com/buildpacks/lifecycle' -X 'github.com/buildpacks/lifecycle/cmd.SCMCommit=9409eec9' -X 'github.com/buildpacks/lifecycle/cmd.Version=0.20.4-13+9409eec9'" -o /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/launcher -a ./cmd/launcher
test $(du -m /home/gogo/workspace/github.com/buildpacks/lifecycle/out/freebsd-arm64/lifecycle/launcher|cut -f 1) -le 3
> Building lifecycle/lifecycle for linux/amd64...

... and so on ...

@jabrown85 jabrown85 merged commit ddcded1 into buildpacks:main Dec 10, 2024
7 checks passed
@gogolok gogolok deleted the support_freebsd_build_phase branch December 10, 2024 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants