Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save qyot27/5794299 to your computer and use it in GitHub Desktop.
Save qyot27/5794299 to your computer and use it in GitHub Desktop.
Flesh out VS plugin install stuffs
From def918c44204f93bf754278a83dbc7ee797d1cf1 Mon Sep 17 00:00:00 2001
From: Stephen Hutchinson <qyot27@gmail.com>
Date: Sun, 16 Jun 2013 09:24:55 -0400
Subject: [PATCH 2/3] Add installation routines to VapourSynth plugin makefile
---
VapourSynth/GNUmakefile | 18 ++++++++++++++++--
VapourSynth/configure | 28 +++++++++++++++++++++-------
2 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/VapourSynth/GNUmakefile b/VapourSynth/GNUmakefile
index ba98553..a7b4b4c 100644
--- a/VapourSynth/GNUmakefile
+++ b/VapourSynth/GNUmakefile
@@ -20,10 +20,24 @@ endif
all: $(SONAME)
$(SONAME): $(OBJ_SOURCE)
- $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
+ $(LD) $(SOFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+ -@ $(if $(STRIP), $(STRIP) -x $@)
%.o: %.c .depend
- $(CC) $(CFLAGS) -c $< -o $@
+ $(CC) -c $(CFLAGS) -o $@ $<
+
+install: all
+ install -d $(DESTDIR)$(libdir)
+ifneq ($(IMPLIB),)
+ install -m 644 $(IMPLIB) $(DESTDIR)$(libdir)
+else
+ install -m 755 $(SONAME) $(DESTDIR)$(libdir)/$(SONAME)
+ $(if $(SONAME), ln -f -s $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/$(SONAME_LN))
+endif
+
+#All objects should be deleted regardless of configure when uninstall/clean/distclean.
+uninstall:
+ $(RM) $(addprefix $(DESTDIR)$(libdir)/, $(SONAME) $(SONAME_LN))
clean:
$(RM) $(SONAME) *.o .depend
diff --git a/VapourSynth/configure b/VapourSynth/configure
index a840d55..2f8590c 100755
--- a/VapourSynth/configure
+++ b/VapourSynth/configure
@@ -11,9 +11,11 @@ Usage: [PKG_CONFIG_PATH=/foo/bar/lib/pkgconfig] ./configure [options]
options:
-h, --help print help (this)
- --prefix=PREFIX set dir for headers and libs [NONE]
- --libdir=DIR set dir for libs [NONE]
- --includedir=DIR set dir for headers [NONE]
+ --prefix=PREFIX install architecture-independent files into PREFIX
+ [/usr/local]
+ --exec-prefix=EPREFIX install architecture-dependent files into EPREFIX
+ [PREFIX]
+ --libdir=DIR install libs in DIR [EPREFIX/lib]
--extra-cflags=XCFLAGS add XCFLAGS to CFLAGS
--extra-ldflags=XLDFLAGS add XLDFLAGS to LDFLAGS
@@ -82,8 +84,9 @@ LD="gcc"
STRIP="strip"
prefix=""
-includedir=""
+exec_prefix=""
libdir=""
+DESTDIR=""
CFLAGS="-Wall -std=gnu99 -I. -I$SRCDIR"
LDFLAGS="-L."
@@ -104,11 +107,14 @@ for opt; do
--prefix=*)
prefix="$optarg"
;;
+ --exec-prefix=*)
+ exec_prefix="$optarg"
+ ;;
--libdir=*)
libdir="$optarg"
;;
- --includedir=*)
- includedir="$optarg"
+ --destdir=*)
+ DESTDIR="$optarg"
;;
--extra-cflags=*)
XCFLAGS="$optarg"
@@ -135,6 +141,10 @@ for opt; do
esac
done
+test -n "$prefix" || prefix="/usr/local"
+test -n "$exec_prefix" || exec_prefix='${prefix}'
+test -n "$libdir" || libdir='${exec_prefix}/lib'
+
BASENAME="vslsmashsource"
if test -n "$TARGET_OS"; then
@@ -169,7 +179,6 @@ if test -n "$prefix"; then
CFLAGS="$CFLAGS -I$prefix/include"
LDFLAGS="$LDFLAGS -L$prefix/lib"
fi
-test -n "$includedir" && CFLAGS="$CFLAGS -I$includedir"
test -n "$libdir" && LDFLAGS="$LDFLAGS -L$libdir"
CFLAGS="$CFLAGS $XCFLAGS"
@@ -255,6 +264,10 @@ CFLAGS = $CFLAGS
LDFLAGS = $LDFLAGS
LIBS = $LIBS
SRCDIR = $SRCDIR
+DESTDIR = $DESTDIR
+prefix = $prefix
+exec_prefix = $exec_prefix
+libdir = $libdir
SRC_SOURCE = $SRC_SOURCE
BASENAME=$BASENAME
SONAME=$SONAME
@@ -281,6 +294,7 @@ LDFLAGS = $LDFLAGS
LIBS = $LIBS
SONAME = $SONAME
SOFLAGS = $SOFLAGS
+PREFIX = $prefix
EOF
test "$SRCDIR" = "." || cp -f $SRCDIR/GNUmakefile .
--
1.8.1.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment