That should do the trick. Antoine, I should note that instead of creating a 
distinct "update-photofloat-js" as we discussed, I reverted to shipping the 
upstream Makefile and simply call that to minify+bundle js.

---
minify+bundle JavaScript libraries at installation and update using dpkg trigger

use uglifyjs instead of yui-compressor
---
 debian/control             | 12 +++++++-----
 debian/photofloat.links    |  2 ++
 debian/photofloat.postinst | 25 +++++++++++++++++++++++++
 debian/photofloat.prerm    | 19 +++++++++++++++++++
 debian/photofloat.triggers |  2 ++
 debian/rules               |  8 +-------
 web/Makefile               |  2 +-
 7 files changed, 57 insertions(+), 13 deletions(-)
 create mode 100644 debian/photofloat.postinst
 create mode 100644 debian/photofloat.prerm
 create mode 100644 debian/photofloat.triggers

diff --git a/debian/control b/debian/control
index 818effc..098cc4b 100644
--- a/debian/control
+++ b/debian/control
@@ -3,10 +3,7 @@ Section: web
 Priority: optional
 Maintainer: Antoine Beaupré <anar...@debian.org>
 Build-Depends: debhelper (>= 8.0.0),
-               python,
-               libjs-jquery,
-               libjs-jquery-mousewheel,
-               yui-compressor
+               python
 Standards-Version: 3.9.3
 Homepage: http://zx2c4.com/projects/photofloat/
 Vcs-Git: git://git.debian.org/collab-maint/photofloat.git -b debian
@@ -18,7 +15,12 @@ Depends: ${shlibs:Depends},
          ${misc:Depends},
          ${python:Depends},
          python-imaging,
-         lmodern
+         lmodern,
+         libjs-jquery,
+         libjs-jquery-mousewheel,
+         node-uglify,
+         make
+Recommends: yui-compressor
 Suggests: apache2 | nginx | httpd,
           libapache2-mod-php5 | php5-fpm | php5-cgi
 Description: Web 2.0 Photo Gallery Done Right via Static JSON & Dynamic 
Javascript
diff --git a/debian/photofloat.links b/debian/photofloat.links
index b5a5a1b..aa72d04 100644
--- a/debian/photofloat.links
+++ b/debian/photofloat.links
@@ -3,3 +3,5 @@
 /usr/share/texmf/fonts/opentype/public/lm/lmroman10-bolditalic.otf 
/usr/share/photofloat/web/fonts/lmroman10-bolditalic.otf
 /usr/share/texmf/fonts/opentype/public/lm/lmroman10-italic.otf 
/usr/share/photofloat/web/fonts/lmroman10-italic.otf
 /usr/share/texmf/fonts/opentype/public/lm/lmroman10-regular.otf 
/usr/share/photofloat/web/fonts/lmroman10-regular.otf
+/usr/share/javascript/jquery/jquery.js 
/usr/share/photofloat/web/js/000-jquery-1.7.2.js
+/usr/share/javascript/jquery-mousewheel/jquery.mousewheel.js 
/usr/share/photofloat/web/js/003-mousewheel.js
diff --git a/debian/photofloat.postinst b/debian/photofloat.postinst
new file mode 100644
index 0000000..3223656
--- /dev/null
+++ b/debian/photofloat.postinst
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+  configure)
+    cd /usr/share/photofloat/web && make
+  ;;
+  triggered)
+    cd /usr/share/photofloat/web && make js/scripts.min.js
+  ;;
+  abort-upgrade|abort-remove|abort-deconfigure)
+  ;;
+  *)
+    echo "postinst called with unknown argument \`$1'" >&2
+    exit 1
+  ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/photofloat.prerm b/debian/photofloat.prerm
new file mode 100644
index 0000000..e1eda65
--- /dev/null
+++ b/debian/photofloat.prerm
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    remove)
+        rm -f /usr/share/photofloat/web/js/*.min.js
+        ;;
+    failed-upgrade|upgrade|deconfigure)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/photofloat.triggers b/debian/photofloat.triggers
new file mode 100644
index 0000000..db0ecc7
--- /dev/null
+++ b/debian/photofloat.triggers
@@ -0,0 +1,2 @@
+interest /usr/share/javascript/jquery/jquery.js
+interest /usr/share/javascript/jquery-mousewheel/jquery.mousewheel.js
diff --git a/debian/rules b/debian/rules
index 118de9d..49f0824 100755
--- a/debian/rules
+++ b/debian/rules
@@ -20,11 +20,5 @@ export DH_OPTIONS
 %:
        dh $@  --with=python2
 
-override_dh_auto_build:
-       dh_auto_build
-       ln -s /usr/share/javascript/jquery/jquery.js 
$(CURDIR)/web/js/000-jquery-1.7.2.js
-       ln -s /usr/share/javascript/jquery-mousewheel/jquery.mousewheel.js 
$(CURDIR)/web/js/003-mousewheel.js
-       cd $(CURDIR)/web && $(MAKE)
-
 override_dh_install:
-       dh_install -X.gitignore -XMakefile -Xutils/
+       dh_install -X.gitignore -X*.min.js -Xutils/
diff --git a/web/Makefile b/web/Makefile
index 72aea0d..8224ac5 100644
--- a/web/Makefile
+++ b/web/Makefile
@@ -7,7 +7,7 @@ CSS_MIN = $(CSS_DIR)/styles.min.css
 JS_MIN_FILES := $(sort $(patsubst %.js, %.min.js, $(filter-out %.min.js, 
$(wildcard $(JS_DIR)/*.js))))
 CSS_MIN_FILES := $(sort $(patsubst %.css, %.min.css, $(filter-out %.min.css, 
$(wildcard $(CSS_DIR)/*.css))))
 
-JS_COMPILER = yui-compressor --type js
+JS_COMPILER = uglifyjs
 CSS_COMPILER = yui-compressor --type css
 
 .PHONY: all clean
-- 
1.8.5.2


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to