Merge lp:~peter-pearse/ubuntu/natty/mysql-5.1/prop001 into lp:ubuntu/natty/mysql-5.1

Proposed by Peter Pearse
Status: Needs review
Proposed branch: lp:~peter-pearse/ubuntu/natty/mysql-5.1/prop001
Merge into: lp:ubuntu/natty/mysql-5.1
Diff against target: 459 lines (+370/-6)
4 files modified
debian/changelog (+6/-0)
debian/patches/00list (+1/-0)
debian/patches/60_cross.dpatch (+314/-0)
debian/rules (+49/-6)
To merge this branch: bzr merge lp:~peter-pearse/ubuntu/natty/mysql-5.1/prop001
Reviewer Review Type Date Requested Status
Steve Langasek Needs Fixing
Review via email: mp+48815@code.launchpad.net

Description of the change

Patch debian/rules to
 * Build a complete host build for crosses - partial build would take longer to get correct
 * Pass directory for gen_lex_hash tool down to makes, allowing host binary to be used in crosses
 * Pass correct tools to configure

Added a code patch to
 * Patch Makefile.am to use passed gen_lex_hash directory
 * Patch storage/innodb_plugin/plug.in to allow dpkg-cross/cross-conf.armel overrides for some variables which cannot be determined during a cross.
 * Patch configure contain the resulting automake geneerated code.

To post a comment you must log in.
Revision history for this message
Steve Langasek (vorlon) wrote :

Since gen_lex_hash is not installed in any package and is only used at build time, I think this should be fixed in the upstream rules to accept HOST_CC instead of rebuilding the entire package another time.

review: Needs Fixing

Unmerged revisions

25. By Peter Pearse

