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

Bug#1014744: libcaca-dev: please make it multi-arch co-installable



Package: libcaca-dev
Version: 0.99.beta20-2
Severity: wishlist
Tags: patch
Control: block 932372 by -1

While looking at libsdl1.2 I noticed that its dependency libcaca-dev
cannot be co-installed for amd64 and i386, because it is not marked as
Multi-Arch: same. This is because /usr/bin/caca-config varies between
architectures.

It is fairly straightforward to solve this by patching caca-config to
avoid references to @libdir@, similar to what we already do in SDL2.
Please consider applying the attached patches.

Thanks,
    smcv
>From 08c048c188b758b68dc16e12afc1bbd3b6368214 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Mon, 11 Jul 2022 08:58:39 +0100
Subject: [PATCH 1/3] Make libcaca-dev multi-arch co-installable

This allows dependent libraries like libsdl1.2 to be built for more than
one architecture without removing packages. It requires a small
non-upstreamable patch to make caca-config co-installable, similar to
what is done in other packages with legacy -config scripts (such as SDL).
---
 debian/control                                |  1 +
 ...ca-config.in-Avoid-mentioning-libdir.patch | 45 +++++++++++++++++++
 debian/patches/series                         |  1 +
 3 files changed, 47 insertions(+)
 create mode 100644 debian/patches/caca-config.in-Avoid-mentioning-libdir.patch
 create mode 100644 debian/patches/series

diff --git a/debian/control b/debian/control
index 7d91002..fc552ad 100644
--- a/debian/control
+++ b/debian/control
@@ -22,6 +22,7 @@ Homepage: http://caca.zoy.org/wiki/libcaca
 Package: libcaca-dev
 Section: libdevel
 Architecture: any
+Multi-Arch: same
 Depends:
  libcaca0 (= ${binary:Version}),
  libslang2-dev,
diff --git a/debian/patches/caca-config.in-Avoid-mentioning-libdir.patch b/debian/patches/caca-config.in-Avoid-mentioning-libdir.patch
new file mode 100644
index 0000000..d8c057d
--- /dev/null
+++ b/debian/patches/caca-config.in-Avoid-mentioning-libdir.patch
@@ -0,0 +1,45 @@
+From: Simon McVittie <smcv@debian.org>
+Date: Mon, 11 Jul 2022 08:57:31 +0100
+Subject: caca-config.in: Avoid mentioning @libdir@
+
+The upstream version of this script needs -L@libdir@ because it is
+unknown whether libcaca was installed into a directory in the compiler's
+default search path, but for Debian it is safe to omit that linker
+option and rely on the default search path.
+
+Avoiding all mentions of @libdir@ means the generated caca-config
+script ends up identical for all architectures, allowing libcaca-dev
+to become multiarch co-installable.
+
+Forwarded: not-needed, Debian-specific
+---
+ caca-config.in | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/caca-config.in b/caca-config.in
+index a54e6e1..9dc9530 100644
+--- a/caca-config.in
++++ b/caca-config.in
+@@ -5,7 +5,6 @@
+ prefix=@prefix@
+ exec_prefix=@exec_prefix@
+ 
+-lib_dir=@libdir@
+ include_dir=@includedir@
+ 
+ usage()
+@@ -107,12 +106,12 @@ fi
+ 
+ if test "$echo_ldflags" = "yes"
+ then
+-  ldflags="-L$lib_dir"
++  ldflags=""
+   echo $ldflags
+ fi
+ 
+ if test "$echo_libs" = "yes"
+ then
+-  echo -L@libdir@ $libs
++  echo $libs
+ fi
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..55204c0
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+caca-config.in-Avoid-mentioning-libdir.patch
-- 
2.36.1

>From 6cb1da8cef24f4df91f8b05ca63ef10056db3ca3 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Mon, 11 Jul 2022 09:15:17 +0100
Subject: [PATCH 2/3] d/tests/build: Also exercise C++ linking

libcaca-dev provides two separate interfaces, C and C++, so it's good
to verify that they both work.
---
 debian/tests/build | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 debian/tests/build

diff --git a/debian/tests/build b/debian/tests/build
old mode 100644
new mode 100755
index d639d10..e3cdf08
--- a/debian/tests/build
+++ b/debian/tests/build
@@ -12,6 +12,8 @@ else
     CROSS_COMPILE=
 fi
 
+export TERM=linux
+
 WORKDIR=$(mktemp -d)
 trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
 cd $WORKDIR
@@ -37,7 +39,26 @@ EOF
 ${CROSS_COMPILE}gcc -o caca_test caca_test.c `${CROSS_COMPILE}pkg-config --cflags --libs caca` -Wall -Werror
 echo "build: OK"
 [ -x caca_test ]
-export TERM=linux
 ./caca_test
 echo "run: OK"
 
+cat <<EOF > caca_test.cpp
+#include <caca++.h>
+#include <iostream>
+
+int main(void)
+{
+	std::cout << "Testing libcaca version " << Caca::getVersion() << std::endl;
+
+	Canvas c;
+	c.Clear();
+
+	return 0;
+}
+EOF
+
+${CROSS_COMPILE}g++ -o caca_test_cpp caca_test.cpp `${CROSS_COMPILE}pkg-config --cflags --libs caca++` -Wall -Werror
+echo "build C++: OK"
+[ -x caca_test_cpp ]
+./caca_test_cpp
+echo "run C++: OK"
-- 
2.36.1

>From 85bb4229b620ecefbb75fe9ba661160ea3bdfb63 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Mon, 11 Jul 2022 09:19:42 +0100
Subject: [PATCH 3/3] d/tests/build: Also exercise legacy caca-config script

caca-config is deprecated in favour of pkg-config, but libsdl1.2 and
mplayer still use it.
---
 debian/tests/build | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/debian/tests/build b/debian/tests/build
index e3cdf08..f438cb5 100755
--- a/debian/tests/build
+++ b/debian/tests/build
@@ -42,6 +42,12 @@ echo "build: OK"
 ./caca_test
 echo "run: OK"
 
+${CROSS_COMPILE}gcc -o caca_test_legacy caca_test.c `caca-config --cflags --libs` -Wall -Werror
+echo "build (legacy caca-config script): OK"
+[ -x caca_test_legacy ]
+./caca_test_legacy
+echo "run: OK"
+
 cat <<EOF > caca_test.cpp
 #include <caca++.h>
 #include <iostream>
-- 
2.36.1


Reply to: