[x264-devel] [patch] improve install process

Tim Mooney Tim.Mooney at ndsu.edu
Sat Dec 31 00:49:42 CET 2011


[I'm not subscribed to the mailing list, so please Cc: me on any 
responses, assuming the moderator approves this post]

I recently built a libx264 snapshot on my x86_64-sun-solaris2.10 
workstation using the no-cost Oracle/Sun Workshop compiler.  I have
a couple patches that improved the configure & build process for me,
the first of which is below my signature.  The longer patch will be in
a separate email.

The patch accomplishes two things:

- it abstracts the "install" command the same way other commands like cc,
   ranlib, etc. are, so that Makefile targets use $(INSTALL) instead of
   "install".  configure sets INSTALL=install (so the default behavior on
   most platforms stays the same), except on SYS=SunOS, where it sets it
   to /usr/ucb/install.  The reason is that the default "install" command
   is the command that has System V semantics, which are nothing like
   the BSD install command.

   With this patch it's also now possible to override the command with
   something like

     make INSTALL=/path/to/my/install install

- it abstracts the directory where the pkg-config file goes so that it
   has its own make macro that can be overridden at install time.  I'm
   using the same macro, "pkgconfigdir", that's commonly used in any
   project that has Makefiles that are based on the GNU automake/autoconf
   machinery.

   This part of the patch essentially allows someone to override the
   directory where the .pc file goes at install time, without having to
   edit the Makefile.  The default behavior stays the same, the .pc file
   will end up in ${libdir}/pkgconfig if it's not overridden.

Please let me know if you have any questions or comments,

Thanks,

Tim
-- 
Tim Mooney                                             Tim.Mooney at ndsu.edu
Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
Room 242-J6, IACC Building                             701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164


diff -ur x264-snapshot-20111228-2245.orig/Makefile x264-snapshot-20111228-2245/Makefile
--- x264-snapshot-20111228-2245.orig/Makefile	2011-12-28 15:45:03.000000000 -0600
+++ x264-snapshot-20111228-2245/Makefile	2011-12-30 13:32:37.234206967 -0600
@@ -222,29 +222,29 @@
  	rm -f config.mak x264_config.h config.h config.log x264.pc x264.def

  install-cli: cli
-	install -d $(DESTDIR)$(bindir)
-	install x264$(EXE) $(DESTDIR)$(bindir)
+	$(INSTALL) -d $(DESTDIR)$(bindir)
+	$(INSTALL) x264$(EXE) $(DESTDIR)$(bindir)

  install-lib-dev:
-	install -d $(DESTDIR)$(includedir)
-	install -d $(DESTDIR)$(libdir)
-	install -d $(DESTDIR)$(libdir)/pkgconfig
-	install -m 644 x264.h $(DESTDIR)$(includedir)
-	install -m 644 x264_config.h $(DESTDIR)$(includedir)
-	install -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig
+	$(INSTALL) -d $(DESTDIR)$(includedir)
+	$(INSTALL) -d $(DESTDIR)$(libdir)
+	$(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
+	$(INSTALL) -m 644 x264.h $(DESTDIR)$(includedir)
+	$(INSTALL) -m 644 x264_config.h $(DESTDIR)$(includedir)
+	$(INSTALL) -m 644 x264.pc $(DESTDIR)$(pkgconfigdir)

  install-lib-static: lib-static install-lib-dev
-	install -m 644 $(LIBX264) $(DESTDIR)$(libdir)
+	$(INSTALL) -m 644 $(LIBX264) $(DESTDIR)$(libdir)
  	$(if $(RANLIB), $(RANLIB) $(DESTDIR)$(libdir)/$(LIBX264))

  install-lib-shared: lib-shared install-lib-dev
  ifneq ($(IMPLIBNAME),)
-	install -d $(DESTDIR)$(bindir)
-	install -m 755 $(SONAME) $(DESTDIR)$(bindir)
-	install -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir)
+	$(INSTALL) -d $(DESTDIR)$(bindir)
+	$(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(bindir)
+	$(INSTALL) -m 644 $(IMPLIBNAME) $(DESTDIR)$(libdir)
  else ifneq ($(SONAME),)
  	ln -f -s $(SONAME) $(DESTDIR)$(libdir)/libx264.$(SOSUFFIX)
-	install -m 755 $(SONAME) $(DESTDIR)$(libdir)
+	$(INSTALL) -m 755 $(SONAME) $(DESTDIR)$(libdir)
  endif

  uninstall:
--- x264-snapshot-20111228-2245.orig/configure	2011-12-28 15:45:03.000000000 -0600
+++ x264-snapshot-20111228-2245/configure	2011-12-30 16:57:02.071786398 -0600
@@ -378,6 +396,7 @@
  AR="${AR-${cross_prefix}ar}"
  RANLIB="${RANLIB-${cross_prefix}ranlib}"
  STRIP="${STRIP-${cross_prefix}strip}"
+INSTALL=install

  if [ "x$host" = x ]; then
      host=`./config.guess`
@@ -471,6 +501,7 @@
          DEVNULL="NUL"
          ;;
      sunos*|solaris*)
+         INSTALL=/usr/ucb/install
          SYS="SunOS"
          define HAVE_MALLOC_H
          LDFLAGS="$LDFLAGS -lm"
@@ -1002,6 +1044,7 @@
  bindir=$bindir
  libdir=$libdir
  includedir=$includedir
+pkgconfigdir=\${libdir}/pkgconfig
  ARCH=$ARCH
  SYS=$SYS
  CC=$CC
@@ -1013,6 +1056,7 @@
  LIBX264=$LIBX264
  AR=$AR
  RANLIB=$RANLIB
+INSTALL=$INSTALL
  STRIP=$STRIP
  AS=$AS
  ASFLAGS=$ASFLAGS


More information about the x264-devel mailing list