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

Return to bug 75420