[vlc-commits] contrib: enhance binary package

Rafaël Carré git at videolan.org
Wed Nov 23 02:17:44 CET 2011


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Nov 22 19:32:33 2011 -0500| [f047f0965483aa8c98dce390c0bab45efe0cbb5f] | committer: Rafaël Carré

contrib: enhance binary package

- remove stuff we don't need
- replace prefix by template (.pc/.la/-config)
- include script to replace prefix template by $PWD
- use widely available bzip2 format so xz is not needed

Use:
$ make package-win32
$ make package-win64
$ make package-osx
$ make package-whatever

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f047f0965483aa8c98dce390c0bab45efe0cbb5f
---

 contrib/src/change_prefix.sh |   76 ++++++++++++++++++++++++++++++++++++++++++
 contrib/src/main.mak         |   14 ++++++--
 2 files changed, 87 insertions(+), 3 deletions(-)

diff --git a/contrib/src/change_prefix.sh b/contrib/src/change_prefix.sh
new file mode 100755
index 0000000..f1f693f
--- /dev/null
+++ b/contrib/src/change_prefix.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+# ***************************************************************************
+# change_prefix.sh : allow to transfer a contrib dir
+# ***************************************************************************
+# Copyright (C) 2003 the VideoLAN team
+# $Id$
+#
+# Authors: Christophe Massiot <massiot at via.ecp.fr>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+# ***************************************************************************
+
+LANG=C
+export LANG
+
+if test "$1" = "-h" -o "$1" = "--help" -o $# -gt 2; then
+  echo "Usage: $0 [new_prefix] [old prefix]"
+  exit 1
+fi
+
+if test -z "$1" -a -z "$2"
+then
+    new_prefix=`pwd`
+    prefix=@@CONTRIB_PREFIX@@
+else
+    prefix=$1
+    new_prefix=$2
+fi
+
+process() {
+    grep -q "$prefix" "$1" || return
+    echo "Fixing up $file"
+    cp $file $file.tmp
+    sed -e "s,$prefix,$new_prefix,g" < $file > $file.tmp
+    mv -f $file.tmp $file
+}
+
+for file in `find . -type f`; do
+ if ! test -e $file; then
+   echo "$file doesn't exist"
+   continue
+ fi
+ if test ".`file $file | grep Mach-O`" != "." ; then
+    echo "Changing prefixes of '$file'"
+    islib=n
+    if test ".`file $file | grep 'dynamically linked shared library'`" != "." ; then
+      islib=y
+    fi
+    libs=`otool -L $file 2>/dev/null | grep $prefix | cut -d\  -f 1`
+    first=y
+    for i in "" $libs; do
+      if ! test -z $i; then
+        if test $islib = y -a $first = y; then
+            install_name_tool -id `echo $i | sed -e "s,$prefix,$new_prefix,"` $file
+            first=n
+        else
+            install_name_tool -change $i `echo $i | sed -e "s,$prefix,$new_prefix,"` $file
+        fi
+      fi
+    done
+  elif test -n "`file $file | grep \"text\|shell\"`" -o -n "`echo $file | grep -E \"(pc|la)\"$`"; then
+    process "$file"
+  fi
+done
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index a2f3898..bfd0d67 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -270,9 +270,17 @@ distclean: clean
 	$(RM) config.mak
 	unlink Makefile
 
-package: install
-	(cd $(PREFIX)/.. && \
-	tar cvJ $(notdir $(PREFIX))/) > ../vlc-contrib-$(HOST)-$(DATE).tar.xz
+package-%: install
+	rm -Rf tmp/
+	mkdir -p tmp/
+	cp -r $(PREFIX) tmp/
+	# remove useless files
+	cd tmp/$(notdir $(PREFIX)); \
+		cd share; rm -Rf man doc gtk-doc info lua projectM gettext; cd ..; \
+		rm -Rf man sbin etc lib/lua lib/sidplay
+	cp $(SRC)/change_prefix.sh tmp/$(notdir $(PREFIX))/
+	cd tmp/$(notdir $(PREFIX)) && ./change_prefix.sh $(PREFIX) @@CONTRIB_PREFIX@@
+	(cd tmp && tar c $(notdir $(PREFIX))/) | bzip2 -c > ../vlc-contrib-$*-$(HOST)-$(DATE).tar.bz2
 
 list:
 	@echo All packages:



More information about the vlc-commits mailing list