Allow to configure per library subdirectories for helpers.
authorGregor Jasny <gjasny@googlemail.com>
Mon, 31 Oct 2011 13:23:41 +0000 (14:23 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 31 Oct 2011 13:23:41 +0000 (14:23 +0100)
In Debian (and Ubuntu) libv4lconvert is moved into it's own
library package due to the SONAME bump. The policy requires
that subdirectories beneath /usr/lib needs to be named after
the package name to allow older and newer package versions
installed side by side.

This patch adds the possibility to specify the subdirectories
separately for libv4lconvert, libv4l1 and libv4l2.

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Make.rules.in [moved from Make.rules with 88% similarity]
configure.in
lib/libv4l1/Makefile
lib/libv4l2/Makefile
lib/libv4lconvert/Makefile
lib/libv4lconvert/libv4lconvert.c
makefile

similarity index 88%
rename from Make.rules
rename to Make.rules.in
index 6fa132e..6622501 100644 (file)
@@ -8,7 +8,9 @@ CFLAGS += -Wstrict-prototypes -Wmissing-prototypes
 PREFIX = /usr/local
 LIBDIR = $(PREFIX)/lib
 # subdir below LIBDIR in which to install the libv4lx libc wrappers
-LIBSUBDIR = libv4l
+LIBV4L1SUBDIR = $(LIBDIR)/@libv4l1subdir@
+LIBV4L2SUBDIR = $(LIBDIR)/@libv4l2subdir@
+LIBV4LCONVERTSUBDIR = $(LIBDIR)/@libv4lconvertsubdir@
 MANDIR = $(PREFIX)/share/man
 
 # These ones should not be overriden from the cmdline
index 0f9a058..7292bee 100644 (file)
@@ -11,6 +11,18 @@ AC_PROG_MAKE_SET
 AC_HEADER_STDC
 
 dnl ---------------------------------------------------------------------
+dnl Directories
+
+AC_ARG_WITH(libv4l1subdir, AC_HELP_STRING([--with-libv4l1subdir=DIR], [set libv4l1 library subdir [default=libv4l]]),
+   libv4l1subdir=$withval, libv4l1subdir="libv4l")
+
+AC_ARG_WITH(libv4l2subdir, AC_HELP_STRING([--with-libv4l2subdir=DIR], [set libv4l2 library subdir [default=libv4l]]),
+   libv4l2subdir=$withval, libv4l2subdir="libv4l")
+
+AC_ARG_WITH(libv4lconvertsubdir, AC_HELP_STRING([--with-libv4lconvertsubdir=DIR], [set libv4lconvert library subdir [default=libv4l]]),
+   libv4lconvertsubdir=$withval, libv4lconvertsubdir="libv4l")
+
+dnl ---------------------------------------------------------------------
 dnl Options
 
 AC_ARG_ENABLE(libv4l,
@@ -36,7 +48,11 @@ dnl Substitute vars
 AC_SUBST(V4L_UTILS_VERSION)
 AC_SUBST(WITH_LIBV4L)
 AC_SUBST(WITH_V4LUTILS)
+AC_SUBST(libv4l1subdir)
+AC_SUBST(libv4l2subdir)
+AC_SUBST(libv4lconvertsubdir)
 
 dnl ---------------------------------------------------------------------
 dnl read Makefile.in and write Makefile
 AC_OUTPUT(Makefile)
+AC_OUTPUT(Make.rules)
index 0afd117..5ea3531 100644 (file)
@@ -48,12 +48,12 @@ ifeq ($(LINKTYPE),static)
        mkdir -p $(DESTDIR)$(LIBDIR)
        install -m 644 $(V4L1_LIB) $(DESTDIR)$(LIBDIR)
 else
-       mkdir -p $(DESTDIR)$(LIBDIR)/$(LIBSUBDIR)
+       mkdir -p $(DESTDIR)$(LIBV4L1SUBDIR)
        install -m 755 $(V4L1_LIB).$(LIB_RELEASE) $(DESTDIR)$(LIBDIR)
        cd $(DESTDIR)$(LIBDIR) && \
          ln -f -s $(V4L1_LIB).$(LIB_RELEASE) $(V4L1_LIB)
        install -m 755 $(V4L1COMPAT).$(LIB_RELEASE) \
-         $(DESTDIR)$(LIBDIR)/$(LIBSUBDIR)/$(V4L1COMPAT)
+         $(DESTDIR)$(LIBV4L1SUBDIR)/$(V4L1COMPAT)
 endif
        mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
        install -m 644 libv4l1.pc $(DESTDIR)$(LIBDIR)/pkgconfig
index 479990b..aadd7bc 100644 (file)
@@ -50,12 +50,12 @@ ifeq ($(LINKTYPE),static)
        mkdir -p $(DESTDIR)$(LIBDIR)
        install -m 644 $(V4L2_LIB) $(DESTDIR)$(LIBDIR)
 else
-       mkdir -p $(DESTDIR)$(LIBDIR)/$(LIBSUBDIR)
+       mkdir -p $(DESTDIR)$(LIBV4L2SUBDIR)
        install -m 755 $(V4L2_LIB).$(LIB_RELEASE) $(DESTDIR)$(LIBDIR)
        cd $(DESTDIR)$(LIBDIR) && \
          ln -f -s $(V4L2_LIB).$(LIB_RELEASE) $(V4L2_LIB)
        install -m 755 $(V4L2CONVERT).$(LIB_RELEASE) \
-         $(DESTDIR)$(LIBDIR)/$(LIBSUBDIR)/$(V4L2CONVERT)
+         $(DESTDIR)$(LIBV4L2SUBDIR)/$(V4L2CONVERT)
 endif
        mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
        install -m 644 libv4l2.pc $(DESTDIR)$(LIBDIR)/pkgconfig
index 535d5a3..c9ca05d 100644 (file)
@@ -19,7 +19,7 @@ CONVERT_OBJS  = libv4lconvert.o tinyjpeg.o sn9c10x.o sn9c20x.o pac207.o \
 TARGETS       = $(CONVERT_LIB) libv4lconvert.pc ov511-decomp ov518-decomp
 INCLUDES      = ../include/libv4lconvert.h
 
-override CPPFLAGS += -DLIBDIR=\"$(LIBDIR)\" -DLIBSUBDIR=\"$(LIBSUBDIR)\"
+override CPPFLAGS += -DLIBV4LCONVERTSUBDIR=\"$(LIBV4LCONVERTSUBDIR)\"
 
 # This is the soname version
 LIB_RELEASE = 1
@@ -44,7 +44,7 @@ libv4lconvert.pc:
 install: all
        mkdir -p $(DESTDIR)$(PREFIX)/include
        install -p -m 644 $(INCLUDES) $(DESTDIR)$(PREFIX)/include
-       mkdir -p $(DESTDIR)$(LIBDIR)/$(LIBSUBDIR)
+       mkdir -p $(DESTDIR)$(LIBV4LCONVERTSUBDIR)
 ifeq ($(LINKTYPE),static)
        install -m 644 $(CONVERT_LIB) $(DESTDIR)$(LIBDIR)
 else
@@ -52,7 +52,7 @@ else
        cd $(DESTDIR)$(LIBDIR) && \
          ln -f -s $(CONVERT_LIB).$(LIB_RELEASE) $(CONVERT_LIB)
 endif
-       install -m 755 *-decomp $(DESTDIR)$(LIBDIR)/$(LIBSUBDIR)
+       install -m 755 *-decomp $(DESTDIR)$(LIBV4LCONVERTSUBDIR)
        mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
        install -m 644 libv4lconvert.pc $(DESTDIR)$(LIBDIR)/pkgconfig
 
index aa36bea..399d73b 100644 (file)
@@ -734,7 +734,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
                        }
                        break;
                case V4L2_PIX_FMT_OV511:
-                       if (v4lconvert_helper_decompress(data, LIBDIR "/" LIBSUBDIR "/ov511-decomp",
+                       if (v4lconvert_helper_decompress(data, LIBV4LCONVERTSUBDIR "/ov511-decomp",
                                                src, src_size, d, d_size, width, height, yvu)) {
                                /* Corrupt frame, better get another one */
                                errno = EAGAIN;
@@ -742,7 +742,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
                        }
                        break;
                case V4L2_PIX_FMT_OV518:
-                       if (v4lconvert_helper_decompress(data, LIBDIR "/" LIBSUBDIR "/ov518-decomp",
+                       if (v4lconvert_helper_decompress(data, LIBV4LCONVERTSUBDIR "/ov518-decomp",
                                                src, src_size, d, d_size, width, height, yvu)) {
                                /* Corrupt frame, better get another one */
                                errno = EAGAIN;
index 20c0822..d43baee 100644 (file)
--- a/makefile
+++ b/makefile
@@ -12,7 +12,7 @@ configure:
        @echo "*** You should now run ./configure or make ***"
 distclean:
        -$(MAKE) -f Makefile clean
-       -rm Makefile configure config.h v4l-utils.spec
+       -rm Makefile Make.rules configure config.h v4l-utils.spec
 
 -include Makefile