22 Commits

Author SHA1 Message Date
sthen
4c9d7e6039 No need for a special MODGO_ENV for go.port.mk, just use normal MAKE_ENV
like the rest of the ports tree. This also allows removing a bunch of
manual setting of PATH="${PORTPATH}" HOME="${PORTHOME}" done in various
ports etc. This also makes sure CFLAGS is passed through (not everything
honours it but it does improve at least some ports).

Remove NO_CCACHE from www/honk that was added because the above problem
resulted in ccache variables not being passed through correctly breaking
the cc calls in this.

ok kmos@
2019-05-04 21:46:16 +00:00
jsing
9feeecb26d Go 1.12 requires GOCACHE to be enabled - update go.port.mk appropriately.
ok sthen@
2019-03-16 13:36:01 +00:00
sthen
a76ac58134 move MODGO_FLAGS+=-x under the DEBUG .if - as jsing pointed out a while
ago, output from this is really very noisy.

since the build with no flags is silent, add -v as a middle ground by
defaulot, so you can see that something is happening during the build,
but without so much console spam.

ok jasper@
2018-05-21 21:11:27 +00:00
kn
0578fb6c1e Simplify do-install, combine/improve find calls, clean up whitespace nits.
No package change.

OK jsing, jca
2018-05-10 18:39:35 +00:00
jsing
0f4f610688 Tweak go.port.mk for Go 1.10.
- Disable the Go 1.10 test caching via GOCACHE - this seems to interact
  badly with the ports build infrastructure and does not provide any
  real benefit in this environment.

- Provide a MODGO_TEST_FLAGS variable that allows ports to specify test
  flags.

ok jasper@
2018-03-14 14:12:02 +00:00
ajacoutot
93da165b64 MODGO_post-patch -> MODGO_pre-configure, so that 'update-patches' works.
ok jasper@ czarkoff@
2017-12-02 09:29:14 +00:00
ajacoutot
c0d19b6a8e Use MODGO_post-patch instead of checking for an existing post-patch target.
This will allow go ports to setup a post-patch target when needed.

ok czarkoff@
2017-04-22 09:55:16 +00:00
ajacoutot
60be374aa8 Export PATH so that things using cgo don't die with, for e.g.
exec "cc" not found in path

s/PATH/PORTPATH/ from sthen@
ok jsing@ sthen@
2017-02-19 14:07:26 +00:00
ajacoutot
4f91ea23e0 Split -ldflags="-s -w" from MODGO_FLAGS and instead:
- create a new MODGO_LDFLAGS variable
- set MODGO_LDFLAGS to "-s -w" by default (no DEBUG)
- add -ldflags="${MODGO_LDFLAGS}" to the build and test CMDs if
  MODGO_LDFLAGS is defined

ok czarkoff@ jsing@
2017-01-30 16:58:40 +00:00
czarkoff
ede8b86eb5 make go libraries build- and run-depend on particular version of lang/go
Go libraries should be rebuilt on every lang/go update.  This change adds
runtime dependency on lang/go for ports with "lib" in MODGO_TYPE, and tunes
PKGSPEC to force dependency on exact version of go.

OK jsing@, "makes sense" sthen@
2016-08-21 14:08:25 +00:00
ajacoutot
013a103b65 Properly strip go binaries when !DEBUG.
On big executables, size drops by ~40%.

with and ok czarkoff@
2016-08-03 09:34:10 +00:00
czarkoff
790ee6d73a Allow single go port install both binaries and libraries
OK jsing@ kspillner@
2016-05-21 01:39:36 +00:00
jasper
d149e12de8 bump MODGO_BUILD_DEPENDS to lang/go>=1.6
some ports that used to depend on GO15VENDOREXPERIMENT=1 need 1.6 or they
won't build as the usage of that variable has been removed in their Makefiles.

ok czarkoff@ sthen@
2016-05-13 06:43:37 +00:00
czarkoff
a11a018bee simplify MODGO_CMD environment customization
Clear user's environment with SETENV and provide MODGO_ENV for adding variables
to environment and MODGO_GOPATH for altering GOPATH.

OK ajacoutot@, jasper@, kspillner@
2016-05-08 12:29:17 +00:00
czarkoff
06694c8448 use INSTALL_DATA instead of cp for go libraries
OK ajacoutot@ sthen@
2016-05-06 10:04:00 +00:00
czarkoff
f7c3c0505e Set INSTALL_STRIP= for go ports
OK ajacoutot@, sthen@
2016-05-05 10:46:50 +00:00
czarkoff
5f82570d19 Fix MODGO_INSTALL_TARGET so that timestamps would be preserved. This should fix
issue with go ports rebuilding their dependencies and failing to install them.

