Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 75420 | Differences between
and this patch

Collapse All | Expand All

(-)ebuild.sh (-22 / +160 lines)
Lines 614-624 dyn_setup() Link Here
614
	fi
614
	fi
615
	pkg_setup
615
	pkg_setup
616
}
616
}
617
617
618
set_abi() {
619
	export ABI=${1}
620
621
	if [ "$#" != "1" ]; then
622
		die "set_abi needs to be given the ABI to use."
623
	fi
624
625
	if [ -d "${WORKDIR}" ]; then
626
		unset_abi
627
	fi
628
629
	if [ -d "${WORKDIR}.${ABI}" ]; then
630
		# If it doesn't exist, then we're making it soon in dyn_unpack
631
		mv ${WORKDIR}.${ABI} ${WORKDIR} || die "IO Failure -- Failed to 'mv work.${ABI} work'"
632
	fi
633
634
	echo "${ABI}" > ${BUILDDIR}/.abi || die "IO Failure -- Failed to create .abi."
635
	echo ">>> ABI=${ABI}"
636
637
	local VAR
638
	VAR="CFLAGS_${ABI}"
639
	[ -n "${!VAR}" ] && eval export ${VAR}
640
	VAR="ASFLAGS_${ABI}"
641
	[ -n "${!VAR}" ] && eval export ${VAR}
642
}
643
644
unset_abi() {
645
	if [ -f "${BUILDDIR}/.abi" ]; then
646
		local ABI=$(cat ${BUILDDIR}/.abi)
647
		[ ! -d "${WORKDIR}" ] && die "unset_abi: .abi present (${ABI}) but workdir not present."
648
649
		mv ${WORKDIR} ${WORKDIR}.${ABI} || die "IO Failure -- Failed to 'mv work work.${ABI}'."
650
		rm -rf ${BUILDDIR}/.abi || die "IO Failure -- Failed to 'rm -rf .abi'."
651
	fi
652
}
653
654
get_abi_order() {
655
	local order=""
656
657
	if ! hasq multilib-pkg ${FEATURES}; then
658
		order="NOMULTILIB"
659
	elif ! hasq multilib-pkg ${RESTRICT}; then
660
		order="${DEFAULT_ABI}"
661
	else
662
		for x in ${MULTILIB_ABIS}; do
663
			if [ "${x}" != "${DEFAULT_ABI}" ]; then
664
				hasq ${x} ${ABI_DENY} || ordera="${ordera} ${x}"
665
			fi
666
		done
667
		hasq ${DEFAULT_ABI} ${ABI_DENY} || order="${ordera} ${DEFAULT_ABI}"
668
669
		if [ -n "${ABI_ALLOW}" ]; then
670
			local ordera=""
671
			for x in ${order}; do
672
				if hasq ${x} ${ABI_ALLOW}; then
673
					ordera="${ordera} ${x}"
674
				fi
675
			done
676
			order="${ordera}"
677
		fi
678
	fi
679
680
	if [ -z "${order}" ]; then
681
		die "The ABI list is empty.  Are you using a proper multilib profile?  Perhaps your USE flags or MULTILIB_ABIS are too restrictive for this package."
682
	fi
683
684
	echo ${order}
685
}
686
618
dyn_unpack() {
687
dyn_unpack() {
619
	trap "abort_unpack" SIGINT SIGQUIT
688
	trap "abort_unpack" SIGINT SIGQUIT
620
	local newstuff="no"
689
	local newstuff="no"
690
691
	for ABI in $(get_abi_order); do
692
		if [ "${ABI}" = "NOMULTILIB" ]; then
693
			unset ABI
694
		else
695
			set_abi ${ABI}
696
		fi
621
	if [ -e "${WORKDIR}" ]; then
697
	if [ -e "${WORKDIR}" ]; then
622
		local x
698
		local x
623
		local checkme
699
		local checkme
624
		for x in ${AA}; do
700
		for x in ${AA}; do
Lines 640-665 dyn_unpack() { Link Here
640
			rm -rf "${WORKDIR}"
716
			rm -rf "${WORKDIR}"
641
		fi
717
		fi
642
	fi
718
	fi
643
	if [ -e "${WORKDIR}" ]; then
719
	if [ -e "${WORKDIR}" ]; then
644
		if [ "$newstuff" == "no" ]; then
720
		if [ "${newstuff}" == "no" ]; then
645
			echo ">>> WORKDIR is up-to-date, keeping..."
721
			echo ">>> WORKDIR is up-to-date, keeping..."
646
			return 0
722
			unset_abi
723
			continue
647
		fi
724
		fi
648
	fi
725
	fi
649
	
726
	
650
	install -m0700 -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
727
	install -m0700 -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
651
	[ -d "$WORKDIR" ] && cd "${WORKDIR}"
728
	[ -d "${WORKDIR}" ] && cd "${WORKDIR}"
652
	echo ">>> Unpacking source..."
729
	echo ">>> Unpacking source..."
653
	src_unpack
730
	src_unpack
731
		unset_abi
732
	done
733
	unset ABI
654
	touch "${BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in BUILDIR"
734
	touch "${BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in BUILDIR"
655
	echo ">>> Source unpacked."
735
	echo ">>> Source unpacked."
656
	cd "$BUILDDIR"
736
	cd "${BUILDDIR}"
657
	trap SIGINT SIGQUIT
737
	trap SIGINT SIGQUIT
658
}
738
}
659
739
660
dyn_clean() {
740
dyn_clean() {
661
	if [ "$USERLAND" == "BSD" ] && type -p chflags &>/dev/null; then
741
	if [ "${USERLAND}" == "BSD" ] && type -p chflags &>/dev/null; then
662
		chflags -R noschg,nouchg,nosappnd,nouappnd,nosunlnk,nouunlnk \
742
		chflags -R noschg,nouchg,nosappnd,nouappnd,nosunlnk,nouunlnk \
663
			"${BUILDDIR}"
743
			"${BUILDDIR}"
664
	fi
744
	fi
665
745
Lines 671-683 dyn_clean() { Link Here
671
		mv "${T}/environment" "${T}/environment.keeptemp"
751
		mv "${T}/environment" "${T}/environment.keeptemp"
672
	fi
752
	fi
673
753
674
	if ! hasq keepwork $FEATURES; then
754
	if ! hasq keepwork $FEATURES; then
675
		rm -rf "${BUILDDIR}/.compiled"
755
		rm -rf "${BUILDDIR}/.abi"
756
		rm -rf "${BUILDDIR}/.compiled*"
676
		rm -rf "${BUILDDIR}/.unpacked"
757
		rm -rf "${BUILDDIR}/.unpacked"
677
		rm -rf "${BUILDDIR}/.installed"
758
		rm -rf "${BUILDDIR}/.installed"
678
		rm -rf "${BUILDDIR}/build-info"
759
		rm -rf "${BUILDDIR}/build-info"
679
		rm -rf "${WORKDIR}"
760
		rm -rf "${WORKDIR}*"
680
	fi
761
	fi
681
762
682
	if [ -f "${BUILDDIR}/.unpacked" ]; then
763
	if [ -f "${BUILDDIR}/.unpacked" ]; then
683
		find "${BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null
764
		find "${BUILDDIR}" -type d ! -regex "^${WORKDIR}" | sort -r | tr "\n" "\0" | $XARGS -0 rmdir &>/dev/null
Lines 799-807 abort_compile() { Link Here
799
880
800
abort_unpack() {
881
abort_unpack() {
801
	abort_handler "src_unpack" $1
882
	abort_handler "src_unpack" $1
802
	rm -f "${BUILDDIR}/.unpacked"
883
	rm -f "${BUILDDIR}/.unpacked"
803
	rm -rf "${BUILDDIR}/work"
884
	rm -rf "${BUILDDIR}/work*"
804
	exit 1
885
	exit 1
805
}
886
}
806
887
807
abort_package() {
888
abort_package() {
Lines 862-888 dyn_compile() { Link Here
862
		mkdir build-info
943
		mkdir build-info
863
	fi
944
	fi
864
	cp "${EBUILD}" "build-info/${PF}.ebuild"
945
	cp "${EBUILD}" "build-info/${PF}.ebuild"
865
	
946
	
866
	if [ ${BUILDDIR}/.compiled -nt "${WORKDIR}" ]; then
947
	if [ "$(get_abi_order)" = "NOMULTILIB" -a
948
	     ${BUILDDIR}/.compiled -nt "${WORKDIR}" ]; then
867
		echo ">>> It appears that ${PN} is already compiled; skipping."
949
		echo ">>> It appears that ${PN} is already compiled; skipping."
868
		echo ">>> (clean to force compilation)"
950
		echo ">>> (clean to force compilation)"
869
		trap SIGINT SIGQUIT
951
		trap SIGINT SIGQUIT
870
		return
952
		return
871
	fi
953
	fi
872
	if [ -d "${S}" ]; then
873
		cd "${S}"
874
	fi
875
	#our custom version of libtool uses $S and $D to fix
954
	#our custom version of libtool uses $S and $D to fix
876
	#invalid paths in .la files
955
	#invalid paths in .la files
877
	export S D
956
	export S D
878
	#some packages use an alternative to $S to build in, cause
957
	#some packages use an alternative to $S to build in, cause
879
	#our libtool to create problematic .la files
958
	#our libtool to create problematic .la files
880
	export PWORKDIR="$WORKDIR"
959
	export PWORKDIR="$WORKDIR"
881
	src_compile
960
961
	for ABI in $(get_abi_order); do
962
		if [ "${ABI}" = "NOMULTILIB" ]; then
963
			unset ABI
964
		else
965
			set_abi ${ABI}
966
967
			if [ ${BUILDDIR}/.compiled.${ABI} -nt "${WORKDIR}" ]; then
968
				echo ">>> It appears that ${PN} is already compiled for ABI=${ABI}; skipping."
969
				echo ">>> (clean to force compilation)"
970
				unset_abi
971
				continue
972
			fi
973
		fi
974
975
		if [ -d "${S}" ]; then
976
			cd "${S}"
977
		fi
978
		src_compile
979
980
		if [ "${ABI}" != "NOMULTILIB" ]; then
981
			cd "${BUILDDIR}"
982
			touch .compiled.${ABI} || die "IO Failure -- Failed to 'touch .compiled.${ABI}'"
983
			unset_abi
984
		fi
985
	done
986
	unset ABI
987
882
	#|| abort_compile "fail"
988
	#|| abort_compile "fail"
883
	cd "${BUILDDIR}"
989
	cd "${BUILDDIR}"
884
	touch .compiled
990
	touch .compiled || "IO Failure -- Failed to 'touch .compiled'"
885
	cd build-info
991
	cd build-info
886
992
887
	echo "$ASFLAGS"        > ASFLAGS
993
	echo "$ASFLAGS"        > ASFLAGS
888
	echo "$CATEGORY"       > CATEGORY
994
	echo "$CATEGORY"       > CATEGORY
Lines 913-920 dyn_compile() { Link Here
913
	echo "$RESTRICT"       > RESTRICT
1019
	echo "$RESTRICT"       > RESTRICT
914
	echo "$SLOT"           > SLOT
1020
	echo "$SLOT"           > SLOT
915
	echo "$USE"            > USE
1021
	echo "$USE"            > USE
916
1022
1023
	if [ "$(get_abi_order)" != "NOMULTILIB" ]; then
1024
		echo "$(get_abi_order)" > MULTILIB_ABIS
1025
	fi
1026
917
	set                                         >  environment
1027
	set                                         >  environment
918
	export -p | sed 's:declare -rx:declare -x:' >> environment
1028
	export -p | sed 's:declare -rx:declare -x:' >> environment
919
	bzip2 -9 environment
1029
	bzip2 -9 environment
920
1030
Lines 946-963 dyn_package() { Link Here
946
1056
947
1057
948
dyn_test() {
1058
dyn_test() {
949
	trap "abort_test" SIGINT SIGQUIT
1059
	trap "abort_test" SIGINT SIGQUIT
950
	if [ -d "${S}" ]; then
951
		cd "${S}"
952
	fi
953
	if hasq maketest $RESTRICT; then
1060
	if hasq maketest $RESTRICT; then
954
		ewarn "Skipping make test/check due to ebuild restriction."
1061
		ewarn "Skipping make test/check due to ebuild restriction."
955
		echo ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}"
1062
		echo ">>> Test phase [explicitly disabled]: ${CATEGORY}/${PF}"
956
	elif ! hasq maketest $FEATURES; then
1063
	elif ! hasq maketest $FEATURES; then
957
		echo ">>> Test phase [not enabled]: ${CATEGORY}/${PF}"
1064
		echo ">>> Test phase [not enabled]: ${CATEGORY}/${PF}"
958
	else
1065
	else
959
		src_test
1066
		for ABI in $(get_abi_order); do
1067
			if [ "${ABI}" = "NOMULTILIB" ]; then
1068
				unset ABI
1069
			else
1070
				set_abi ${ABI}
1071
			fi
1072
1073
			if [ -d "${S}" ]; then
1074
				cd "${S}"
1075
			fi
1076
			src_test
1077
1078
			if [ "${ABI}" != "NOMULTILIB" ]; then
1079
				unset_abi
1080
			fi
1081
		done
1082
		unset ABI
960
	fi
1083
	fi
961
1084
962
	cd "${BUILDDIR}"
1085
	cd "${BUILDDIR}"
963
	touch .tested || die "Failed to 'touch .tested' in ${BUILDDIR}"
1086
	touch .tested || die "Failed to 'touch .tested' in ${BUILDDIR}"
Lines 969-988 dyn_test() { Link Here
969
dyn_install() {
1092
dyn_install() {
970
	trap "abort_install" SIGINT SIGQUIT
1093
	trap "abort_install" SIGINT SIGQUIT
971
	rm -rf "${BUILDDIR}/image"
1094
	rm -rf "${BUILDDIR}/image"
972
	mkdir "${BUILDDIR}/image"
1095
	mkdir "${BUILDDIR}/image"
973
	if [ -d "${S}" ]; then
974
		cd "${S}"
975
	fi
976
	echo
1096
	echo
977
	echo ">>> Install ${PF} into ${D} category ${CATEGORY}"
1097
	echo ">>> Install ${PF} into ${D} category ${CATEGORY}"
978
	#our custom version of libtool uses $S and $D to fix
1098
	#our custom version of libtool uses $S and $D to fix
979
	#invalid paths in .la files
1099
	#invalid paths in .la files
980
	export S D
1100
	export S D
981
	#some packages uses an alternative to $S to build in, cause
1101
	#some packages uses an alternative to $S to build in, cause
982
	#our libtool to create problematic .la files
1102
	#our libtool to create problematic .la files
983
	export PWORKDIR="$WORKDIR"
1103
	export PWORKDIR="$WORKDIR"
984
	src_install
1104
1105
	for ABI in $(get_abi_order); do
1106
		if [ "${ABI}" = "NOMULTILIB" ]; then
1107
			unset ABI
1108
		else
1109
			set_abi ${ABI}
1110
		fi
1111
1112
		if [ -d "${S}" ]; then
1113
			cd "${S}"
1114
		fi
1115
		src_install
1116
1117
		if [ "${ABI}" != "NOMULTILIB" ]; then
1118
			unset_abi
1119
		fi
1120
	done
1121
	unset ABI
1122
985
	#|| abort_install "fail"
1123
	#|| abort_install "fail"
986
	prepall
1124
	prepall
987
	cd "${D}"
1125
	cd "${D}"
988
1126

Return to bug 75420