summaryrefslogtreecommitdiffstats
path: root/meta/classes/go.bbclass
Commit message (Collapse)AuthorAgeFilesLines
* classes: Update classes to match new bitbake class scope functionalityRichard Purdie2022-08-121-170/+0
| | | | | | | | | Move classes to classes-global or classes-recipe as appropriate to take advantage of new bitbake functionality to check class scope/usage. (From OE-Core rev: f5c128008365e141082c129417eb72d2751e8045) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes: Add SPDX license identifiersRichard Purdie2022-08-121-0/+2
| | | | | | | | | | | | As stated in our top level license files, the license is MIT unless otherwise stated. Add SPDX identifers accordingly. Replace older license statementa with the standardised syntax. Also drop "All Rights Reserved" expression as it isn't used now, doesn't mean anything and is confusing. (From OE-Core rev: 081a391fe09a21265881e39a2a496e4e10b4f80b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes: Add copyright statements to files without oneRichard Purdie2022-08-121-0/+4
| | | | | | | | | Where there isn't a copyright statement, add one to make it explicit. Also drop editor config lines where they were present. (From OE-Core rev: 880c1ea3edc8edef974e65b2d424fc36809ea034) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: fix path to linker in native Go buildsDmitry Baryshkov2022-05-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building native Go tools results in the tool pointing to the wrong location of dynamic linker (see below). The linker is looked up in the temporary dir, which can be removed if rm_work is inherited. This results in being unable to execute the program with the 'No such file or directory' error. Override linker specificiation for native recipes (and let Go build environment to pick up a correct one on it's own). The error is observed in case the distro doesn't use uninative.bbclass. If uninative.bbclass is used, the binary will be patched automatically to use the uninative loader instead of the system one. Without this patch: $ ldd tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man linux-vdso.so.1 (0x00007ffe945ec000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3a7490e000) /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/x86_64-linux/go-md2man-native/1.0.10+gitAUTOINC+f79a8a8ca6-r0/recipe-sysroot-native/usr/lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f3a74d13000) $ tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man --help -bash: tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man: No such file or directory With the patch $ ldd tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man linux-vdso.so.1 (0x00007ffd19dbf000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2d44181000) /lib64/ld-linux-x86-64.so.2 (0x00007f2d44586000) $ tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man --help Usage of tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man: -in string Path to file to be processed (default: stdin) -out string Path to output processed file (default: stdout) (From OE-Core rev: 44b397daa68b4d0a461225fe9ff7db8b5fcfdb7b) Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: disable the use of the default configuration fileChen Qi2022-04-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | We need to disable the use the default configuration file. This is to ensure that user settings do not mess things up when building go recipes. For example, if I set 'GOBIN=./relative/path' in $HOME/.config/go/env, then go-runtime fails to build with error like below: cannot install, GOBIN must be an absolute path According to `go help environment', """ Setting GOENV=off in the environment disables the use of the default configuration file. """ We can explicitly disable the configuration file by setting GOENV to off. (From OE-Core rev: 711b41744ab08ee62c71cdccca335a7828ec0ba1) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: Always pass interpreter to linkerJoerg Vehlow2022-04-191-1/+2
| | | | | | | | | | | | | | | | | | When gos internal linker is used, it uses hardcoded paths to the interpreter (dynamic linker). For x86_64 this hardcoded path is /lib64/ld-linux-x86-64.so.2, but yocto's default dynamic linker path is /lib64/ld-linux-x86-64.so.2. Most of the time, the internal linker is not used and binutils linker sets the correct path, but sometimes the internal linker is used and the resulting binary will not work on x86_64. To ensure the path is always correct, pass it to the linker. (From OE-Core rev: 6b54215074d7f3dbba07f096f16b9c0acf51527c) Signed-off-by: Joerg Vehlow <joerg.vehlow@aox.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: correctly set debug-prefix-map and build directoryAlexander Kanavin2022-01-051-1/+1
| | | | | | | | | | | | | | | | | Go has its own system for creating temporary build sub-directories with randomized names, and setting up debug-prefix-map on the fly to prevent those directories leaking into target binaries. OE's own settings were clashing with it, so this change carefully avoids the two stepping on each other. Additionally, the top level build directory cannot be named 'go-something'. (From OE-Core rev: 9985b17a30bb9b9f1bc82a44662687db5cead66e) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: log build id computationsAlexander Kanavin2022-01-051-0/+2
| | | | | | | | | | | | | | | go writes build-specific ids into binaries it produces and has a custom system for calculating them from file hashes, environment variables and other inputs (not that dissimilar to sstate cache, actually). This can go wrong :) in various ways (for purposes of reproducibility in particular), so this enables useful logs to see what happens and why. (From OE-Core rev: a587be1d18fc55fe57d1aa5aa7c9e26af887109e) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Allow adding parameters to go ldflagsAhmed Hossam2021-10-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | Currently, there is no clean way to pass extra parameters to the go tool link, which is passed by the go build ldflags flag, the append needs to happen inside the quotes of the ldflags parameter See [YOCTO #14554]. Add a variable to allow adding extra parameters to -ldflags in the GO_LDFLAGS variable, one of the main usecases is setting the application version. For example, adding to the recipe something like GO_EXTRA_LDFLAGS="-X main.Version=v1.0.0" or GO_EXTRA_LDFLAGS="-X main.Version=${PV}" (From OE-Core rev: eaa7a61dab9a1d7bb039f16abdd9aacb44faa595) Signed-off-by: Ahmed Hossam <Ahmed.Hossam@opensynergy.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Convert to new override syntaxRichard Purdie2021-08-021-22/+22
| | | | | | | | | | | | This is the result of automated script conversion: scripts/contrib/convert-overrides.py <oe-core directory> converting the metadata to use ":" as the override character instead of "_". (From OE-Core rev: 42344347be29f0997cc2f7636d9603b1fe1875ae) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: Enable CGO and pie buildmode on rv64Khem Raj2021-02-261-3/+2
| | | | | | | | | go1.16 has added CGO support for riscv64 arch (From OE-Core rev: 8e078238312948e8c7b09c66ba7a186512e995d3) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: don't stage test data with sources of dependenciesThomas Perrot2021-01-101-1/+2
| | | | | | | | | | | As for the sources the dependencies contain test data, ELF files and other binaries which aren't necessary for building and which lead to unnecessary QA warnings. (From OE-Core rev: 7faea9766127fe4e1023c89b140cc98020655155) Signed-off-by: Thomas Perrot <thomas.perrot@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Use external linker for native packagesKhem Raj2020-12-181-0/+1
| | | | | | | | | | | | | | | | | go 1.15 has reworked internal linker, which has resulted in regressions in OE where native binaries generated using internal linker in some cases result in corruption during populate_sysroot e.g. glide-native crashing when used after relocation. This improved reliability of native binaries working especially when they use cgo or pie build modes (From OE-Core rev: daf4856ea3ccafc05c808a34d4c6af2bfafea12f) Signed-off-by: Khem Raj <raj.khem@gmail.com> Cc: Otavio Salvador <otavio.salvador@ossystems.com.br> Cc: Konrad Weihmann <kweihmann@outlook.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Add `-trimpath` to default build flagsOtavio Salvador2020-05-261-1/+1
| | | | | | | | | | The `-trimpath` option is important for reproducible builds so full build paths and module paths are not embedded. (From OE-Core rev: e3df027b3697b6a92b417bba8d442a5bd15525fd) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Disable CGO on riscv64Khem Raj2020-01-271-0/+1
| | | | | | | | | Its not supported yet (From OE-Core rev: ecec793f36545cab9c14a64b267b1d4f694d0323) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Disable PIE on riscvKhem Raj2020-01-271-1/+1
| | | | | | | | | Its not _yet_ supported for riscv (From OE-Core rev: aeb38e003dc5e11008e301a584e93351745ef6e7) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/lib: Remove bb.build.FuncFailedRichard Purdie2019-08-061-11/+7
| | | | | | | | | | | | | Whilst seemingly a good idea, this exception doesn't really serve any purpose that bb.fatal() doesn't cover. Wrapping exceptions within exceptions isn't pythonic. Its not used in many places, lets clean up those and remove usage of it entirely. It may ultimately be dropped form bitbake entirely. (From OE-Core rev: efe87ce4b2154c6f1c591ed9d8f770c229b044ad) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: separate the ptest logic to go-ptest classMingli Yu2019-07-091-51/+1
| | | | | | | | | | | | | | | | | | The current go class includes ptest logic by default and will make the recipe which inherits go class to support ptest automatically though maybe the recipe which inherits go class doesn't plan to support the ptest. So separate the ptest logic to another specified class go-ptest to make the recipe which needs to inherit go class more flexible with regards to ptest support. (From OE-Core rev: 099a2a212fed61a24643da63c74c09cef3ba4030) Signed-off-by: Mingli Yu <mingli.yu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: avoid host contamination by GOCACHERicardo Ribalda Delgado2019-06-211-0/+1
| | | | | | | | | | | | | | | | | | | | | By default GOCACHE is set to $HOME/.cache. Fixes: ERROR: go-cross-dbfp4-1.12.1-r0 do_compile: Function failed: do_compile (log file is located at /workdir/build/tmp/work/x86_64-linux/go-cross-dbfp4/1.12.1-r0/temp/log.do_compile.8120) ERROR: Logfile of failure stored in: /workdir/build/tmp/work/x86_64-linux/go-cross-dbfp4/1.12.1-r0/temp/log.do_compile.8120 Log data follows: | DEBUG: Executing shell function do_compile | Building Go cmd/dist using /workdir/build/tmp/work/x86_64-linux/go-cross-dbfp4/1.12.1-r0/recipe-sysroot-native/usr/lib/go. | failed to initialize build cache at /home/pokyuser/.cache/go-build: mkdir /home/pokyuser/.cache: permission denied | WARNING: exit code 1 from a shell command. | ERROR: Function failed: do_compile (log file is located at /workdir/build/tmp/work/x86_64-linux/go-cross-dbfp4/1.12.1-r0/temp/log.do_compile.8120) ERROR: Task (/workdir/repo/poky/meta/recipes-devtools/go/go-cross_1.12.bb:do_compile) failed with exit code '1' NOTE: Tasks Summary: Attempted 23 tasks of which 16 didn't need to be rerun and 1 failed. (From OE-Core rev: 9a6d208b9979035bbfc1def80fb6558db4bddb12) Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: Exclude vcs files when installing depsAlex Kiernan2019-05-081-1/+1
| | | | | | | | | | | | | | | | Because our clones use the host git, on (say) Ubuntu 18.04, the local git directories acquire perl scripts such as fsmonitor-watchman.sample. During packaging, this leads to failures: ERROR: go-hsperfdata-1.0.3+gitAUTOINC+b58598ac84-r0 do_package_qa: QA Issue: /usr/lib/go/pkg/dep/sources/https---github.com-nsf-termbox--go/.git/hooks/fsmonitor-watchman.sample contained in package go-hsperfdata-staticdev requires /usr/bin/perl, but no providers found in RDEPENDS_go-hsperfdata-staticdev? [file-rdeps] ERROR: go-hsperfdata-1.0.3+gitAUTOINC+b58598ac84-r0 do_package_qa: QA run found fatal errors. Please consider fixing them. ERROR: go-hsperfdata-1.0.3+gitAUTOINC+b58598ac84-r0 do_package_qa: ERROR: go-hsperfdata-1.0.3+gitAUTOINC+b58598ac84-r0 do_package_qa: Function failed: do_package_qa (From OE-Core rev: 2ee246524ab881d57d8aac204f671215a25a58d3) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Remove unused overrideRichard Purdie2019-04-121-2/+0
| | | | | | | | | The x86 override means the i586 one isn't necessary. (From OE-Core rev: 1658bf2dbdfe1a5b38efcc03359c9937506c120c) Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Export more GO* environment variablesMark Asselstine2019-04-101-0/+19
| | | | | | | | | | | | | | | | | | | | | | Currently we are not doing a good job of consolidating GO environment variables used by the go build system in the go.bbclass, instead we are relying on the individual GO recipe authors to perform the exports. This can result in inconsistent build results and often binaries that are not properly cross compiled, resulting in segfaults when the applications are run on the target. For example the GO documentation recommends that the environment include a value assigned to GOARM when cross building for ARMv5, ARMv6 and ARMv7 (https://github.com/golang/go/wiki/GoArm). In order to avoid polluting the build scripts with unnecessary exports, such as run.do_compile, we attempt to only export variables when they apply to a specific arch. (From OE-Core rev: 6300c4a83f7c8fc88702798ffe25bd6d57091673) Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: Add recipes for 1.12 release and make it defaultKhem Raj2019-03-091-1/+0
| | | | | | | | | | - Refresh patches - Enable GOCACHE required as of Go 1.12 (From OE-Core rev: f559fd6df2978f9093672794420eada2b7452987) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: Change from TARGET_ARCH to TUNE_PKGARCHRichard Purdie2018-11-071-1/+1
| | | | | | | | | | | | | | | | | Right now go-cross is changing signatures when you change TUNE for a given architecture. In particular this breaks layer tests like: yocto-check-layer ../meta-yocto-bsp/ --machines qemuarm beaglebone-yocto This changes the PN addtion to something containing the tune rather than the arch which avoids these kinds of errors. If go-cross can be tune independent that would be nice but currently that isn't the case. [YOCTO #12586] (From OE-Core rev: e3c7e1703499e6a5332d9ab8a941671ec8235c4f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Add -buildmode=pie for non mips archRobert Yang2018-10-011-0/+10
| | | | | | | | | | Fixed QA issue like: WARNING: runc-docker do_package_qa: QA Issue: ELF binary '/path/to/runc-docker/usr/bin/runc' has relocations in .text [textrel] (From OE-Core rev: 8dcd4e6e791c3a8b8bf5e69dca9bb9c887231d69) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass, goarch.bbclass: update SECURITY_CFLAGSMatt Madison2018-03-061-3/+0
| | | | | | | | | | | | With go1.10 the NOPIE flags are only required for MIPS target builds, and are now incompatible for the other architectures. (From OE-Core rev: f2ff90eb7d27a2f69f5948fa8c301de30f5c8132) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: ptest cleanup and improvementsMatt Madison2018-03-061-36/+51
| | | | | | | | | | | | | | | | | | | | | | | | | * Don't enable verbose test output (-test.v) by default, as it generates too much noise for automated results parsing * Override do_install_ptest_base in the bbclass, so recipes can provide their own modifications with do_install_ptest. * Improve the generated run-ptest script to better handle large numbers of tests, and to generate 'status: test name' output similar to Automake tests. * Install all non-vendored 'testdata' directories from the source into the ptest package, as some packages share test data among multiple tests. (From OE-Core rev: 11037462d80cefbee90a69e6a8a95895375ed6da) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: don't stage test data with sourcesMatt Madison2018-03-061-1/+1
| | | | | | | | | | | | | | | | Any directory in a Go package's source tree called 'testdata' contains test data, and isn't necessary for building. Some packages include ELF files and other binaries as test data, and staging them in the sysroot and -dev package leads to unnecessary QA warnings. (From OE-Core rev: b013db7ab58d4d56ad5c6e54a3a32df31aaf8809) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: remove debug-related commandsMatt Madison2018-03-061-3/+0
| | | | | | | | | | | | | The 'go env' in the do_compile function and the set -x/+x in the do_install_ptest function were used for debugging the bbclass, and aren't really needed. (From OE-Core rev: 351e9fc39408e094bbb4beedf51221adc8afd143) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: rename GO_TMPDIR -> GOTMPDIRMatt Madison2018-03-061-6/+7
| | | | | | | | | | | | | | and export it. Go 1.10 now supports using this separate variable locating its temporary files. TMPDIR is still set, for compatibility with go1.9; that can be dropped once 1.9 is retired. (From OE-Core rev: ce9d70ae2f9981bf5b42641922c34c1ed54eeca3) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: update go 1.9 -> go 1.10Matt Madison2018-03-061-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | * Patches and recipes reworked for go 1.10's significant changes to its bootstrap and build steps. * Update go1.4 source tarball used for go-native bootstrapping to the version recommended in the current go documentation * Remove test data from installed sources to eliminate some packaging QA warnings * Set GOCACHE to 'off' to disable 1.10's build caching in the go recipes and bbclass * Update go_do_compile to compile both static and dynamic objects dynamic linking is in use, since go1.10's build tool is pickier about this (From OE-Core rev: 4fd749ca6450a4870be1c1e13802f084b6eb0db6) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* utils.py: add parallel make helpersJoshua Watt2018-02-161-18/+1
| | | | | | | | | | | | | | | | | | | The code to extract the integer number of parallel build threads and construct a new argument from them has started to be copied in multiple locations, so create two new helper utilities to aid recipes. The first helper (parallel_make()) extracts the integer number of parallel build threads from PARALLEL_MAKE. The second (parallel_make_argument()) does the same and then puts the result back into a format string, optionally clamping it to some maximum value. Additionally, rework the oe-core recipes that were manually doing this to use the new helper utilities. (From OE-Core rev: ccd1142d22b31ed85d8823b1bc9e11ccfd72b61f) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: disable PIE flags for cgoMatt Madison2017-09-261-0/+3
| | | | | | | | | | | | If the security_flags.inc file is included, gcc will do PIE builds by default. These flags need to be disabled for go packages that use cgo. (From OE-Core rev: 5d84042852380fc88b9be8df0e4eeac612c2a6da) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: set TMPDIR during compilationMatt Madison2017-09-211-0/+6
| | | | | | | | | | | | | | | | The go build tool creates working directories under $TMPDIR for all of its processing. Create a directory under ${WORKDIR} for this and point TMPDIR at it during compilation, so that systems that have a relatively small /tmp filesystems can still compile larger Go packages. (From OE-Core rev: 5de3de12c70f01753491c46b5622b0d273c3257b) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: fix linking issues for nativesdk buildsMatt Madison2017-09-211-1/+3
| | | | | | | | | | | | | Switch to using an external linker for nativesdk go, go-runtime, and go package builds, which works more reliably when building 32-bit SDKs. (From OE-Core rev: f76779f7ef6636355a5aa5741a736f5234a67fdb) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Add ptest supportOtavio Salvador2017-09-141-2/+60
| | | | | | | | | | This adds ptest support for Go packages so its unittest content is packaged and integrated onto the test framework. (From OE-Core rev: 2343cd90b9706589b33510c560ed83a9648fb133) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Add "ldflags" to QA skip listOtavio Salvador2017-09-141-0/+2
| | | | | | | | | | | Currently every Go package will end with GNU_HASH in the ELF binary however adding it to every recipe is cumbersome so instead we handle that here. (From OE-Core rev: 6699e668413c10704ffa8094b3dca67a9b88422a) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: add support linking against shared runtimeMatt Madison2017-09-141-2/+9
| | | | | | | | | | | | For architectures that support it, use the -linkshared build option to build packages against the shared Go runtime. (From OE-Core rev: 5624a773e4db3ad2251641e69b04dc380e74a4c7) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: enable nativesdk builds for Go packagesMatt Madison2017-09-121-0/+2
| | | | | | | | | | Adding the necessary overrides for nativesdk builds. (From OE-Core rev: 83ad0bdb8a426b0beb3775cfb109ddb3936b7de1) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: clean up CGO_xxx settingsMatt Madison2017-09-121-6/+7
| | | | | | | | | | | | | | | | | | * use conditional assignment for the CGO_xxx variables, so they can be overridden more easily * remove the TOOLCHAIN_OPTIONS and TARGET_CC_ARCH references, since those are already present in CC and CXX * remove the TARGET_ prefix so the values are appropriate for native, nativesdk, etc. builds * move the GOROOT export away from the CGO settings and closer to its definition (From OE-Core rev: 088528021d6979a8e2d6bc33d63a166e300cfde4) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: remove some xxx_FINAL variablesMatt Madison2017-09-121-12/+7
| | | | | | | | | | | | | GOROOT_FINAL is used by the Go linker for rewriting source paths when the build GOROOT is not the same as the runtime GOROOT, but the other _FINAL variables aren't really needed. (From OE-Core rev: 31aa0d8a62be95d093d3c7581efa41f74b9131ad) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: remove GO_GCFLAGS nad GO_LDFLAGSMatt Madison2017-09-121-2/+0
| | | | | | | | | | These variables are not used anywhere. (From OE-Core rev: 2d37f60c2606de216aaa2d593b73b1de0a5c031e) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go: split out go-runtime into separate recipeMatt Madison2017-09-121-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reorganize the Go toolchain build to split out the Go standard runtime libraries into a separate recipe. This simplifies the extension to crosssdk and cross-canadian builds. * Adds a patch to the go build tool to prevent it from trying to rebuild anything in GOROOT, which is now resident in the target sysroot. * 'go' bb and inc files are now for building the compiler for the target only. * 'go-cross' bb and inc files are now just for the cross-compiler. * Adds virtual/<prefix> PROVIDES for the compiler and runtime * Removes testdata directories from the sysroot during staging, as they are unnecessary and can cause strip errors (some of the test files are ELF files). * Re-enables pacakage QA checks, adding selective INSANE_SKIP settings where needed. (From OE-Core rev: d2a7af7cd834e218c39d43ee3fa0c14d4f748727) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: add GO_INSTALL_FILTEROUT variableMatt Madison2017-09-111-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | When using the Go 'vendor' mechanism to bring in dependencies for a Go package, the default GO_INSTALL setting, which uses the '...' wildcard, will include the vendored packages in the build, which produces incorrect results. There are also some Go packages that are structured poorly, so that the '...' wildcard results in building example or test code that should not be included in the build, or fail to build. This patch adds a mechanism for filtering out a subset of the sources. It defaults to filtering out everything under the 'vendor' subdirectory under package's main directory, which is the normal location for vendored packages, but can be overridden by a recipe to filter out other subdirectories, if needed. (From OE-Core rev: 9819353726d85780546158428bd97a253705017d) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: add do_unpack function to handle common casesMatt Madison2017-09-111-1/+19
| | | | | | | | | | | | | | | | | | | | | | | Go source trees have a particular structure, with all sources located under ${GOROOT}/src/<import-path>. The fetcher step implemented by the 'go get' command automatically follows this structure, so we need to do the same here. Since most Go packages are hosted in git repositories, this adds a custom do_unpack() function that sets the destsuffix to match the expected directory structure, for any git SRC_URIs that haven't had a destsuffix explicitly set in the recipe. This simplifies recipe writing for the most common cases. (From OE-Core rev: efcf6513b71021ea4bfe6fbaa326e6591dee487d) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: separate ${S} and ${B}Matt Madison2017-09-111-28/+18
| | | | | | | | | | | | | | | | | | | Add a do_configure task to populate ${B} by symlinking in the src subdirectory under ${S}, which lets us point GOPATH at ${B}. This lets us take advantage of the automatic directory creation and cleaning for do_configure. This necessitates a change to do_install to split the installation of the sources and built artifacts. Taking advantage of some additional tar options, we can eliminate the extra staging area and extra recursive chown command. So overall efficiency should be improved. (From OE-Core rev: c62a083306c26b7e4deca1ff41336bb6b33d5b3a) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Use an auxiliary variable to add the build dependenciesOtavio Salvador2017-09-111-3/+5
| | | | | | | | | | | | | | | This is going to easy the addition of nativesdk and virtual providers in the future. This change is based on the meta-golang[1] layer. Thanks to Matt Madison <matt@madison.systems> for his work on this. 1. https://github.com/madisongh/meta-golang (From OE-Core rev: 497136297f15858903b5170a8616d0cb427a995d) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: exported function cleanupMatt Madison2017-09-111-9/+5
| | | | | | | | | | | | | Since this is a class, it should follow the class function export mechanism for its task functions, and should set directory-related flags for directories they need. (From OE-Core rev: 0369a99ad1c9e3a9a6394c723461795460dc2c76) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Enable parallel buildOtavio Salvador2017-09-111-0/+20
| | | | | | | | | | | | | | | The parallel build is based on PARALLEL_MAKE variable but can be overriden setting the GO_PARALLEL_BUILD one. This change is based on the meta-golang[1] layer. Thanks to Matt Madison <matt@madison.systems> for his work on this. 1. https://github.com/madisongh/meta-golang (From OE-Core rev: 7a40ea8fc358aa134ad86862591329f94d0f3718) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* go.bbclass: Use a global Go build flagsOtavio Salvador2017-09-111-1/+3
| | | | | | | | | | | | | | | We now use a GOBUILDFLAGS to provide a global variable to control the build flags to be given to Go. This change is based on the meta-golang[1] layer. Thanks to Matt Madison <matt@madison.systems> for his work on this. 1. https://github.com/madisongh/meta-golang (From OE-Core rev: d6b8e7e94ba6dae44907c5a65bc0bdf0ccebdb15) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>