Fahrj/reverse-ssh

Other Architecture Builds

Closed this issue · 3 comments

Maybe you could add some info to the README on how to compile it for other targets as well.
Something like:
"""
To compile for other architectures or OSs just add the desired line to the build target.
E.g. for linux/arm64:

CGO_ENABLED=0 GOARCH=arm64  GOOS=linux  go build -ldflags="$(LDFLAGS) -s -w" -o bin/reverse-ssh-arm64 .

A list of available targets can be obtained via go tool dist list.
"""

Or even allow specific target selection via environment variables or build targets.

Fahrj commented

Great idea!

I went ahead with 1f0f9a9 and added a plain build target that can be used to override GOOS and GOARCH as needed.
Implementing it this way felt a little more "clean" than adding even more targets for other operating systems or architectures.

I hope this works for you!

Nice, good solution!
There is just one thing slightly sub-optimal with this way - the resulting binary is always called reverse-ssh, with all the others having an explicit postfix, identifying its target.
As long as you know what you're doing this should be fine though.

Fahrj commented

I agree, adding a matching suffix would be a nice touch.

Nonetheless, I would consider cross-compiling somewhat advanced and thus expect any user doing it to figure that the plain one is the correct binary.