From 0a879aaa77977ddd6dd0591b673ff4624c745032 Mon Sep 17 00:00:00 2001 From: Horst3180 Date: Fri, 21 Aug 2015 00:05:39 +0200 Subject: enable installation via autotools --- .gitignore | 2 +- Makefile.am | 103 +++++++++++++++++++++++++++++++++++++++++++++++-------- autogen.sh | 13 +++++++ configure.ac | 6 ++++ m4/arc-enable.m4 | 19 ++++++++++ make-xpi.sh | 65 ----------------------------------- 6 files changed, 128 insertions(+), 80 deletions(-) create mode 100755 autogen.sh create mode 100644 m4/arc-enable.m4 delete mode 100755 make-xpi.sh diff --git a/.gitignore b/.gitignore index 2bb60f8..c8eb40a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,6 @@ config.log config.status configure install-sh -*.m4 +aclocal.m4 missing autom4te.cache/ diff --git a/Makefile.am b/Makefile.am index 5cae39a..4af080a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,29 +1,104 @@ ACLOCAL_AMFLAGS = -I m4 AM_CFLAGS = +light_guid = 52c2877e-44e1-11e5-8874-a62d1d5d46B0 +darker_guid = 8a01dfcc-450f-11e5-909b-fb581d5d46b0 +dark_guid = 03cb16aa-4675-11e5-b233-213b1d5d46b0 + +lighttempdir = $(top_builddir)/arc-firefox-theme-light +darkertempdir = $(top_builddir)/arc-firefox-theme-darker +darktempdir = $(top_builddir)/arc-firefox-theme-darker + +extensiondir = $(DESTDIR)/$(libdir)/firefox/browser/extensions + + EXTRA_DIST = ${top_srcdir}/README.md \ ${top_srcdir}/LICENSE \ - ${top_srcdir}/make-xpi.sh \ - ${top_srcdir}/arc-firefox-theme + ${top_srcdir}/arc-firefox-theme \ + $(top_srcdir)/autogen.sh NULL = + mkxpi: - ${top_srcdir}/make-xpi.sh +if ENABLE_LIGHT + cp -r --no-preserve=mode,ownership $(top_srcdir)/arc-firefox-theme $(lighttempdir) -arc-firefox-theme-$(VERSION).xpi: mkxpi -arc-darker-firefox-theme-$(VERSION).xpi: -arc-dark-firefox-theme-$(VERSION).xpi: + cp $(lighttempdir)/chrome/browser/sass/browser-light.css $(lighttempdir)/chrome/browser/browser.css + rm -rf $(lighttempdir)/chrome/browser/sass -BUILT_SOURCES = \ - arc-firefox-theme-$(VERSION).xpi \ - arc-darker-firefox-theme-$(VERSION).xpi \ - arc-dark-firefox-theme-$(VERSION).xpi + cd $(lighttempdir) && \ + zip -FS -r ../arc-firefox-theme-$(VERSION).xpi * -CLEANFILES = \ - $(BUILT_SOURCES) + rm -rf $(lighttempdir) +endif # ENABLE_LIGHT + +if ENABLE_DARKER + cp -r --no-preserve=mode,ownership $(top_srcdir)/arc-firefox-theme $(darkertempdir) + + cp $(darkertempdir)/chrome/browser/sass/browser-darker.css $(darkertempdir)/chrome/browser/browser.css + rm -rf $(darkertempdir)/chrome/browser/sass + + sed -i 's/arc-firefox-theme/arc-darker-firefox-theme/' $(darkertempdir)/chrome.manifest + sed -i 's/arc-firefox-theme/arc-darker-firefox-theme/' $(darkertempdir)/install.rdf + sed -i 's/Arc /Arc Darker /' $(darkertempdir)/install.rdf + + sed -i "s/$(light_guid)/$(darker_guid)/" $(darkertempdir)/install.rdf + + cd $(darkertempdir) && \ + zip -FS -r ../arc-darker-firefox-theme-$(VERSION).xpi * + + rm -rf $(darkertempdir) +endif # ENABLE_LIGHT + +if ENABLE_DARK + cp -r --no-preserve=mode,ownership $(top_srcdir)/arc-firefox-theme $(darktempdir) -extensiondir = $(libdir)/firefox/extensions -extension_DATA = \ + cp $(darktempdir)/chrome/browser/sass/browser-dark.css $(darktempdir)/chrome/browser/browser.css + rm -rf $(darktempdir)/chrome/browser/sass + + sed -i 's/arc-firefox-theme/arc-dark-firefox-theme/' $(darktempdir)/chrome.manifest + sed -i 's/arc-firefox-theme/arc-dark-firefox-theme/' $(darktempdir)/install.rdf + sed -i 's/Arc /Arc Dark /' $(darktempdir)/install.rdf + + sed -i "s/$(light_guid)/$(dark_guid)/" $(darktempdir)/install.rdf + + cd $(darktempdir) && \ + zip -FS -r ../arc-dark-firefox-theme-$(VERSION).xpi * + + rm -rf $(darktempdir) +endif # ENABLE_DARK + +install-data-local: mkxpi + + $(MKDIR_P) $(extensiondir) + +if ENABLE_LIGHT + unzip -d $(extensiondir)/\{$(light_guid)\} $(top_builddir)/arc-firefox-theme-$(VERSION).xpi +endif # ENABLE_LIGHT + +if ENABLE_DARKER + unzip -d $(extensiondir)/\{$(darker_guid)\} $(top_builddir)/arc-darker-firefox-theme-$(VERSION).xpi +endif # ENABLE_LIGHT + +if ENABLE_DARK + unzip -d $(extensiondir)/\{$(dark_guid)\} $(top_builddir)/arc-dark-firefox-theme-$(VERSION).xpi +endif # ENABLE_LIGHT + + +uninstall: +if ENABLE_LIGHT + rm -rf $(extensiondir)/\{$(light_guid)\} +endif # ENABLE_LIGHT + +if ENABLE_DARKER + rm -rf $(extensiondir)/\{$(darker_guid)\} +endif # ENABLE_DARKER + +if ENABLE_DARK + rm -rf $(extensiondir)/\{$(dark_guid)\} +endif # ENABLE_DARK + +CLEANFILES = \ arc-firefox-theme-$(VERSION).xpi \ arc-darker-firefox-theme-$(VERSION).xpi \ arc-dark-firefox-theme-$(VERSION).xpi diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..0e36e12 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +test -z "$srcdir" && srcdir=$(dirname "$0") +test -z "$srcdir" && srcdir=. + +cwd=$(pwd) +cd "$srcdir" + +mkdir -p m4 +autoreconf --verbose --force --install || exit $? + +cd "$cwd" +"$srcdir/configure" $@ diff --git a/configure.ac b/configure.ac index cd784df..ca5982f 100644 --- a/configure.ac +++ b/configure.ac @@ -2,8 +2,14 @@ AC_INIT([arc-firefox-theme], [40.20150819], [https://github.com/horst3180/arc-fi AM_INIT_AUTOMAKE([-Wno-portability no-dist-gzip dist-xz foreign subdir-objects tar-ustar]) AC_PREFIX_DEFAULT(/usr/local) AM_SILENT_RULES([yes]) +AC_CONFIG_MACRO_DIR([m4]) +AC_PROG_MKDIR_P +ARC_ENABLE([LIGHT], [light], [Arc Light Firefox], [disable]) +ARC_ENABLE([DARKER], [darker], [Arc Darker Firefox], [disable]) +ARC_ENABLE([DARK], [dark], [Arc Dark Firefox], [disable]) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/m4/arc-enable.m4 b/m4/arc-enable.m4 new file mode 100644 index 0000000..a34e8c1 --- /dev/null +++ b/m4/arc-enable.m4 @@ -0,0 +1,19 @@ +# ARC_ENABLE(VARIABLE, FEATURE, HELP-NAME, DISABLE/ENABLE) +# ----------------------------------------------------------- +AC_DEFUN([ARC_ENABLE], [ + AC_ARG_ENABLE( + [$2], + [AS_HELP_STRING( + [--$4-$2], + [$4 $3 support] + )], + [ENABLE_$1="$enableval"], + [AS_IF( + [test "x$4" = "xdisable"], + [ENABLE_$1="yes"], + [ENABLE_$1="no"] + )] + ) + AM_CONDITIONAL([ENABLE_$1], [test "x$ENABLE_$1" = "xyes"]) + AC_SUBST([ENABLE_$1]) +]) diff --git a/make-xpi.sh b/make-xpi.sh deleted file mode 100755 index 1c2b79c..0000000 --- a/make-xpi.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -DIR=`dirname -- "$0"` -cd $DIR - -VERSION=$(cat arc-firefox-theme/install.rdf | grep em:version | cut -f2 -d'>' | cut -f1 -d'<') - -DEFAULT_GUID=52c2877e-44e1-11e5-8874-a62d1d5d46B0 -DARKER_GUID=8a01dfcc-450f-11e5-909b-fb581d5d46b0 -DARK_GUID=03cb16aa-4675-11e5-b233-213b1d5d46b0 - -#clean previous .xpi files -rm -f *.xpi - -cp -r arc-firefox-theme arc-firefox-theme-light -cp -r arc-firefox-theme arc-firefox-theme-darker -cp -r arc-firefox-theme arc-firefox-theme-dark - - -# build default variant -cd arc-firefox-theme-light -cp chrome/browser/sass/browser-light.css chrome/browser/browser.css -rm -rf chrome/browser/sass - -#pack extension -zip -FS -r ../arc-firefox-theme-$VERSION.xpi * -cd .. - - -# build darker variant -cd arc-firefox-theme-darker -cp chrome/browser/sass/browser-darker.css chrome/browser/browser.css -rm -rf chrome/browser/sass - -#replace extension name -sed -i 's/arc-firefox-theme/arc-darker-firefox-theme/' chrome.manifest -sed -i 's/arc-firefox-theme/arc-darker-firefox-theme/' install.rdf -sed -i 's/Arc /Arc Darker /' install.rdf - -#replace extension GUID -sed -i "s/$DEFAULT_GUID/$DARKER_GUID/" install.rdf - -#pack extension -zip -FS -r ../arc-darker-firefox-theme-$VERSION.xpi * -cd .. - - -# build dark variant -cd arc-firefox-theme-dark -cp chrome/browser/sass/browser-dark.css chrome/browser/browser.css -rm -rf chrome/browser/sass - -#replace extension name -sed -i 's/arc-firefox-theme/arc-dark-firefox-theme/' chrome.manifest -sed -i 's/arc-firefox-theme/arc-dark-firefox-theme/' install.rdf -sed -i 's/Arc /Arc Dark /' install.rdf - -#replace extension GUID -sed -i "s/$DEFAULT_GUID/$DARK_GUID/" install.rdf - -#pack extension -zip -FS -r ../arc-dark-firefox-theme-$VERSION.xpi * -cd .. - -rm -rf arc-firefox-theme-light arc-firefox-theme-darker arc-firefox-theme-dark -- cgit v1.2.3