Hi Julien

On Sat, Jan 12, 2013 at 10:54:34PM +0100, Julien Cristau wrote:
> On Sat, Jan 12, 2013 at 20:44:59 +0100, Salvatore Bonaccorso wrote:
> 
> > +--- a/configure.in
> > ++++ b/configure.in
> > +@@ -551,7 +551,7 @@
> > +   if test "${MYSQL_LIBS}" = "yes"; then
> > +           AC_MSG_CHECKING(autodect mysql libs)
> > +           # Autodetect
> > +-          for w in /usr/lib64 /usr/lib /usr/local/lib /usr/mysql 
> > /usr/local/mysql /usr/local/mysql/lib /opt /opt/mysql; do
> > ++          for w in /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH); do
> > +                   # check for plain setups
> > +                   if test -f $w/libmysqlclient.a -o -f 
> > $w/libmysqlclient.so; then
> > +                           MYSQL_LIBDIR=$w
> 
> *puke*

Okay ...

Would an approach using mysql_config from libmysqlclient-dev package
be a more viable solution? I tried to look around how other solved the
problem.

p.s.: only trying to help on open RC bugs ;-)

Regards,
Salvatore
diff -Nru motion-3.2.12/debian/changelog motion-3.2.12/debian/changelog
--- motion-3.2.12/debian/changelog      2012-06-06 12:25:16.000000000 +0200
+++ motion-3.2.12/debian/changelog      2013-01-13 10:35:53.000000000 +0100
@@ -1,3 +1,31 @@
+motion (3.2.12-3.4) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Revert changes done in previous upload
+  * Add 03_mysql_multiarch.patch patch.
+    Autodetect multiarch libmysqlclient path in autoconf. (Closes: #697221)
+  * Change Build-Depends on libmysqlclient-dev.
+    Make the Build-Depends on libmysqlclient-dev versioned on (>= 5.5). At
+    least a 5.5 version of libmysqlclient-dev is required for the
+    mysql_config --variable=$VAR calls.
+  * Refresh 02_libav_multiarch.patch patch.
+    Don't use dpkg-architecture in configure.in but try to rely on the
+    information given by pkg-config.
+  * Add Build-Depends on pkg-config
+
+ -- Salvatore Bonaccorso <car...@debian.org>  Sun, 13 Jan 2013 10:35:16 +0100
+
+motion (3.2.12-3.3) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Properly find MySQL in /usr/lib/$(DEB_HOST_MULTIARCH).
+    + Build-Depend on dpkg-dev >= 1.16
+    + Get DEB_HOST_MULTIARCH from dpkg-architecture.
+    + Pass --with-mysql-dir=/usr/lib/$(DEB_HOST_MULTIARCH) to configure.
+    Closes: #697221
+
+ -- Evgeni Golov <evg...@debian.org>  Thu, 03 Jan 2013 12:00:38 +0100
+
 motion (3.2.12-3.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru motion-3.2.12/debian/control motion-3.2.12/debian/control
--- motion-3.2.12/debian/control        2012-06-06 11:36:07.000000000 +0200
+++ motion-3.2.12/debian/control        2013-01-13 10:35:53.000000000 +0100
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Juan Angulo Moreno <j...@apuntale.com>
 HomePage: http://motion.sf.net
-Build-Depends: debhelper (>= 6), dh-autoreconf, libjpeg-dev, zlib1g-dev, 
libavcodec-dev, libavformat-dev, libpq-dev, libmysqlclient-dev, libv4l-dev
+Build-Depends: debhelper (>= 6), dh-autoreconf, libjpeg-dev, zlib1g-dev, 
libavcodec-dev, libavformat-dev, libpq-dev, libmysqlclient-dev (>= 5.5), 
libv4l-dev, pkg-config
 Standards-Version: 3.9.2
 
 Package: motion
diff -Nru motion-3.2.12/debian/patches/02_libav_multiarch.patch 
motion-3.2.12/debian/patches/02_libav_multiarch.patch
--- motion-3.2.12/debian/patches/02_libav_multiarch.patch       2012-02-12 
23:00:38.000000000 +0100
+++ motion-3.2.12/debian/patches/02_libav_multiarch.patch       2013-01-13 
10:35:53.000000000 +0100
@@ -4,15 +4,17 @@
 
 --- a/configure.in
 +++ b/configure.in
-@@ -318,7 +318,12 @@
+@@ -318,7 +318,14 @@
        # AUTODETECT STATIC/SHARED LIB 
        AC_MSG_CHECKING(for ffmpeg autodetecting libraries)
  
 -      if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && 
test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then
-+      if test -f /usr/lib/$(dpkg-architecture 
-qDEB_BUILD_MULTIARCH)/libavcodec.so ; then
-+              AC_MSG_RESULT(found in /usr/lib/$(dpkg-architecture 
-qDEB_BUILD_MULTIARCH))
++      PKG_CONFIG_FFMPEG_LIBDIR="$(pkg-config --variable=libdir libavcodec 
2>/dev/null)"
++
++      if test -n "$PKG_CONFIG_FFMPEG_LIBDIR" ; then
++              AC_MSG_RESULT(found in $PKG_CONFIG_FFMPEG_LIBDIR)
 +              FFMPEG_OK="found"
-+              FFMPEG_LIB="/usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)"
++              FFMPEG_LIB="$PKG_CONFIG_FFMPEG_LIBDIR"
 +              FFMPEG_DIR="/usr"
 +      elif test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && 
test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then
                AC_MSG_RESULT(found in /usr/lib64)
diff -Nru motion-3.2.12/debian/patches/03_mysql_multiarch.patch 
motion-3.2.12/debian/patches/03_mysql_multiarch.patch
--- motion-3.2.12/debian/patches/03_mysql_multiarch.patch       1970-01-01 
01:00:00.000000000 +0100
+++ motion-3.2.12/debian/patches/03_mysql_multiarch.patch       2013-01-13 
10:35:53.000000000 +0100
@@ -0,0 +1,100 @@
+Description: Description: Autodetect multiarch libmysqlclient path in autoconf.
+Origin: vendor
+Bug-Debian: http://bugs.debian.org/697221
+Forwarded: no
+Author: Salvatore Bonaccorso <car...@debian.org>
+Last-Update: 2013-01-12
+
+--- a/configure.in
++++ b/configure.in
+@@ -509,23 +509,28 @@
+       if test "${MYSQL_HEADERS}" = "yes"; then
+               AC_MSG_CHECKING(autodect mysql headers)
+               # Autodetect
+-              for w in /usr/include /usr/local/include /usr/mysql 
/usr/local/mysql /usr/local/mysql/include /opt /opt/mysql; do
+-                      # check for plain setups
+-                      if test -f $w/mysql.h; then
+-                              MYSQL_INCDIR=$w
+-                              break
+-                      fi
+-                      # check for "/usr/include/<packagename>" type setups
+-                      if test -f $w/mysql/mysql.h; then
+-                              MYSQL_INCDIR=$w/mysql
+-                              break
+-                      fi
+-                      # check for "/usr/<packagename>/include" type setups
+-                      if test -f $w/mysql/include/mysql.h; then
+-                              MYSQL_INCDIR=$w/mysql/include
+-                              break
+-                      fi
+-              done
++              MYSQL_CONFIG="$(which mysql_config 2>/dev/null)"
++              if test -n "$MYSQL_CONFIG"; then
++                      MYSQL_INCDIR="$(mysql_config --variable=pkgincludedir)"
++              else
++                      for w in /usr/include /usr/local/include /usr/mysql 
/usr/local/mysql /usr/local/mysql/include /opt /opt/mysql; do
++                              # check for plain setups
++                              if test -f $w/mysql.h; then
++                                      MYSQL_INCDIR=$w
++                                      break
++                              fi
++                              # check for "/usr/include/<packagename>" type 
setups
++                              if test -f $w/mysql/mysql.h; then
++                                      MYSQL_INCDIR=$w/mysql
++                                      break
++                              fi
++                              # check for "/usr/<packagename>/include" type 
setups
++                              if test -f $w/mysql/include/mysql.h; then
++                                      MYSQL_INCDIR=$w/mysql/include
++                                      break
++                              fi
++                      done
++              fi
+       elif test "${MYSQL_HEADERS}" = "no"; then
+               AC_MSG_CHECKING(for mysql headers)      
+               AC_MSG_RESULT(skipped)
+@@ -553,23 +558,27 @@
+       if test "${MYSQL_LIBS}" = "yes"; then
+               AC_MSG_CHECKING(autodect mysql libs)
+               # Autodetect
+-              for w in /usr/lib64 /usr/lib /usr/local/lib /usr/mysql 
/usr/local/mysql /usr/local/mysql/lib /opt /opt/mysql; do
+-                      # check for plain setups
+-                      if test -f $w/libmysqlclient.a -o -f 
$w/libmysqlclient.so; then
+-                              MYSQL_LIBDIR=$w
+-                              break
+-                      fi
+-                      # check for "/usr/lib/<packagename>" type setups
+-                      if test -f $w/mysql/libmysqlclient.a -o -f 
$w/mysql/libmysqlclient.so; then
+-                              MYSQL_LIBDIR=$w/mysql
+-                              break
+-                      fi
+-                      # check for "/usr/<packagename>/lib" type setups
+-                      if test -f $w/mysql/lib/libmysqlclient.a -o -f 
$w/mysql/lib/libmysqlclient.so; then
+-                              MYSQL_LIBDIR=$w/mysql/lib
+-                              break
+-                      fi
+-              done
++              if test -n "$MYSQL_CONFIG"; then
++                      MYSQL_LIBDIR="$(mysql_config --variable=pkglibdir)"
++              else
++                      for w in /usr/lib64 /usr/lib /usr/local/lib /usr/mysql 
/usr/local/mysql /usr/local/mysql/lib /opt /opt/mysql; do
++                              # check for plain setups
++                              if test -f $w/libmysqlclient.a -o -f 
$w/libmysqlclient.so; then
++                                      MYSQL_LIBDIR=$w
++                                      break
++                              fi
++                              # check for "/usr/lib/<packagename>" type setups
++                              if test -f $w/mysql/libmysqlclient.a -o -f 
$w/mysql/libmysqlclient.so; then
++                                      MYSQL_LIBDIR=$w/mysql
++                                      break
++                              fi
++                              # check for "/usr/<packagename>/lib" type setups
++                              if test -f $w/mysql/lib/libmysqlclient.a -o -f 
$w/mysql/lib/libmysqlclient.so; then
++                                      MYSQL_LIBDIR=$w/mysql/lib
++                                      break
++                              fi
++                      done
++              fi
+       elif test "${MYSQL_LIBS}" = "no"; then
+               AC_MSG_CHECKING(for mysql libs)
+               AC_MSG_RESULT(skipped)
diff -Nru motion-3.2.12/debian/patches/series 
motion-3.2.12/debian/patches/series
--- motion-3.2.12/debian/patches/series 2012-02-12 22:16:11.000000000 +0100
+++ motion-3.2.12/debian/patches/series 2013-01-13 10:35:53.000000000 +0100
@@ -4,3 +4,4 @@
 020111027~5dd9ed4.patch
 01_videodev.h.diff
 02_libav_multiarch.patch
+03_mysql_multiarch.patch
diff -Nru motion-3.2.12/debian/changelog motion-3.2.12/debian/changelog
--- motion-3.2.12/debian/changelog      2013-01-05 19:25:43.000000000 +0100
+++ motion-3.2.12/debian/changelog      2013-01-13 10:35:53.000000000 +0100
@@ -1,3 +1,20 @@
+motion (3.2.12-3.4) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Revert changes done in previous upload
+  * Add 03_mysql_multiarch.patch patch.
+    Autodetect multiarch libmysqlclient path in autoconf. (Closes: #697221)
+  * Change Build-Depends on libmysqlclient-dev.
+    Make the Build-Depends on libmysqlclient-dev versioned on (>= 5.5). At
+    least a 5.5 version of libmysqlclient-dev is required for the
+    mysql_config --variable=$VAR calls.
+  * Refresh 02_libav_multiarch.patch patch.
+    Don't use dpkg-architecture in configure.in but try to rely on the
+    information given by pkg-config.
+  * Add Build-Depends on pkg-config
+
+ -- Salvatore Bonaccorso <car...@debian.org>  Sun, 13 Jan 2013 10:35:16 +0100
+
 motion (3.2.12-3.3) unstable; urgency=low
 
   * Non-maintainer upload.
diff -Nru motion-3.2.12/debian/control motion-3.2.12/debian/control
--- motion-3.2.12/debian/control        2013-01-05 19:25:27.000000000 +0100
+++ motion-3.2.12/debian/control        2013-01-13 10:35:53.000000000 +0100
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Juan Angulo Moreno <j...@apuntale.com>
 HomePage: http://motion.sf.net
-Build-Depends: debhelper (>= 6), dpkg-dev (>= 1.16), dh-autoreconf, 
libjpeg-dev, zlib1g-dev, libavcodec-dev, libavformat-dev, libpq-dev, 
libmysqlclient-dev, libv4l-dev
+Build-Depends: debhelper (>= 6), dh-autoreconf, libjpeg-dev, zlib1g-dev, 
libavcodec-dev, libavformat-dev, libpq-dev, libmysqlclient-dev (>= 5.5), 
libv4l-dev, pkg-config
 Standards-Version: 3.9.2
 
 Package: motion
diff -Nru motion-3.2.12/debian/patches/02_libav_multiarch.patch 
motion-3.2.12/debian/patches/02_libav_multiarch.patch
--- motion-3.2.12/debian/patches/02_libav_multiarch.patch       2012-02-12 
23:00:38.000000000 +0100
+++ motion-3.2.12/debian/patches/02_libav_multiarch.patch       2013-01-13 
10:35:53.000000000 +0100
@@ -4,15 +4,17 @@
 
 --- a/configure.in
 +++ b/configure.in
-@@ -318,7 +318,12 @@
+@@ -318,7 +318,14 @@
        # AUTODETECT STATIC/SHARED LIB 
        AC_MSG_CHECKING(for ffmpeg autodetecting libraries)
  
 -      if test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && 
test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then
-+      if test -f /usr/lib/$(dpkg-architecture 
-qDEB_BUILD_MULTIARCH)/libavcodec.so ; then
-+              AC_MSG_RESULT(found in /usr/lib/$(dpkg-architecture 
-qDEB_BUILD_MULTIARCH))
++      PKG_CONFIG_FFMPEG_LIBDIR="$(pkg-config --variable=libdir libavcodec 
2>/dev/null)"
++
++      if test -n "$PKG_CONFIG_FFMPEG_LIBDIR" ; then
++              AC_MSG_RESULT(found in $PKG_CONFIG_FFMPEG_LIBDIR)
 +              FFMPEG_OK="found"
-+              FFMPEG_LIB="/usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)"
++              FFMPEG_LIB="$PKG_CONFIG_FFMPEG_LIBDIR"
 +              FFMPEG_DIR="/usr"
 +      elif test -f /usr/lib64/libavcodec.a -o -f /usr/lib64/libavcodec.so && 
test -f /usr/lib64/libavformat.a -o -f /usr/lib64/libavformat.so ; then
                AC_MSG_RESULT(found in /usr/lib64)
diff -Nru motion-3.2.12/debian/patches/03_mysql_multiarch.patch 
motion-3.2.12/debian/patches/03_mysql_multiarch.patch
--- motion-3.2.12/debian/patches/03_mysql_multiarch.patch       1970-01-01 
01:00:00.000000000 +0100
+++ motion-3.2.12/debian/patches/03_mysql_multiarch.patch       2013-01-13 
10:35:53.000000000 +0100
@@ -0,0 +1,100 @@
+Description: Description: Autodetect multiarch libmysqlclient path in autoconf.
+Origin: vendor
+Bug-Debian: http://bugs.debian.org/697221
+Forwarded: no
+Author: Salvatore Bonaccorso <car...@debian.org>
+Last-Update: 2013-01-12
+
+--- a/configure.in
++++ b/configure.in
+@@ -509,23 +509,28 @@
+       if test "${MYSQL_HEADERS}" = "yes"; then
+               AC_MSG_CHECKING(autodect mysql headers)
+               # Autodetect
+-              for w in /usr/include /usr/local/include /usr/mysql 
/usr/local/mysql /usr/local/mysql/include /opt /opt/mysql; do
+-                      # check for plain setups
+-                      if test -f $w/mysql.h; then
+-                              MYSQL_INCDIR=$w
+-                              break
+-                      fi
+-                      # check for "/usr/include/<packagename>" type setups
+-                      if test -f $w/mysql/mysql.h; then
+-                              MYSQL_INCDIR=$w/mysql
+-                              break
+-                      fi
+-                      # check for "/usr/<packagename>/include" type setups
+-                      if test -f $w/mysql/include/mysql.h; then
+-                              MYSQL_INCDIR=$w/mysql/include
+-                              break
+-                      fi
+-              done
++              MYSQL_CONFIG="$(which mysql_config 2>/dev/null)"
++              if test -n "$MYSQL_CONFIG"; then
++                      MYSQL_INCDIR="$(mysql_config --variable=pkgincludedir)"
++              else
++                      for w in /usr/include /usr/local/include /usr/mysql 
/usr/local/mysql /usr/local/mysql/include /opt /opt/mysql; do
++                              # check for plain setups
++                              if test -f $w/mysql.h; then
++                                      MYSQL_INCDIR=$w
++                                      break
++                              fi
++                              # check for "/usr/include/<packagename>" type 
setups
++                              if test -f $w/mysql/mysql.h; then
++                                      MYSQL_INCDIR=$w/mysql
++                                      break
++                              fi
++                              # check for "/usr/<packagename>/include" type 
setups
++                              if test -f $w/mysql/include/mysql.h; then
++                                      MYSQL_INCDIR=$w/mysql/include
++                                      break
++                              fi
++                      done
++              fi
+       elif test "${MYSQL_HEADERS}" = "no"; then
+               AC_MSG_CHECKING(for mysql headers)      
+               AC_MSG_RESULT(skipped)
+@@ -553,23 +558,27 @@
+       if test "${MYSQL_LIBS}" = "yes"; then
+               AC_MSG_CHECKING(autodect mysql libs)
+               # Autodetect
+-              for w in /usr/lib64 /usr/lib /usr/local/lib /usr/mysql 
/usr/local/mysql /usr/local/mysql/lib /opt /opt/mysql; do
+-                      # check for plain setups
+-                      if test -f $w/libmysqlclient.a -o -f 
$w/libmysqlclient.so; then
+-                              MYSQL_LIBDIR=$w
+-                              break
+-                      fi
+-                      # check for "/usr/lib/<packagename>" type setups
+-                      if test -f $w/mysql/libmysqlclient.a -o -f 
$w/mysql/libmysqlclient.so; then
+-                              MYSQL_LIBDIR=$w/mysql
+-                              break
+-                      fi
+-                      # check for "/usr/<packagename>/lib" type setups
+-                      if test -f $w/mysql/lib/libmysqlclient.a -o -f 
$w/mysql/lib/libmysqlclient.so; then
+-                              MYSQL_LIBDIR=$w/mysql/lib
+-                              break
+-                      fi
+-              done
++              if test -n "$MYSQL_CONFIG"; then
++                      MYSQL_LIBDIR="$(mysql_config --variable=pkglibdir)"
++              else
++                      for w in /usr/lib64 /usr/lib /usr/local/lib /usr/mysql 
/usr/local/mysql /usr/local/mysql/lib /opt /opt/mysql; do
++                              # check for plain setups
++                              if test -f $w/libmysqlclient.a -o -f 
$w/libmysqlclient.so; then
++                                      MYSQL_LIBDIR=$w
++                                      break
++                              fi
++                              # check for "/usr/lib/<packagename>" type setups
++                              if test -f $w/mysql/libmysqlclient.a -o -f 
$w/mysql/libmysqlclient.so; then
++                                      MYSQL_LIBDIR=$w/mysql
++                                      break
++                              fi
++                              # check for "/usr/<packagename>/lib" type setups
++                              if test -f $w/mysql/lib/libmysqlclient.a -o -f 
$w/mysql/lib/libmysqlclient.so; then
++                                      MYSQL_LIBDIR=$w/mysql/lib
++                                      break
++                              fi
++                      done
++              fi
+       elif test "${MYSQL_LIBS}" = "no"; then
+               AC_MSG_CHECKING(for mysql libs)
+               AC_MSG_RESULT(skipped)
diff -Nru motion-3.2.12/debian/patches/series 
motion-3.2.12/debian/patches/series
--- motion-3.2.12/debian/patches/series 2012-02-12 22:16:11.000000000 +0100
+++ motion-3.2.12/debian/patches/series 2013-01-13 10:35:53.000000000 +0100
@@ -4,3 +4,4 @@
 020111027~5dd9ed4.patch
 01_videodev.h.diff
 02_libav_multiarch.patch
+03_mysql_multiarch.patch
diff -Nru motion-3.2.12/debian/rules motion-3.2.12/debian/rules
--- motion-3.2.12/debian/rules  2013-01-05 19:25:27.000000000 +0100
+++ motion-3.2.12/debian/rules  2013-01-13 10:35:53.000000000 +0100
@@ -3,7 +3,7 @@
 
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
 
 CFLAGS = -Wall -g
 LDFLAGS = -Wl,--as-needed
@@ -32,7 +32,6 @@
                --sysconfdir=/etc/motion \
                --with-ffmpeg \
                --with-mysql \
-               --with-mysql-lib=/usr/lib/$(DEB_HOST_MULTIARCH) \
                --with-pgsql \
                --without-optimizecpu \
                --without-jpeg-mmx

Reply via email to