@@ -70,8 +70,9 @@ export CGO_CPPFLAGS ?= "${CPPFLAGS}"
export CGO_CXXFLAGS ?= "${CXXFLAGS}"
export CGO_LDFLAGS ?= "${LDFLAGS}"
-GO_INSTALL ?= "${GO_IMPORT}/..."
-GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
+GO_INSTALL_PREFIX ?= "${GO_IMPORT}"
+GO_INSTALL ?= "${GO_INSTALL_PREFIX}/..."
+GO_INSTALL_FILTEROUT ?= "${GO_INSTALL_PREFIX}/vendor/"
B = "${WORKDIR}/build"
export GOPATH = "${B}"
@@ -80,7 +81,8 @@ export GOPROXY ??= "https://proxy.golang.org,direct"
export GOTMPDIR ?= "${WORKDIR}/build-tmp"
GOTMPDIR[vardepvalue] = ""
-GO_SRCURI_DESTSUFFIX = "${@os.path.join(os.path.basename(d.getVar('S')), 'src', d.getVar('GO_IMPORT')) + '/'}"
+GO_SRC_DIR ??= "src/${GO_IMPORT}"
+GO_SRCURI_DESTSUFFIX ?= "${@os.path.join(os.path.basename(d.getVar('S')), d.getVar('GO_SRC_DIR')) + '/'}"
go_list_packages() {
${GO} list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \
@@ -95,7 +97,9 @@ go_list_package_tests() {
}
go_do_configure() {
- ln -snf ${S}/src ${B}/
+ if [ -n "${GO_SRCURI_DESTSUFFIX}" ]; then
+ ln -snf ${S}/src ${B}/
+ fi
}
do_configure[dirs] =+ "${GOTMPDIR}"
@@ -114,7 +118,7 @@ do_compile[cleandirs] = "${B}/bin ${B}/pkg"
go_do_install() {
install -d ${D}${libdir}/go/src/${GO_IMPORT}
- tar -C ${S}/src/${GO_IMPORT} -cf - --exclude-vcs --exclude '*.test' --exclude 'testdata' . | \
+ tar -C ${S}/${GO_SRC_DIR} -cf - --exclude-vcs --exclude '*.test' --exclude 'testdata' . | \
tar -C ${D}${libdir}/go/src/${GO_IMPORT} --no-same-owner -xf -
tar -C ${B} -cf - --exclude-vcs --exclude '*.test' --exclude 'testdata' pkg | \
tar -C ${D}${libdir}/go --no-same-owner -xf -
@@ -127,14 +131,14 @@ go_do_install() {
go_stage_testdata() {
oldwd="$PWD"
- cd ${S}/src
- find ${GO_IMPORT} -depth -type d -name testdata | while read d; do
+ cd ${S}/${GO_SRC_DIR}
+ find . -depth -type d -name testdata -printf '%P\n'| while read d; do
if echo "$d" | grep -q '/vendor/'; then
continue
fi
parent=`dirname $d`
- install -d ${D}${PTEST_PATH}/$parent
- cp --preserve=mode,timestamps -R $d ${D}${PTEST_PATH}/$parent/
+ install -d ${D}${PTEST_PATH}/${GO_IMPORT}/$parent
+ cp --preserve=mode,timestamps -R $d ${D}${PTEST_PATH}/${GO_IMPORT}/$parent/
done
cd "$oldwd"
}