Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

Templatize destination path structure, including executable basename #181

Open
mcandre opened this issue Mar 3, 2020 · 2 comments
Open

Comments

@mcandre
Copy link

mcandre commented Mar 3, 2020

Hi, thank you for maintaining xgo! What an incredibly powerful, fast way to build ports for Go apps!

Could we please get an option similar to gox's -output, for customizing the names of the file tree?

For example, I would prefer to place the OS, arch pair information as directories leading up to the application name: windows/amd64/octane.exe

@davidalpert
Copy link

I would also like this ability. wonder where this is set...

@davidalpert
Copy link

seems to be set in ./docker/base/build.sh which is a complicated shell script so injecting a template might be tricky:

NAME is first set here:

then used throughout:

  • e.g.
    GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build $V $X "${T[@]}" --ldflags="$V $LD" $R $BM -o "/build/$NAME-linux-amd64$R`extension linux`" ./$PACK

which allows the post-build step to simply copy ./build/* out of the container.

one idea is to update build.sh so that:

  • output is built inside the container to a path with its component parts (e.g. ./build/$OS/$ARCH/$NAME)
  • output is recursively pulled out of the container by xgo.go (e.g. copy -r container:/build/* ./tmp)
  • xgo.go iterates through the folder structure to pars the OS,ARCH,NAME values out of the file system and pass those component parts to a gotemplate parameter

one of the main reasons I'm interested in this is to be able to generate binaries with a consistent name across platforms.

would be nice to run mytool on every environment after an install rather than mytool-os-arch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants