| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
include /usr/share/dpkg/default.mk |
| 4 |
|
| 5 |
%: |
| 6 |
dh $@ |
| 7 |
|
| 8 |
SHIPDIR=debian/jquery-timepicker/usr/share/javascript/jquery-timepicker |
| 9 |
|
| 10 |
SOURCE = $(wildcard src/jquery-ui-timepicker-addon.*) |
| 11 |
SHIP = $(patsubst %,$(SHIPDIR)/%,$(SOURCE)) |
| 12 |
|
| 13 |
VERSION_DATE=$(shell grep 'modified": ".*"' jquery-ui-timepicker-addon.json | cut -d'"' -f 4) |
| 14 |
|
| 15 |
$(SHIPDIR)/%.js: %.js |
| 16 |
yui-compressor -o '.js$$:.min.js' $< |
| 17 |
|
| 18 |
$(SHIPDIR)/%.css: %.css |
| 19 |
yui-compressor -o '.css$$:.min.css' $< |
| 20 |
|
| 21 |
override_dh_clean: |
| 22 |
dh_clean |
| 23 |
if test -e debian/save; then \ |
| 24 |
rm -f debian/save/*.min.*; \ |
| 25 |
mv debian/save/* src/; \ |
| 26 |
rmdir debian/save; \ |
| 27 |
fi |
| 28 |
|
| 29 |
override_dh_auto_build: $(SHIP) |
| 30 |
# Replace version and version date |
| 31 |
# Also apply on the dist file |
| 32 |
mkdir -p debian/save |
| 33 |
cp src/jquery-ui-timepicker-addon*.js debian/save/ |
| 34 |
sed -i "s/@@version/$(DEB_VERSION_UPSTREAM)/g" src/jquery-ui-timepicker-addon*.js |
| 35 |
sed -i "s/@@timestamp/$(VERSION_DATE)/g" src/jquery-ui-timepicker-addon*.js |
| 36 |
|
| 37 |
cat src/docs/header.html > src/index.html |
| 38 |
cat src/docs/intro.html | sed "s/@@version/$(DEB_VERSION_UPSTREAM)/" | sed "s/@@timestamp/$(VERSION_DATE)/" >> src/index.html |
| 39 |
cat src/docs/options.html >> src/index.html |
| 40 |
cat src/docs/formatting.html >> src/index.html |
| 41 |
cat src/docs/i18n.html >> src/index.html |
| 42 |
cat src/docs/examples.html >> src/index.html |
| 43 |
cat src/docs/footer.html >> src/index.html |
| 44 |
|
| 45 |
# Do like Grunt would have done |
| 46 |
# Source: https://github.com/trentrichardson/jQuery-Timepicker-Addon/blob/397d6ed930649ea7224123d140d341e9f3ffaba6/Gruntfile.js#L55 |
| 47 |
printf '/*! jQuery Timepicker Addon - v%s - %s\n* http://trentrichardson.com/examples/timepicker\n* Copyright (c) 2016 Trent Richardson; Licensed MIT */\n\n(function($$){\n\n' \ |
| 48 |
$(DEB_VERSION_UPSTREAM) \ |
| 49 |
$(VERSION_DATE) \ |
| 50 |
> src/i18n/jquery-ui-timepicker-addon-i18n.js~ |
| 51 |
# The ~ is for the for loop not to catch the file |
| 52 |
# The src/i18n/jquery-ui-timepicker-hu.js file is a UTF-8 with BOM file, the first sed removes it |
| 53 |
for name in src/i18n/jquery-ui-timepicker-*.js; do\ |
| 54 |
printf '// source: %s\n' $${name} >> src/i18n/jquery-ui-timepicker-addon-i18n.js~; \ |
| 55 |
sed '1s/^\xEF\xBB\xBF//' $${name} | sed '/(function(\$$) {/d' | sed '/(function (\$$) {/d' | sed '/})(jQuery);/d' | sed '/\$$.timepicker.setDefaults/d' >> src/i18n/jquery-ui-timepicker-addon-i18n.js~; \ |
| 56 |
printf '\n' $${name} >> src/i18n/jquery-ui-timepicker-addon-i18n.js~; \ |
| 57 |
done |
| 58 |
echo '})(jQuery);' >> src/i18n/jquery-ui-timepicker-addon-i18n.js~ |
| 59 |
mv src/i18n/jquery-ui-timepicker-addon-i18n.js~ src/i18n/jquery-ui-timepicker-addon-i18n.js |
| 60 |
yui-compressor -o '.js$$:.min.js' src/i18n/jquery-ui-timepicker-addon-i18n.js |