initial import
[patches.git] / catalyst-relative-paths.patch
1 Index: catalyst
2 ===================================================================
3 --- catalyst (revision 1234)
4 +++ catalyst (working copy)
5 @@ -91,6 +91,10 @@
6 print "Setting",x,"to default value \""+confdefaults[x]+"\""
7 conf_values[x]=confdefaults[x]
8
9 + # use local stuff if we're running out of a svn dir
10 + if os.path.isdir(os.path.join(os.path.dirname(sys.argv[0]), ".svn")):
11 + conf_values["sharedir"] = os.path.dirname(sys.argv[0]);
12 +
13 # parse out the rest of the options from the config file
14 if "autoresume" in string.split(conf_values["options"]):
15 print "Autoresuming support enabled."
16 Index: targets/stage1/stage1-preclean-chroot.sh
17 ===================================================================
18 --- targets/stage1/stage1-preclean-chroot.sh (revision 1234)
19 +++ targets/stage1/stage1-preclean-chroot.sh (working copy)
20 @@ -1,6 +1,6 @@
21 #!/bin/bash
22
23 -. /tmp/chroot-functions.sh
24 +. ./tmp/chroot-functions.sh
25
26 # Now, some finishing touches to initialize gcc-config....
27 unset ROOT
28 @@ -9,12 +9,12 @@
29 setup_binutils
30
31 # Stage1 is not going to have anything in zoneinfo, so save our Factory timezone
32 -if [ -d /usr/share/zoneinfo ]
33 +if [ -d ./usr/share/zoneinfo ]
34 then
35 - rm -f /etc/localtime
36 - cp /usr/share/zoneinfo/Factory /etc/localtime
37 + rm -f ./etc/localtime
38 + cp ./usr/share/zoneinfo/Factory ./etc/localtime
39 else
40 - echo UTC > /etc/TZ
41 + echo UTC > ./etc/TZ
42 fi
43
44 #if [ -n "${clst_CCACHE}" ]
45 Index: targets/stage1/stage1-chroot.sh
46 ===================================================================
47 --- targets/stage1/stage1-chroot.sh (revision 1234)
48 +++ targets/stage1/stage1-chroot.sh (working copy)
49 @@ -1,13 +1,15 @@
50 #!/bin/bash
51
52 -. /tmp/chroot-functions.sh
53 +. ./tmp/chroot-functions.sh
54
55 +set -x
56 +
57 update_env_settings
58
59 setup_myfeatures
60
61 # Setup our environment
62 -export clst_buildpkgs="$(/tmp/build.py)"
63 +export clst_buildpkgs="$(./tmp/build.py)"
64 export STAGE1_USE="$(portageq envvar STAGE1_USE)"
65 export USE="-* build ${STAGE1_USE}"
66 export FEATURES="${clst_myfeatures} nodoc noman noinfo"
67 @@ -25,7 +27,7 @@
68 clst_root_path=/ setup_portage
69
70 run_emerge "--noreplace --oneshot ${clst_buildpkgs}"
71 -rm -f /var/lib/portage/world
72 -touch /var/lib/portage/world
73 +rm -f ./var/lib/portage/world
74 +touch ./var/lib/portage/world
75
76 -rm -f /var/log/emerge.log
77 +rm -f ./var/log/emerge.log
78 Index: targets/support/functions.sh
79 ===================================================================
80 --- targets/support/functions.sh (revision 1234)
81 +++ targets/support/functions.sh (working copy)
82 @@ -9,7 +9,7 @@
83 chmod 755 ${dest_dir}/${file_name}
84 else
85 echo "copying ${file_name} to ${clst_chroot_path}/tmp"
86 - mkdir -p ${chroot_path}/tmp
87 + mkdir -p ${clst_chroot_path}/tmp
88 cp -pPR ${1} ${clst_chroot_path}/tmp
89 chmod 755 ${clst_chroot_path}/tmp/${file_name}
90 fi
91 @@ -36,15 +36,31 @@
92 chroot_path=${clst_chroot_path}${subdir}
93 copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \
94 ${subdir}/tmp/
95 - echo "Running ${file_name} in chroot ${chroot_path}"
96 - ${clst_CHROOT} ${chroot_path} /tmp/${file_name} || exit 1
97 + echo "Running ${file_name} in chroot ${chroot_path}"
98 + if ${clst_crosscompile} ; then
99 + pushd ${chroot_path} > /dev/null || exit 1
100 + export CFLAGS="$(portageq envvar CFLAGS) --sysroot=${chroot_path}"
101 + export CPPFLAGS="$(portageq envvar CPPFLAGS) --sysroot=${chroot_path}"
102 + ROOT=${chroot_path} ./tmp/${file_name} || exit 1
103 + popd > /dev/null
104 + else
105 + ${clst_CHROOT} ${chroot_path} /tmp/${file_name} || exit 1
106 + fi
107 else
108 copy_to_chroot ${1} tmp/
109 chroot_path=${clst_chroot_path}
110 copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \
111 tmp/
112 echo "Running ${file_name} in chroot ${chroot_path}"
113 - ${clst_CHROOT} ${chroot_path}/ /tmp/${file_name} || exit 1
114 + if ${clst_crosscompile} ; then
115 + pushd ${chroot_path} > /dev/null || exit 1
116 + export CFLAGS="$(portageq envvar CFLAGS) --sysroot=${chroot_path}"
117 + export CPPFLAGS="$(portageq envvar CPPFLAGS) --sysroot=${chroot_path}"
118 + ROOT=${chroot_path} ./tmp/${file_name} || exit 1
119 + popd > /dev/null
120 + else
121 + ${clst_CHROOT} ${chroot_path}/ /tmp/${file_name} || exit 1
122 + fi
123 fi
124
125 rm -f ${chroot_path}/tmp/${file_name}
126 @@ -217,6 +233,4 @@
127 esac
128 }
129
130 -run_crossdev() {
131 - crossdev ${clst_CHOST}
132 -}
133 +. ${clst_sharedir}/targets/support/cross-functions.sh
134 Index: targets/support/chroot-functions.sh
135 ===================================================================
136 --- targets/support/chroot-functions.sh (revision 1234)
137 +++ targets/support/chroot-functions.sh (working copy)
138 @@ -96,9 +96,9 @@
139 }
140
141 setup_gcc(){
142 - if [ -x /usr/bin/gcc-config ]
143 + if [ -x ./usr/bin/gcc-config ]
144 then
145 - mythang=$( cd /etc/env.d/gcc; ls ${clst_CHOST}-* | head -n 1 )
146 + mythang=$( cd ./etc/env.d/gcc; ls ${clst_CHOST}-* | head -n 1 )
147 if [ -z "${mythang}" ]
148 then
149 mythang=1
150 @@ -108,9 +108,9 @@
151 }
152
153 setup_binutils(){
154 - if [ -x /usr/bin/binutils-config ]
155 + if [ -x ./usr/bin/binutils-config ]
156 then
157 - mythang=$( cd /etc/env.d/binutils; ls ${clst_CHOST}-* | head -n 1 )
158 + mythang=$( cd ./etc/env.d/binutils; ls ${clst_CHOST}-* | head -n 1 )
159 if [ -z "${mythang}" ]
160 then
161 mythang=1
162 @@ -120,31 +120,24 @@
163 }
164
165 cleanup_distcc() {
166 - rm -rf /etc/distcc/hosts
167 + rm -rf ./etc/distcc/hosts
168 }
169
170 update_env_settings(){
171 /usr/sbin/env-update
172 - source /etc/profile
173 - [ -f /tmp/envscript ] && source /tmp/envscript
174 + ${clst_crosscompile} || source /etc/profile
175 + [ -f ./tmp/envscript ] && source ./tmp/envscript
176 }
177
178 die() {
179 - echo "$1"
180 + echo "$*"
181 exit 1
182 }
183
184 make_destpath() {
185 - if [ "${1}" = "" ]
186 - then
187 - export ROOT=/
188 - else
189 - export ROOT=${1}
190 - if [ ! -d ${ROOT} ]
191 - then
192 - install -d ${ROOT}
193 - fi
194 - fi
195 + export ROOT=${1:-/}
196 + ${clst_crosscompile} && export ROOT=${clst_chroot_path}${ROOT}
197 + [ ! -d ${ROOT} ] && install -d ${ROOT}
198 }
199
200 run_emerge() {