Based on input from Nigel Taylor.

OK ajacoutot@
2016-02-28 13:24:16 +00:00
jsing
f667ff2fd9 Rework go.port.mk to install packages in /usr/local/go-pkg and build
without -a, -work and without running things through sed and piping to
shell:

- Install additional packages under /usr/local/go-pkg and include this in
  GOPATH when building. Go considers anything under the GOROOT to be part
  of the standard library, which introduces various problems. In particular
  they do not get rebuilt without the -a flag.

- Using 'go build -a' is unnecessary (at least now that we're not
  installing in GOROOT). Furthermore, the semantics of -a have changed
  between go1.4 and go1.5. In go1.4 the standard library was excluded from
  the -a flag whereas for go1.5 it does mean all dependencies including the
  standard library (this was the same for go1.3). However, there is
  already blanket 'do not rebuild standard library packages' in place when
  the -a flag is NOT specified.

- Avoid -work since it leaves the work directory behind and nothing is
  currently cleaning it up.

- Overall, avoid running 'go install -x' and piping the results through
  sed and sh. Firstly, 'go install -x' is already running those commands,
  then they're being run a second time around via sh. Secondly, there are
  cases where replacing GOROOT is incorrect.

ok jasper@ sthen@ kspillner@ czarkoff@
2016-01-14 15:03:08 +00:00
jasper
1e4c21592b add lang/go to CATEGORIES
ok czarkoff@
2015-08-11 20:16:21 +00:00
czarkoff
af3ebbd7b8 Don't call go with "-a" flag when building binaries. Allow overriding
MODGO_FLAGS in ports that need to do so.

OK ajacoutot@, kspillner@, sthen@
2015-06-12 05:20:48 +00:00
czarkoff
11506574f9 Refactor lang/go module
From port-modules(5):

     lang/go       Adds Go toolchain support.  Requires ALL_TARGET to be set
                   to canonical Go import path of port.  (Module sets it
                   automatically for ports that use GH_ACCOUNT and GH_PROJECT
                   macros.)

                   During execution of post-patch target module moves source
                   code from ${MODGO_SUBDIR} to ${WRKSRC}, subdirectory of
                   ${MODGO_WORKSPACE} - specially-crafted Go workspace located
                   at ${WRKDIR}/go.  During do-build module calls ``go
                   install'' with GOPATH set to ${MODGO_WORKSPACE}, runs its
                   output through sed to prevent writes outside WRKDIR sandbox
                   and sends output to sh(1).  During do-install it copies
                   executables from ${MODGO_WORKSPACE}/bin to ${PREFIX}/bin,
                   and/or directories ${MODGO_WORKSPACE}/pkg and
                   ${MODGO_WORKSPACE}/src to ${PREFIX}/go, depending on
                   MODGO_TYPE contents.

                   Sets BUILD_DEPENDS, RUN_DEPENDS, ALL_TARGET, TEST_TARGET,
                   ONLY_FOR_ARCHS, SEPARATE_BUILD, and WRKSRC.

                   Defines:

                   MODGO_TYPE       Type of port.  May be any combination of:

                                    bin  ordinary binary, which should be
                                         installed to ${PREFIX}/bin,

                                    lib  library, which should come with
                                         source code.

                                    Defaults to bin.

                   MODGO_WORKSPACE  Path to Go workspace set up for port build
                                    process.  Defaults to ${WRKDIR}/go.  See
                                    Go documentation for details.

                   MODGO_SUBDIR     Path to Go source code within port's
                                    sources tarball.  Defaults to ${WRKDIST}.

                   MODGO_SETUP_WORKSPACE
                                    Commands setting up Go workspace for
                                    building ports.  By default, happens
                                    during execution of post-patch target.

                   MODGO_BUILDDEP   Controls whether contents of
                                    MODGO_BUILD_DEPENDS are appended to port's
                                    BUILD_DEPENDS.  Defaults to Yes.

                   Additionally defines MODGO_PACKAGES, MODGO_SOURCES and
                   MODGO_TOOLS (paths for installed Go packages, sources and
                   tools respectively), MODGO_CMD and MODGO_FLAGS (source code
                   build command and flags passed as its arguments),
                   MODGO_BUILD_CMD and MODGO_TEST_CMD (commands for building
                   and testing go packages; normally called with canonical Go
                   package names as arguments),
                   MODGO_{BUILD,INSTALL,TEST}_TARGET and
                   MODGO_{BUILD,RUN}_DEPENDS.

OK sthen@
2015-06-08 09:17:04 +00:00
jasper
d30f4360a7 add beginnings for a golang module
input and ok jsing@ kspillner@ sthen@
2015-05-15 07:30:41 +00:00