[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#996498: ocp FTCBFS: multiple reasons



Source: ocp
Version: 1:0.2.90-3.1
Tags: patch upstream
User: debian-cross@lists.debian.org
Usertags: ftcbfs

ocp fails to cross build from source, because configure.ac hard codes
the build architecture pkg-config in a lot of occasions. A good solution
is using the PKG_CHECK_MODULES macro. I'm attaching a patch for doing
the conversion. You need to regenerate configure after applying it.

Also note that since you dropped gcc-11 from Build-Depends, you should
also stop exporting CC=gcc-11.

Helmut
--- ocp-0.2.90.orig/configure.ac
+++ ocp-0.2.90/configure.ac
@@ -343,13 +343,11 @@
 AC_SUBST(LIBJPEG_LIBS)
 AC_SUBST(LIBPNG_CFLAGS)
 AC_SUBST(LIBPNG_LIBS)
-if test "x$with_mad" != "xno"; then
+AS_IF([test "x$with_mad" != "xno"],[
 	AC_MSG_CHECKING([mad support])
-	MAD_LIBS=`pkg-config --libs mad 2> /dev/null`
-	MAD_CFLAGS=`pkg-config --cflags mad 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([MAD],[mad],[
 		AC_MSG_RESULT("$MAD_CFLAGS $MAD_LIBS")
-	else
+	],[
 		AC_MSG_RESULT([pkg-config failed]);
 	dnl Fall back to non-pkg-config method
 		AC_CHECK_LIB(mad, mad_stream_init, , if test "x$with_mad" = "xyes"; then AC_MSG_ERROR("libmad not found"); else with_mad="no"; fi)
@@ -361,26 +359,22 @@
 			MAD_CFLAGS=""
 			LIBS=$push_LIBS
 		fi
-	fi
-fi
+	])
+])
 
 AC_MSG_CHECKING([libjpeg / libjpeg-turbo support])
-LIBJPEG_LIBS=`pkg-config --libs libjpeg 2> /dev/null`
-LIBJPEG_CFLAGS=`pkg-config --cflags libjpeg 2> /dev/null`
-if test "$?" = 0; then
+PKG_CHECK_MODULES([LIBJPEG],[libjpeg],[
 	AC_MSG_RESULT("$LIBJPEG_CFLAGS $LIBJPEG_LIBS")
-else
+],[
 	AC_MSG_ERROR([pkg-config failed]);
-fi
+])
 
 AC_MSG_CHECKING([libpng support])
-LIBPNG_LIBS=`pkg-config --libs libpng 2> /dev/null`
-LIBPNG_CFLAGS=`pkg-config --cflags libpng 2> /dev/null`
-if test "$?" = 0; then
+PKG_CHECK_MODULES([LIBPNG],[libpng],[
 	AC_MSG_RESULT("$LIBPNG_CFLAGS $LIBPNG_LIBS")
-else
+],[
 	AC_MSG_ERROR([pkg-config failed]);
-fi
+])
 
 AC_SUBST(HAVE_MAD)
 if test "x$with_mad" = "xno"; then
@@ -393,27 +387,23 @@
 AC_SUBST(OGG_CFLAGS)
 AC_SUBST(OGG_LIBS)
 AC_MSG_CHECKING([ogg support])
-OGG_LIBS=`pkg-config --libs ogg 2> /dev/null`
-OGG_CFLAGS=`pkg-config --cflags ogg 2> /dev/null`
-if test "$?" = 0; then
+PKG_CHECK_MODULES([OGG],[ogg],[
 	AC_MSG_RESULT("$OGG_CFLAGS $OGG_LIBS")
-else
+],[
 	AC_MSG_RESULT([pkg-config failed]);
 dnl Fall back to non-pkg-config method
 	AC_CHECK_LIB(ogg, ogg_sync_init, , AC_MSG_ERROR("ogg libraries not found"))
 	OGG_LIBS="-logg"
 	OGG_CFLAGS=""
 	LIBS=$push_LIBS
-fi
+])
 
 AC_SUBST(VORBIS_CFLAGS)
 AC_SUBST(VORBIS_LIBS)
 AC_MSG_CHECKING([vorbis support])
-VORBIS_LIBS=`pkg-config --libs vorbis 2> /dev/null`
-VORBIS_CFLAGS=`pkg-config --cflags vorbis 2> /dev/null`
-if test "$?" = 0; then
+PKG_CHECK_MODULES([VORBIS],[vorbis],[
 	AC_MSG_RESULT("$VORBIS_CFLAGS $VORBIS_LIBS")
-else
+],[
 	AC_MSG_RESULT([pkg-config failed]);
 dnl Fall back to non-pkg-config method
 	AC_CHECK_LIB(vorbis, vorbis_bitrate_init, , AC_MSG_ERROR("vorbis libraries not found"), -logg)
@@ -421,16 +411,14 @@
 	VORBIS_LIBS="-lvorbis"
 	VORBIS_CFLAGS=""
 	LIBS=$push_LIBS
-fi
+])
 
 AC_SUBST(VORBISFILE_CFLAGS)
 AC_SUBST(VORBISFILE_LIBS)
 AC_MSG_CHECKING([vorbisfile support])
-VORBISFILE_LIBS=`pkg-config --libs vorbisfile 2> /dev/null`
-VORBISFILE_CFLAGS=`pkg-config --cflags vorbisfile 2> /dev/null`
-if test "$?" = 0; then
+PKG_CHECK_MODULES([VORBISFILE],[vorbisfile],[
 	AC_MSG_RESULT("$VORBISFILE_CFLAGS $VORBISFILE_LIBS")
-else
+],[
 	AC_MSG_RESULT([pkg-config failed]);
 dnl Fall back to non-pkg-config method
 
@@ -441,7 +429,7 @@
 	VORBISFILE_LIBS="-lvorbisfile"
 	VORBISFILE_CFLAGS=""
 	LIBS=$push_LIBS
-fi
+](
 
 AC_SUBST(FLAC_CFLAGS)
 AC_SUBST(FLAC_LIBS)
@@ -537,13 +525,11 @@
 org_cppflags="$CPPFLAGS"
 AC_SUBST(SDL_CFLAGS)
 AC_SUBST(SDL_LIBS)
-if test "x$with_sdl" != "xno"; then
+AS_IF([test "x$with_sdl" != "xno"],[
 	AC_MSG_CHECKING([SDL support])
-	SDL_LIBS=`pkg-config --libs sdl 2> /dev/null`
-	SDL_CFLAGS=`pkg-config --cflags sdl 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([SDL],[sdl],[
 		AC_MSG_RESULT("$SDL_CFLAGS $SDL_LIBS")
-	else
+	],[
 		AC_MSG_RESULT([pkg-config failed])
 
 		AC_CHECK_LIB(SDL, SDL_Init, SDL_LIBS="-lSDL", if test "x$with_sdl" = "xyes"; then AC_MSG_ERROR("libSDL was not found"); else with_sdl="no"; fi)
@@ -553,8 +539,8 @@
 			CPPFLAGS="$CPPFLAGS -I/usr/include/SDL"
 			AC_CHECK_HEADER(SDL.h, SDL_CFLAGS="-I/usr/include/SDL", if test "x$with_sdl" = "xyes"; then AC_MSG_ERROR("SDL header files not found"); else with_sdl="no"; fi)
 		fi
-	fi
-fi
+	])
+])
 AC_SUBST(HAVE_SDL)
 if test "x$with_sdl" = "xno"; then
 	HAVE_SDL=
@@ -567,18 +553,16 @@
 
 AC_SUBST(FREETYPE2_LIBS)
 AC_SUBST(FREETYPE2_CFLAGS)
-if test "x$HAVE_SDL" = "x1" || test "x$HAVE_SDL2" = "x1" || test "x$HAVE_X11" = "x1"; then
+AS_IF([test "x$HAVE_SDL" = "x1" || test "x$HAVE_SDL2" = "x1" || test "x$HAVE_X11" = "x1"],[
 	AC_MSG_CHECKING([freetype2 support])
-	FREETYPE2_LIBS=`pkg-config --libs freetype2 2> /dev/null`
-	FREETYPE2_CFLAGS=`pkg-config --cflags freetype2 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([FREETYPE2],[freetype2],[
 		AC_MSG_RESULT("$FREETYPE2_CFLAGS $FREETYPE2_LIBS")
-	else
+	],[
 		AC_MSG_RESULT([pkg-config failed]);
 	dnl Fall back to non-pkg-config method
 		AC_CHECK_LIB(freetype, FT_Init_FreeType, ,AC_MSG_ERROR("libfreetype not found"))
 		AC_CHECK_HEADER(ft2built.h, , AC_MSG_ERROR("libfreetype header files was not found"))
-	fi
+	])
 
 dnl locate the ttf-unifont
 	AS_AC_EXPAND(UNIFONTDIR, $with_unifontdir)
@@ -586,20 +570,18 @@
 	AC_CHECK_FILE($UNIFONTDIR/unifont_csur.ttf, , AC_MSG_ERROR([$UNIFONTDIR/unifont_csur.ttf not found - please use --with-unifontdir=/path/ (needed by X11, SDL1.x and SDL2)]))
 	AC_CHECK_FILE($UNIFONTDIR/unifont_upper.ttf, , AC_MSG_ERROR([$UNIFONTDIR/unifont_upper.ttf not found - please use --with-unifontdir=/path/ (needed by X11, SDL1.x and SDL2)]))
 	AC_DEFINE_UNQUOTED(UNIFONTDIR, "$UNIFONTDIR")
-fi
+])
 
 AC_LANG_PUSH(C++)
 org_cxxflags="$CXXFLAGS"
 org_cppflags="$CPPFLAGS"
 AC_SUBST(ADPLUG_CXXFLAGS)
 AC_SUBST(ADPLUG_LIBS)
-if test "x$with_adplug" != "xno"; then
+AS_IF([test "x$with_adplug" != "xno"],[
 	AC_MSG_CHECKING([Adplug support])
-	ADPLUG_LIBS=`pkg-config --libs adplug 2> /dev/null`
-	ADPLUG_CXXFLAGS=`pkg-config --cflags adplug 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([ADPLUG],[adplug],[
 		AC_MSG_RESULT("$ADPLUG_CXXFLAGS $ADPLUG_LIBS")
-	else
+	],[
 		AC_MSG_RESULT([pkg-config failed]);
 dnl Fall back to non-pkg-config method
 		AC_CHECK_HEADER(adplug/adplug.h, ,with_adplug_failed=yes)
@@ -617,8 +599,8 @@
 			AC_CHECK_LIB(adplug, docell0, ADPLUG_LIBS="-ladplug", if test "x$with_adplug" = "xyes"; then AC_MSG_ERROR("Adplug was not found"); else with_adplug="no"; fi)
 			LIBS=$push_LIBS
 		fi
-	fi
-fi
+	])
+])
 CXXFLAGS="$org_cxxflags"
 CPPFLAGS="$org_cppflags"
 
@@ -823,21 +805,19 @@
 
 AC_SUBST(ALSA_CFLAGS)
 AC_SUBST(ALSA_LIBS)
-if test "x$with_alsa" != "xno"; then
+AS_IF([test "x$with_alsa" != "xno"],[
 	AC_MSG_CHECKING([Alsa support])
-	ALSA_LIBS=`pkg-config --libs alsa 2> /dev/null`
-	ALSA_CFLAGS=`pkg-config --cflags alsa 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([ALSA],[alsa],[
 		AC_MSG_RESULT("$ALSA_CFLAGS $ALSA_LIBS")
-	else
+	],[
 		if test "x$with_alsa" = "xyes"; then
 			AC_MSG_ERROR([pkg-config failed]);
 		else
 			AC_MSG_RESULT([pkg-config failed]);
 			with_alsa="no"
 		fi
-	fi
-fi
+	])
+])
 
 AC_SUBST(HAVE_ALSA)
 if test "x$with_alsa" = "xno"; then
@@ -877,22 +857,20 @@
 AC_SUBST(HAVE_OSS)
 AC_SUBST(OSS_LIBS)
 AC_SUBST(OSS_CFLAGS)
-if test "x$with_oss" != "xno"; then
+AS_IF([test "x$with_oss" != "xno"],[
 	AC_MSG_CHECKING([liboss])
-	OSS_LIBS=`pkg-config --libs liboss 2> /dev/null`
-	OSS_CFLAGS=`pkg-config --cflags liboss 2> /dev/null`
-	if test "$?" = 0; then
+	PKG_CHECK_MODULES([OSS],[oss],[
 		AC_MSG_RESULT("$OSS_CFLAGS $OSS_LIBS")
 		HAVE_OSS=1
-	else
+	],[
 		AC_MSG_RESULT([pkg-config failed]);
 dnl Fall back to non-pkg-config method
 		AC_CHECK_HEADER(sys/soundcard.h,
 			HAVE_OSS=1
 			AC_DEFINE(HAVE_SYS_SOUNDCARD_H),
 			if test "x$with_oss" = "xyes"; then AC_MSG_ERROR([kernel OSS header file was not found], 1); else with_oss="no"; HAVE_OSS=0;fi)
-	fi
-fi
+	])
+])
 
 AC_SUBST(HAVE_COREAUDIO)
 AC_SUBST(COREAUDIO_CFLAGS)

Reply to: