We have moved to Git. This repository is only provided for compatibility with old installations. Learn how to migrate your installation here.

comparison eclass/x-mgcf-golang-common.eclass @ 269:0ad22bd2bcb5

[sync] imported 0868af3..2baaee6 from upstream commit 2baaee6bc3835b930d1e3f537b3d937780ce90c6 Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Thu Mar 13 22:24:16 2025 +0100 fix old go eclass compatibility
author Migration Sync <gentoo-overlay@megacoffee.net>
date Thu, 13 Mar 2025 21:30:01 +0000
parents 32efd9258ce5
children
comparison
equal deleted inserted replaced
268:43be7800d5f3 269:0ad22bd2bcb5
438 438
439 debug-print "${FUNCNAME}: GOPATH = ${GOPATH}" 439 debug-print "${FUNCNAME}: GOPATH = ${GOPATH}"
440 debug-print "${FUNCNAME}: GOBIN = ${GOBIN}" 440 debug-print "${FUNCNAME}: GOBIN = ${GOBIN}"
441 debug-print "${FUNCNAME}: EGO_SRC = ${EGO_SRC}" 441 debug-print "${FUNCNAME}: EGO_SRC = ${EGO_SRC}"
442 debug-print "${FUNCNAME}: CGO_ENABLED = ${CGO_ENABLED}" 442 debug-print "${FUNCNAME}: CGO_ENABLED = ${CGO_ENABLED}"
443 eend 443 eend 0
444 } 444 }
445 445
446 446
447 # @FUNCTION: x-mgcf-golang-common_src_prepare 447 # @FUNCTION: x-mgcf-golang-common_src_prepare
448 # @DESCRIPTION: 448 # @DESCRIPTION:
520 # Moves sources from WORKDIR into GOPATH. 520 # Moves sources from WORKDIR into GOPATH.
521 case ${DEPENDENCY[host]} in 521 case ${DEPENDENCY[host]} in
522 github*) 522 github*)
523 ebegin "${message}" 523 ebegin "${message}"
524 mv ${DEPENDENCY[project_name]}-${DEPENDENCY[revision]}* "${GOPATH}"/src/${destdir} || die 524 mv ${DEPENDENCY[project_name]}-${DEPENDENCY[revision]}* "${GOPATH}"/src/${destdir} || die
525 eend 525 eend $?
526 526
527 # FIX: sometimes the source code inside an importpath alias 527 # FIX: sometimes the source code inside an importpath alias
528 # (such as gopkg.in/mylib.v1) invokes imports from 528 # (such as gopkg.in/mylib.v1) invokes imports from
529 # the original import path instead of using the alias, 529 # the original import path instead of using the alias,
530 # thus we need a symbolic link between the alias and 530 # thus we need a symbolic link between the alias and
537 ;; 537 ;;
538 bitbucket*) 538 bitbucket*)
539 #einfo "path: ${DEPENDENCY[author_name]}-${DEPENDENCY[project_name]}-${DEPENDENCY[revision]}" 539 #einfo "path: ${DEPENDENCY[author_name]}-${DEPENDENCY[project_name]}-${DEPENDENCY[revision]}"
540 ebegin "${message}" 540 ebegin "${message}"
541 mv ${DEPENDENCY[author_name]}-${DEPENDENCY[project_name]}-${DEPENDENCY[revision]}* "${GOPATH}"/src/${destdir} || die 541 mv ${DEPENDENCY[author_name]}-${DEPENDENCY[project_name]}-${DEPENDENCY[revision]}* "${GOPATH}"/src/${destdir} || die
542 eend 542 eend $?
543 ;; 543 ;;
544 code.google*) 544 code.google*)
545 ebegin "${message}" 545 ebegin "${message}"
546 mv ${DEPENDENCY[project_name]}-${DEPENDENCY[revision]}* "${GOPATH}"/src/${destdir} || die 546 mv ${DEPENDENCY[project_name]}-${DEPENDENCY[revision]}* "${GOPATH}"/src/${destdir} || die
547 eend 547 eend $?
548 ;; 548 ;;
549 *) die "Function 'x-mgcf-golang-common_src_prepare' doesn't support '${DEPENDENCY[importpath]}'" ;; 549 *) die "Function 'x-mgcf-golang-common_src_prepare' doesn't support '${DEPENDENCY[importpath]}'" ;;
550 esac 550 esac
551 done 551 done
552 552
676 # Before to compile Godep's dependencies it's wise to wipe out 676 # Before to compile Godep's dependencies it's wise to wipe out
677 # all pre-built object files from Godep's package source directories. 677 # all pre-built object files from Godep's package source directories.
678 if [[ -d "${S}"/Godeps/_workspace/pkg ]]; then 678 if [[ -d "${S}"/Godeps/_workspace/pkg ]]; then
679 ebegin "Cleaning up pre-built object files in Godep workspace" 679 ebegin "Cleaning up pre-built object files in Godep workspace"
680 rm -r "${S}"/Godeps/_workspace/pkg || die 680 rm -r "${S}"/Godeps/_workspace/pkg || die
681 eend 681 eend $?
682 fi 682 fi
683 if [[ -d "${S}"/Godeps/_workspace/bin ]]; then 683 if [[ -d "${S}"/Godeps/_workspace/bin ]]; then
684 ebegin "Cleaning up executables in Godep workspace" 684 ebegin "Cleaning up executables in Godep workspace"
685 rm -r "${S}"/Godeps/_workspace/bin || die 685 rm -r "${S}"/Godeps/_workspace/bin || die
686 eend 686 eend $?
687 fi 687 fi
688 688
689 689
690 # Executes 'go generate'. 690 # Executes 'go generate'.
691 # NOTE: generate should never run automatically. It must be run explicitly. 691 # NOTE: generate should never run automatically. It must be run explicitly.
702 702
703 # Executes 'statik' when explicitly asked. 703 # Executes 'statik' when explicitly asked.
704 if [[ -n ${GOLANG_PKG_STATIK} ]]; then 704 if [[ -n ${GOLANG_PKG_STATIK} ]]; then
705 ebegin "${ESTATIK} $GOLANG_PKG_STATIK" 705 ebegin "${ESTATIK} $GOLANG_PKG_STATIK"
706 ${ESTATIK} $GOLANG_PKG_STATIK || die 706 ${ESTATIK} $GOLANG_PKG_STATIK || die
707 eend 707 eend $?
708 fi 708 fi
709 } 709 }
710 710
711 711
712 # @FUNCTION: x-mgcf-golang-common_src_compile 712 # @FUNCTION: x-mgcf-golang-common_src_compile
730 fi 730 fi
731 731
732 debug-print "$FUNCNAME: GOPATH: Adding vendor path ${path}" 732 debug-print "$FUNCNAME: GOPATH: Adding vendor path ${path}"
733 ebegin "- ${path//${S}\//}" 733 ebegin "- ${path//${S}\//}"
734 GOPATH="${GOPATH}:$( echo ${path} )" 734 GOPATH="${GOPATH}:$( echo ${path} )"
735 eend 735 eend $?
736 done 736 done
737 737
738 export GOPATH 738 export GOPATH
739 fi 739 fi
740 740
1005 1005
1006 # NOTE: this hack is required by Go v1.4 and older versions. 1006 # NOTE: this hack is required by Go v1.4 and older versions.
1007 #if [[ ! -d "${1}"/src ]]; then 1007 #if [[ ! -d "${1}"/src ]]; then
1008 # ebegin "Fixing $1" 1008 # ebegin "Fixing $1"
1009 # ln -s "${1}" "${1}"/src || die 1009 # ln -s "${1}" "${1}"/src || die
1010 # eend 1010 # eend $?
1011 #fi 1011 #fi
1012 1012
1013 GOLANG_PKG_VENDOR+=(${1}) 1013 GOLANG_PKG_VENDOR+=(${1})
1014 } 1014 }
1015 1015
1053 fi 1053 fi
1054 ebegin "Linking ${TARGET} as ${ALIAS}" 1054 ebegin "Linking ${TARGET} as ${ALIAS}"
1055 ln -s "${GOPATH}/src/${TARGET}" \ 1055 ln -s "${GOPATH}/src/${TARGET}" \
1056 "${GOPATH}/src/${ALIAS}" \ 1056 "${GOPATH}/src/${ALIAS}" \
1057 || die 1057 || die
1058 eend 1058 eend $?
1059 } 1059 }
1060 1060
1061 1061
1062 fi 1062 fi