Patch for cross building

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-02-02 11:46:14 +0000
3+++ debian/changelog 2011-02-07 17:39:12 +0000
4@@ -1,3 +1,9 @@
5+mysql-5.1 (5.1.54-1ubuntu5) maverick; urgency=low
6+
7+ * Patch for cross building
8+
9+ -- Peter Pearse <peter.pearse@linaro.org> Mon, 07 Feb 2011 17:29:54 +0000
10+
11 mysql-5.1 (5.1.54-1ubuntu4) natty; urgency=low
12
13 [Clint Byrum]
14
15=== modified file 'debian/patches/00list'
16--- debian/patches/00list 2011-01-26 09:19:25 +0000
17+++ debian/patches/00list 2011-02-07 17:39:12 +0000
18@@ -6,3 +6,4 @@
19 41_scripts__mysql_install_db.sh__no_test.dpatch
20 44_scripts__mysql_config__libs.dpatch
21 50_mysql-test__db_test.dpatch
22+60_cross.dpatch
23
24=== added file 'debian/patches/60_cross.dpatch'
25--- debian/patches/60_cross.dpatch 1970-01-01 00:00:00 +0000
26+++ debian/patches/60_cross.dpatch 2011-02-07 17:39:12 +0000
27@@ -0,0 +1,314 @@
28+#! /bin/sh /usr/share/dpatch/dpatch-run
29+## 60_cross.dpatch.dpatch by Peter Pearse <peter.pearse@linaro.org>
30+##
31+## All lines beginning with `## DP:' are a description of the patch.
32+## DP: Patch for cross building
33+
34+@DPATCH@
35+
36+diff -Nru mysql/60_cross.dpatch mysql_patched/60_cross.dpatch
37+--- mysql/60_cross.dpatch 1970-01-01 00:00:00.000000000 +0000
38++++ mysql_patched/60_cross.dpatch 2011-02-07 13:01:30.000000000 +0000
39+@@ -0,0 +1,8 @@
40++#! /bin/sh /usr/share/dpatch/dpatch-run
41++## 60_cross.dpatch.dpatch by Peter Pearse <peter.pearse@linaro.org>
42++##
43++## All lines beginning with `## DP:' are a description of the patch.
44++## DP: Pass tool location down for cross builds
45++
46++@DPATCH@
47++
48+diff -Nru mysql/configure mysql_patched/configure
49+--- mysql/configure 2011-02-07 11:21:50.000000000 +0000
50++++ mysql_patched/configure 2011-02-07 16:34:52.000000000 +0000
51+@@ -47649,9 +47649,33 @@
52+ ;;
53+ esac
54+
55+-
56+ { $as_echo "$as_me:$LINENO: checking whether GCC atomic builtins are available" >&5
57+ $as_echo_n "checking whether GCC atomic builtins are available... " >&6; }
58++
59++# Allow cache work round for cross compiling
60++# storage/innodb_plugin/plug.in has been edited,
61++# but configure.ac not available
62++if test "${ac_cv_HAVE_IB_GCC_ATOMIC_BUILTINS+set}" = set; then
63++ $as_echo_n "(cached) " >&6
64++
65++ if test "x$ac_cv_HAVE_IB_GCC_ATOMIC_BUILTINS" = xyes; then
66++
67++cat >>confdefs.h <<\_ACEOF
68++#define HAVE_IB_GCC_ATOMIC_BUILTINS 1
69++_ACEOF
70++
71++ { $as_echo "$as_me:$LINENO: result: yes" >&5
72++ $as_echo "yes" >&6; }
73++
74++ else
75++
76++ { $as_echo "$as_me:$LINENO: result: no" >&5
77++ $as_echo "no" >&6; }
78++
79++ fi
80++
81++else
82++
83+ # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
84+ if test "$cross_compiling" = yes; then
85+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
86+@@ -47754,10 +47778,34 @@
87+ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
88+ fi
89+
90+-
91++fi
92+
93+ { $as_echo "$as_me:$LINENO: checking whether pthread_t can be used by GCC atomic builtins" >&5
94+ $as_echo_n "checking whether pthread_t can be used by GCC atomic builtins... " >&6; }
95++# Allow cache work round for cross compiling
96++# storage/innodb_plugin/plug.in has been edited,
97++# but configure.ac not available
98++if test "${ac_cv_HAVE_IB_ATOMIC_PTHREAD_T_GCC+set}" = set; then
99++ $as_echo_n "(cached) " >&6
100++
101++ if test "x$ac_cv_HAVE_IB_ATOMIC_PTHREAD_T_GCC" = xyes; then
102++
103++cat >>confdefs.h <<\_ACEOF
104++#define HAVE_IB_ATOMIC_PTHREAD_T_GCC 1
105++_ACEOF
106++
107++ { $as_echo "$as_me:$LINENO: result: yes" >&5
108++ $as_echo "yes" >&6; }
109++
110++ else
111++
112++ { $as_echo "$as_me:$LINENO: result: no" >&5
113++ $as_echo "no" >&6; }
114++
115++ fi
116++
117++else
118++
119+ # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
120+ if test "$cross_compiling" = yes; then
121+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
122+@@ -47840,13 +47888,37 @@
123+ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
124+ fi
125+
126+-
127++fi
128+
129+ { $as_echo "$as_me:$LINENO: checking whether Solaris libc atomic functions are available" >&5
130+ $as_echo_n "checking whether Solaris libc atomic functions are available... " >&6; }
131+- # either define HAVE_IB_SOLARIS_ATOMICS or not
132+
133++# Allow cache work round for cross compiling
134++# storage/innodb_plugin/plug.in has been edited,
135++# but configure.ac not available
136++if test "${ac_cv_HAVE_IB_SOLARIS_ATOMICS+set}" = set; then
137++ $as_echo_n "(cached) " >&6
138+
139++ if test "x$ac_cv_HAVE_IB_SOLARIS_ATOMICS" = xyes; then
140++
141++cat >>confdefs.h <<\_ACEOF
142++#define HAVE_IB_SOLARIS_ATOMICS 1
143++_ACEOF
144++
145++ { $as_echo "$as_me:$LINENO: result: yes" >&5
146++ $as_echo "yes" >&6; }
147++
148++ else
149++
150++ { $as_echo "$as_me:$LINENO: result: no" >&5
151++ $as_echo "no" >&6; }
152++
153++ fi
154++
155++else
156++
157++
158++ # either define HAVE_IB_SOLARIS_ATOMICS or not
159+
160+
161+
162+@@ -48055,7 +48127,7 @@
163+ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
164+ fi
165+
166+-
167++fi
168+
169+ # this is needed to know which one of atomic_cas_32() or atomic_cas_64()
170+ # to use in the source
171+@@ -48423,11 +48495,33 @@
172+ #define SIZEOF_PTHREAD_T $ac_cv_sizeof_pthread_t
173+ _ACEOF
174+
175+-
176+-
177+ # Check for x86 PAUSE instruction
178+ { $as_echo "$as_me:$LINENO: checking for x86 PAUSE instruction" >&5
179+ $as_echo_n "checking for x86 PAUSE instruction... " >&6; }
180++# Allow cache work round for cross compiling
181++# storage/innodb_plugin/plug.in has been edited,
182++# but configure.ac not available
183++if test "${ac_cv_HAVE_IB_PAUSE_INSTRUCTION+set}" = set; then
184++ $as_echo_n "(cached) " >&6
185++
186++ if test "x$ac_cv_HAVE_IB_PAUSE_INSTRUCTION" = xyes; then
187++
188++cat >>confdefs.h <<\_ACEOF
189++#define HAVE_IB_PAUSE_INSTRUCTION 1
190++_ACEOF
191++
192++ { $as_echo "$as_me:$LINENO: result: yes" >&5
193++ $as_echo "yes" >&6; }
194++
195++ else
196++
197++ { $as_echo "$as_me:$LINENO: result: no" >&5
198++ $as_echo "no" >&6; }
199++
200++ fi
201++
202++else
203++
204+ # We have to actually try running the test program, because of a bug
205+ # in Solaris on x86_64, where it wrongly reports that PAUSE is not
206+ # supported when trying to run an application. See
207+@@ -48500,7 +48594,7 @@
208+ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
209+ fi
210+
211+-
212++fi
213+
214+
215+ fi
216+diff -Nru mysql/sql/Makefile.am mysql_patched/sql/Makefile.am
217+--- mysql/sql/Makefile.am 2011-02-07 11:21:53.000000000 +0000
218++++ mysql_patched/sql/Makefile.am 2011-02-07 11:30:26.000000000 +0000
219+@@ -173,9 +173,11 @@
220+ # This generates lex_hash.h
221+ # NOTE Built sources should depend on their sources not the tool
222+ # this avoid the rebuild of the built files in a source dist
223++# GEN_LEX_HASH_DIR may be used to locate host binary during cross builds
224++GEN_LEX_HASH_DIR=.
225+ lex_hash.h: gen_lex_hash.cc lex.h
226+ $(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
227+- ./gen_lex_hash$(EXEEXT) > $@-t
228++ $(GEN_LEX_HASH_DIR)/gen_lex_hash$(EXEEXT) > $@-t
229+ $(MV) $@-t $@
230+
231+ # For testing of udf_example.so
232+diff -Nru mysql/sql/Makefile.in mysql_patched/sql/Makefile.in
233+--- mysql/sql/Makefile.in 2011-02-07 11:21:53.000000000 +0000
234++++ mysql_patched/sql/Makefile.in 2011-02-07 11:36:05.000000000 +0000
235+@@ -1303,9 +1303,11 @@
236+ # This generates lex_hash.h
237+ # NOTE Built sources should depend on their sources not the tool
238+ # this avoid the rebuild of the built files in a source dist
239++# GEN_LEX_HASH_DIR may be used to locate host binary during cross builds
240++GEN_LEX_HASH_DIR = .
241+ lex_hash.h: gen_lex_hash.cc lex.h
242+ $(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
243+- ./gen_lex_hash$(EXEEXT) > $@-t
244++ $(GEN_LEX_HASH_DIR)/gen_lex_hash$(EXEEXT) > $@-t
245+ $(MV) $@-t $@
246+
247+ # We might have some stuff not built in this build, but that we want to install
248+diff -Nru mysql/storage/innodb_plugin/plug.in mysql_patched/storage/innodb_plugin/plug.in
249+--- mysql/storage/innodb_plugin/plug.in 2011-02-07 11:21:53.000000000 +0000
250++++ mysql_patched/storage/innodb_plugin/plug.in 2011-02-07 13:11:42.000000000 +0000
251+@@ -53,8 +53,8 @@
252+ esac
253+ AC_SUBST(INNODB_DYNAMIC_CFLAGS)
254+
255+- AC_MSG_CHECKING(whether GCC atomic builtins are available)
256+- # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
257++ AC_CACHE_CHECK([whether GCC atomic builtins are available],
258++ [ac_cv_HAVE_IB_GCC_ATOMIC_BUILTINS],[
259+ AC_TRY_RUN(
260+ [
261+ int main()
262+@@ -95,17 +95,23 @@
263+ }
264+ ],
265+ [
266+- AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
267+- [GCC atomic builtins are available])
268++ ac_cv_HAVE_IB_GCC_ATOMIC_BUILTINS=yes
269+ AC_MSG_RESULT(yes)
270+ ],
271+ [
272++ ac_cv_HAVE_IB_GCC_ATOMIC_BUILTINS=no
273+ AC_MSG_RESULT(no)
274+ ]
275+ )
276++ ])
277++
278++ if test x"$ac_cv_HAVE_IB_GCC_ATOMIC_BUILTINS" = "xyes" ; then
279++ AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1],
280++ [GCC atomic builtins are available])
281++ fi
282+
283+- AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
284+- # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
285++ AC_CACHE_CHECK([whether pthread_t can be used by GCC atomic builtins],
286++ [ac_cv_HAVE_IB_ATOMIC_PTHREAD_T_GCC],[
287+ AC_TRY_RUN(
288+ [
289+ #include <pthread.h>
290+@@ -126,17 +132,23 @@
291+ }
292+ ],
293+ [
294+- AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
295+- [pthread_t can be used by GCC atomic builtins])
296++ ac_cv_HAVE_IB_ATOMIC_PTHREAD_T_GCC=yes
297+ AC_MSG_RESULT(yes)
298+ ],
299+ [
300++ ac_cv_HAVE_IB_ATOMIC_PTHREAD_T_GCC=no
301+ AC_MSG_RESULT(no)
302+ ]
303+ )
304++ ])
305++
306++ if test x"$ac_cv_HAVE_IB_ATOMIC_PTHREAD_T_GCC" = "xyes" ; then
307++ AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
308++ [pthread_t can be used by GCC atomic builtins])
309++ fi
310+
311+- AC_MSG_CHECKING(whether Solaris libc atomic functions are available)
312+- # either define HAVE_IB_SOLARIS_ATOMICS or not
313++ AC_CACHE_CHECK([whether Solaris libc atomic functions are available],
314++ [ac_cv_HAVE_IB_SOLARIS_ATOMICS],[
315+ AC_CHECK_FUNCS(atomic_cas_ulong \
316+ atomic_cas_32 \
317+ atomic_cas_64 \
318+@@ -189,13 +201,14 @@
319+ AC_MSG_RESULT(no)
320+ ]
321+ )
322++ ])
323+
324+ # this is needed to know which one of atomic_cas_32() or atomic_cas_64()
325+ # to use in the source
326+ AC_CHECK_SIZEOF([pthread_t], [], [#include <pthread.h>])
327+
328+- # Check for x86 PAUSE instruction
329+- AC_MSG_CHECKING(for x86 PAUSE instruction)
330++ AC_CACHE_CHECK([for x86 PAUSE instruction],
331++ [ac_cv_HAVE_IB_PAUSE_INSTRUCTION],[
332+ # We have to actually try running the test program, because of a bug
333+ # in Solaris on x86_64, where it wrongly reports that PAUSE is not
334+ # supported when trying to run an application. See
335+@@ -222,4 +235,6 @@
336+ )
337+ ])
338+
339++ ])
340++
341+ # vim: set ft=config:
342
343=== modified file 'debian/rules'
344--- debian/rules 2011-02-02 11:46:14 +0000
345+++ debian/rules 2011-02-07 17:39:12 +0000
346@@ -15,6 +15,16 @@
347 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
348 DEBVERSION = $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }' | sed 's/^.*-//' )
349
350+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
351+ export MYSQL_BUILD_CC=$(DEB_HOST_GNU_TYPE)-gcc
352+ export MYSQL_BUILD_CXX=$(DEB_HOST_GNU_TYPE)-g++
353+ DEB_BUILD_OPTIONS += nocheck
354+ MAKE_ENV = GEN_LEX_HASH_DIR=../../$(BUILDDIR_HOST)/sql
355+
356+else
357+ MAKE_ENV =
358+endif
359+
360 DEB_SOURCE_PACKAGE ?= $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':'))
361 DEB_VERSION ?= $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
362 DEB_NOEPOCH_VERSION ?= $(shell echo $(DEB_VERSION) | cut -d: -f2-)
363@@ -47,7 +57,12 @@
364
365 BUILDDIR = builddir
366 BUILDDIR_PIC = builddir-pic
367+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
368+BUILDDIR_HOST = builddir-host
369+builddir = $(if $(findstring -pic,$@),$(BUILDDIR_PIC),$(if $(findstring -host,$@),$(BUILDDIR_HOST),$(BUILDDIR)))
370+else
371 builddir = $(if $(findstring -pic,$@),$(BUILDDIR_PIC),$(BUILDDIR))
372+endif
373
374 # This causes seg11 crashes if LDAP is used for groups in /etc/nsswitch.conf
375 # so it is disabled by default although, according to MySQL, it brings >10%
376@@ -62,7 +77,19 @@
377
378 configure: patch configure-stamp
379 configure-pic: patch configure-stamp-pic
380+
381+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
382+
383+configure-host: patch configure-stamp-host
384+
385+configure-stamp-host: HOST_TYPE=$(DEB_BUILD_GNU_TYPE) CC=gcc CXX=g++
386+configure-stamp: HOST_TYPE=$(DEB_HOST_GNU_TYPE) CC=$(DEB_HOST_GNU_TYPE)-gcc CXX=$(DEB_HOST_GNU_TYPE)-g++
387+configure-stamp-pic: HOST_TYPE=$(DEB_HOST_GNU_TYPE) CC=$(DEB_HOST_GNU_TYPE)-gcc CXX=$(DEB_HOST_GNU_TYPE)-g++
388+
389+configure-stamp-host configure-stamp configure-stamp-pic:
390+else
391 configure-stamp configure-stamp-pic:
392+endif
393 @echo "RULES.$@"
394 dh_testdir
395
396@@ -78,7 +105,7 @@
397 CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O3 -DBIG_JOINS=1 -felide-constructors -fno-exceptions -fno-rtti ${FORCE_FPIC_CFLAGS} -fno-strict-aliasing"} \
398 ../configure \
399 --build=${DEB_BUILD_GNU_TYPE} \
400- --host=${DEB_HOST_GNU_TYPE} \
401+ --host=${HOST_TYPE} \
402 \
403 --prefix=/usr \
404 --exec-prefix=/usr \
405@@ -123,9 +150,23 @@
406
407 touch $@
408
409-
410+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
411+build: build-stamp-host build-stamp build-stamp-pic
412+
413+build-stamp-host: configure-host
414+ @echo "RULES.$@"
415+ dh_testdir
416+ [ -f $(EXPORTED_SOURCE_TARBALL) ] || tar -zcf $(EXPORTED_SOURCE_TARBALL) \
417+ --exclude=debian . \
418+ --transform="s,^\./,mysql-5.1/,"
419+
420+ cd $(builddir) && $(MAKE) $(MAKE_J) $(MAKE_ENV)
421+
422+ @touch $@
423+
424+else
425 build: build-stamp build-stamp-pic
426-
427+endif
428 build-stamp: configure
429 @echo "RULES.$@"
430 dh_testdir
431@@ -133,7 +174,7 @@
432 --exclude=debian . \
433 --transform="s,^\./,mysql-5.1/,"
434
435- cd $(builddir) && $(MAKE) $(MAKE_J)
436+ cd $(builddir) && $(MAKE) $(MAKE_J) $(MAKE_ENV)
437
438 ifeq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),)
439 # Don't know why the following is necessary...
440@@ -150,7 +191,7 @@
441
442 touch build-stamp
443
444-MAKE_PIC = cd $(builddir) && $(MAKE) $(MAKE_J)
445+MAKE_PIC = cd $(builddir) && $(MAKE) $(MAKE_J) $(MAKE_ENV)
446
447 build-stamp-pic: configure-pic
448 @echo "RULES.$@"
449@@ -187,7 +228,9 @@
450 [ ! -d mysql-test/var ] || rm -rf mysql-test/var
451
452 rm -rf $(BUILDDIR) $(BUILDDIR_PIC)
453-
454+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
455+ rm -fr $(BUILDDIR_HOST)
456+endif
457 debconf-updatepo
458 rm -f $(EXPORTED_SOURCE_TARBALL)
459 dh_clean -v

Subscribers

People subscribed via source and target branches

to all changes: