From bc9181917182e27324ff0437cf0d10abd91fa581 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Wed, 28 Feb 2018 09:35:07 +0100 Subject: Compatibility for different build OSes --- Makefile | 16 ++++++++++++---- debian/changelog | 7 +++++++ debian/control | 3 ++- html/index.html | 4 ++-- html/webbox.js | 2 +- src/Makefile | 10 ++++++---- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index cdb6910..9c9840f 100644 --- a/Makefile +++ b/Makefile @@ -7,10 +7,11 @@ install: all mkdir -p $(DESTDIR)/var/www/webbox cp -r html/* $(DESTDIR)/var/www/webbox/ - # Minify - uglifyjs html/webbox.js -m -c > $(DESTDIR)/var/www/webbox/webbox.js - htmlmin html/index.html $(DESTDIR)/var/www/webbox/index.html - cleancss -o $(DESTDIR)/var/www/webbox/webbox.css html/webbox.css + # Minify, conditionally + command -v uglifyjs && uglifyjs html/webbox.js -m -c > $(DESTDIR)/var/www/webbox/webbox.js || true + command -v htmlmin && \ + htmlmin html/index.html $(DESTDIR)/var/www/webbox/index.html || true + command -v cleancss && cleancss -o $(DESTDIR)/var/www/webbox/webbox.css html/webbox.css || true mkdir -p $(DESTDIR)/usr/lib/webbox cp src/query $(DESTDIR)/usr/lib/webbox/ @@ -22,8 +23,15 @@ deploy: all sudo service apache2 start deb: + # build binary deb package dpkg-buildpackage -us -uc -rfakeroot +deb-src: + dpkg-source -b . + +debs: deb-src + # TODO: build for different OSes + clean: make -C src clean dh_clean diff --git a/debian/changelog b/debian/changelog index ee955fd..4e13203 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +webbox (1.6) unstable; urgency=medium + + * New version + * Speedup by minification + + -- Roland Reichwein Tue, 27 Feb 2018 13:57:31 +0100 + webbox (1.5) unstable; urgency=medium * New version diff --git a/debian/control b/debian/control index 5dbb8a0..d6a00f5 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,8 @@ Source: webbox Section: web Priority: extra Maintainer: Roland Reichwein -Build-Depends: debhelper (>= 9), qtbase5-dev, libfcgi-dev, node-uglify, htmlmin, cleancss +# grep is dummy +Build-Depends: debhelper (>= 9), qtbase5-dev, libfcgi-dev, node-uglify | grep, htmlmin | grep, cleancss | grep Standards-Version: 4.1.3 Homepage: http://www.reichwein.it/webbox/ diff --git a/html/index.html b/html/index.html index d33d678..e9ea819 100644 --- a/html/index.html +++ b/html/index.html @@ -12,14 +12,14 @@ - +
Webbox
- + diff --git a/html/webbox.js b/html/webbox.js index 09a3979..55df1f5 100644 --- a/html/webbox.js +++ b/html/webbox.js @@ -57,7 +57,7 @@ function loadContents(dir) { } - xhr.open("GET", "bin/query" + currentDir + "?command=list", true); + xhr.open("GET", "bin/query" + dir + "?command=list", true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhr.send(); } diff --git a/src/Makefile b/src/Makefile index 0a8ab19..482e986 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,16 +1,18 @@ ARCH=$(shell dpkg-architecture -qDEB_HOST_MULTIARCH) TARGET=query -CPPFLAGS=-Wall -O2 -fPIC -std=gnu++17 -I/usr/include/$(ARCH)/qt5 -I/usr/include/$(ARCH)/qt5/QtCore -LDFLAGS=-Wall -O2 -fPIC -std=gnu++17 -lstdc++ -lfcgi -lQt5Core +# gnu++17 since gcc 5 +STANDARD=$(shell g++ -std=gnu++17 -E -x c++ - < /dev/null > /dev/null 2>/dev/null && echo "-std=gnu++17" || echo "-std=gnu++14") +CPPFLAGS=-Wall -O2 $(STANDARD) -fPIC -I/usr/include/$(ARCH)/qt5 -I/usr/include/$(ARCH)/qt5/QtCore +LDFLAGS=-Wall -O2 $(STANDARD) -fPIC -lstdc++ -lfcgi -lQt5Core OBJS=webbox.o all: $(TARGET) $(TARGET): $(OBJS) - gcc $(LDFLAGS) -o $@ $^ + g++ $(LDFLAGS) -o $@ $^ %.o: %.cpp - gcc $(CPPFLAGS) -c -o $@ $< + g++ $(CPPFLAGS) -c -o $@ $< clean: -rm -rf $(TARGET) $(OBJS) -- cgit v1.2.3