summaryrefslogtreecommitdiff
path: root/debian/patches/cross-biarch.diff
blob: 27e2ff9ab0ca9956a61a64cbfed84f2c9db4a456 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# DP: Fix the location of target's libs in cross-build for biarch

Index: b/src/config-ml.in
===================================================================
--- a/src/config-ml.in
+++ b/src/config-ml.in
@@ -533,7 +533,13 @@ multi-do:
 	    else \
 	      if [ -d ../$${dir}/$${lib} ]; then \
 		flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
-		if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
+		libsuffix_="$${dir}"; \
+		if [ "$${dir}" = "n32" ]; then libsuffix_=32; fi; \
+		if [ -n "$$($${compiler} -v 2>&1 |grep '^Target: mips')" ] && [ "$${dir}" = "32" ]; then libsuffix_=o32; fi; \
+		if (cd ../$${dir}/$${lib}; $(MAKE) $(subst \
+				-B$(build_tooldir)/lib/, \
+				-B$(build_tooldir)/lib$${libsuffix_}/, \
+				$(FLAGS_TO_PASS)) \
 				CFLAGS="$(CFLAGS) $${flags}" \
 				CCASFLAGS="$(CCASFLAGS) $${flags}" \
 				FCFLAGS="$(FCFLAGS) $${flags}" \
@@ -786,6 +792,15 @@ if [ -n "${multidirs}" ] && [ -z "${ml_n
 	GFORTRAN_=$GFORTRAN' '
 	GOC_=$GOC' '
     else
+	if [ "${ml_dir}" = "." ]; then
+		FILTER_="s!X\\(.*\\)!\\1!p"
+	elif [ "${ml_dir}" = "n32" ]; then # mips n32 -> lib32
+		FILTER_="s!X\\(.*\\)/!\\132/!p"
+	elif [ "${ml_dir}" = "32" ] && [ "$(echo ${host} |grep '^mips')" ]; then # mips o32 -> libo32
+		FILTER_="s!X\\(.*\\)/!\\1o32/!p"
+	else
+		FILTER_="s!X\\(.*\\)/!\\1${ml_dir}/!p"
+	fi
 	# Create a regular expression that matches any string as long
 	# as ML_POPDIR.
 	popdir_rx=`echo "${ML_POPDIR}" | sed 's,.,.,g'`
@@ -794,6 +809,8 @@ if [ -n "${multidirs}" ] && [ -z "${ml_n
 	  case $arg in
 	  -[BIL]"${ML_POPDIR}"/*)
 	    CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\1/p"`' ' ;;
+	  -B*/lib/)
+	    CC_="${CC_}"`echo "X${arg}" | sed -n "$FILTER_"`' ' ;;
 	  "${ML_POPDIR}"/*)
 	    CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
 	  *)
@@ -806,6 +823,8 @@ if [ -n "${multidirs}" ] && [ -z "${ml_n
 	  case $arg in
 	  -[BIL]"${ML_POPDIR}"/*)
 	    CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
+	  -B*/lib/)
+	    CXX_="${CXX_}"`echo "X${arg}" | sed -n "$FILTER_"`' ' ;;
 	  "${ML_POPDIR}"/*)
 	    CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
 	  *)
@@ -818,6 +837,8 @@ if [ -n "${multidirs}" ] && [ -z "${ml_n
 	  case $arg in
 	  -[BIL]"${ML_POPDIR}"/*)
 	    F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
+	  -B*/lib/)
+	    F77_="${F77_}"`echo "X${arg}" | sed -n "$FILTER_"`' ' ;;
 	  "${ML_POPDIR}"/*)
 	    F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
 	  *)
@@ -830,6 +851,8 @@ if [ -n "${multidirs}" ] && [ -z "${ml_n
 	  case $arg in
 	  -[BIL]"${ML_POPDIR}"/*)
 	    GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
+	  -B*/lib/)
+	    GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "$FILTER_"`' ' ;;
 	  "${ML_POPDIR}"/*)
 	    GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
 	  *)
@@ -842,6 +865,8 @@ if [ -n "${multidirs}" ] && [ -z "${ml_n
 	  case $arg in
 	  -[BIL]"${ML_POPDIR}"/*)
 	    GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
+	  -B*/lib/)
+	    GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "$FILTER_"`' ' ;;
 	  "${ML_POPDIR}"/*)
 	    GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
 	  *)
@@ -854,6 +879,8 @@ if [ -n "${multidirs}" ] && [ -z "${ml_n
 	  case $arg in
 	  -[BIL]"${ML_POPDIR}"/*)
 	    GOC_="${GOC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
+	  -B*/lib/)
+	    GOC_="${GOC_}"`echo "X${arg}" | sed -n "$FILTER_"`' ' ;;
 	  "${ML_POPDIR}"/*)
 	    GOC_="${GOC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
 	  *)