From 3c8b85528c5f9efd889c43f0857ec1dc830a5c9a Mon Sep 17 00:00:00 2001 From: Marcel Metz Date: Sat, 25 May 2013 16:49:48 +0200 Subject: [PATCH] Added autotools build system. --- .gitignore | 14 ++++- Makefile.am | 40 +++++++++++++ README.md | 31 +++++++--- autogen.sh | 22 +++++++ config/.gitignore | 2 + configure.ac | 57 +++++++++++++++++++ data/.gitignore | 3 + data/Makefile.am | 29 ++++++++++ metadata.json => data/metadata.json.in | 9 +-- ...me.shell.extensions.sensors.gschema.xml.in | 0 m4/.gitignore | 1 + src/Makefile.am | 10 ++++ convenience.js => src/convenience.js | 0 extension.js => src/extension.js | 0 prefs.js => src/prefs.js | 0 utilities.js => src/utilities.js | 0 16 files changed, 206 insertions(+), 12 deletions(-) create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 config/.gitignore create mode 100644 configure.ac create mode 100644 data/.gitignore create mode 100644 data/Makefile.am rename metadata.json => data/metadata.json.in (60%) rename schemas/org.gnome.shell.extensions.sensors.gschema.xml => data/org.gnome.shell.extensions.sensors.gschema.xml.in (100%) create mode 100644 m4/.gitignore create mode 100644 src/Makefile.am rename convenience.js => src/convenience.js (100%) rename extension.js => src/extension.js (100%) rename prefs.js => src/prefs.js (100%) rename utilities.js => src/utilities.js (100%) diff --git a/.gitignore b/.gitignore index 9ae0d77..867e0ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,14 @@ -gschemas.compiled *~ +*.swp +autom4te.cache +configure +Makefile.in +Makefile +sensors.shell-extension.zip +gnome-shell-extension-sensors-1.3.tar.gz +gnome-shell-extension-sensors-1.3.tar.xz +aclocal.m4 +config.log +config.status +.build/ +ChangeLog diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..d83ad1b --- /dev/null +++ b/Makefile.am @@ -0,0 +1,40 @@ +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} + +SUBDIRS = src data + +uuid = "temperature@xtranophilist" + +localprefix = $(HOME)/.local/share/gnome-shell/extensions + +zip-file: sensors.shell-extension.zip + +sensors.shell-extension.zip: all + $(MKDIR_P) $(builddir)/.build + $(MAKE) install DESTDIR="$(abs_builddir)/.build" + $(AM_V_at)cp -r "$(builddir)/.build$(datadir)/gnome-shell/extensions/$(uuid)" "$(builddir)/.build" + if [ -f "$(builddir)/.build$(datadir)/glib-2.0/schemas/org.gnome.shell.extensions.sensors.gschema.xml" ]; then \ + $(MKDIR_P) "$(builddir)/.build/$(uuid)/schemas"; \ + mv "$(builddir)/.build$(datadir)/glib-2.0/schemas/org.gnome.shell.extensions.sensors.gschema.xml" "$(builddir)/.build/$(uuid)/schemas"; \ + glib-compile-schemas "$(builddir)/.build/$(uuid)/schemas"; \ + fi; \ + cp -r "$(builddir)/.build$(datadir)/locale" "$(builddir)/.build/$(uuid)"; \ + (cd "$(builddir)/.build/$(uuid)/"; \ + zip -qr "$(abs_builddir)/sensors.shell-extension.zip" .; \ + ); + +clean-local: + $(AM_V_at)-rm -rf $(builddir)/sensors.shell-extension.zip + +distclean-local: + $(AM_V_at)-rm -rf $(builddir)/.build + +local-install: sensors.shell-extension.zip + zip_file="$(abs_builddir)/sensors.shell-extension.zip"; \ + if [ -d "$(localprefix)/$(uuid)" ]; then \ + rm -fR "$(localprefix)/$(uuid)"; \ + fi; \ + $(MKDIR_P) $(localprefix)/$(uuid); \ + (cd $(localprefix)/$(uuid); \ + unzip -q $${zip_file}; \ + ); + diff --git a/README.md b/README.md index d02b2a8..42687b2 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ Optionally, this extension uses [hddtemp] to read hard drive temperature data. Installation ============= +This is the **recommended method** for installation, as it doesn't require the build +dependencies for installation. You can install this extension by visiting the [GNOME extensions] page for this extension. @@ -27,18 +29,33 @@ Fedora has packaged an older version of this extension. You can install it by ru Manual installation ------------------- -This is the **recommended method** for installation as you always get the latest version. +To install this extension you need to clone the source and build the extension. +The build dependenciesare: + +* *gettext*, +* *pkg-config*, +* *git*, +* *glib2*, +* *glib2-devel* or *libglib2.0-dev*, +* *zip*, +* *gnome-common*, +* *autoconf*, +* *automake*, +* *intltool*. + +To build the extension please run the following commands: + + cd ~ && git clone https://github.com/xtranophilist/gnome-shell-extension-sensors.git + cd ~/gnome-shell-extension-sensors + ./autogen.sh + You can install this extension for your user by executing: - cd ~/.local/share/gnome-shell/extensions - git clone https://github.com/xtranophilist/gnome-shell-extension-sensors.git temperature@xtranophilist - glib-compile-schemas temperature@xtranophilist/schemas/ + make local-install or system wide by executing (this requires root permissions): - cd /usr/share/gnome-shell/extensions/ - git clone https://github.com/xtranophilist/gnome-shell-extension-sensors.git temperature@xtranophilist - glib-compile-schemas temperature@xtranophilist/schemas/ + make install After installation you need to restart the GNOME shell: diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..0ab57c9 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +PKG_NAME="gnome-shell-extension-sensors" + +touch ChangeLog + +test -f $srcdir/configure.ac || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level gnome-shell-extensions directory" + exit 1 +} + +which gnome-autogen.sh || { + echo "You need to install gnome-common from GNOME Git (or from" + echo "your OS vendor's package manager)." + exit 1 +} +. gnome-autogen.sh diff --git a/config/.gitignore b/config/.gitignore new file mode 100644 index 0000000..022060c --- /dev/null +++ b/config/.gitignore @@ -0,0 +1,2 @@ +install-sh +missing diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..dfe4628 --- /dev/null +++ b/configure.ac @@ -0,0 +1,57 @@ +AC_PREREQ(2.63) +dnl be carefull, the version needs to be in sync with your gnome shell version +AC_INIT([gnome-shell-extension-sensors],[1.3],[https://github.com/xtranophilist/gnome-shell-extension-sensorsi/issues]) + +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([config]) + +AM_INIT_AUTOMAKE([1.10 dist-xz foreign]) + +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + +AC_PROG_SED + +PKG_PROG_PKG_CONFIG([0.22]) + +GLIB_GSETTINGS + +AC_ARG_WITH(desktop-dir, [ --with-desktop-dir=PATH where to install desktop files (default=PREFIX/share)]) + +if test "x$with_desktop_dir" != x; then + DESKTOP_DATADIR=$with_desktop_dir +else + DESKTOP_DATADIR="$datadir" +fi + +AM_CONDITIONAL(DESKTOP_DATADIR, test "x$with_desktop_dir" != xno) +AC_SUBST(DESKTOP_DATADIR) + +AC_ARG_WITH([local-install], + [AS_HELP_STRING([--with-local-install], + [install schemas and translations in a subdir of the extension (default is no)])], + [use_local_install=$withval], + [use_local_install=no]) + +AC_SUBST(use_local_install) +AM_CONDITIONAL(LOCAL_INSTALL, test "x${use_local_install}" == "xyes") + +extensiontopdir=${datadir}/gnome-shell/extensions/weather@gnome-shell-extensions.gnome.org + +dnl This is beyond ugly. Suggestions accepted. +if test "x${use_local_install}" == "xyes"; then + AC_SUBST(gsettingsschemadir, [${extensiontopdir}/schemas]) +fi + +dnl Please keep this sorted alphabetically. +AC_CONFIG_FILES([ + Makefile + data/Makefile + src/Makefile +]) +AC_OUTPUT + +if test "x$use_local_install" == "xyes"; then + echo + echo "The schemas will be installed in subdirectories of the extension." + echo +fi diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 0000000..67c4c72 --- /dev/null +++ b/data/.gitignore @@ -0,0 +1,3 @@ +org.gnome.shell.extensions.sensors.gschema.valid +org.gnome.shell.extensions.sensors.gschema.xml +metadata.json diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..5e8d914 --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1,29 @@ +extensionurl = https://github.com/xtranophilist/gnome-shell-extension-sensors + +# Change these to modify how installation is performed +topextensiondir = $(datadir)/gnome-shell/extensions + +uuid = temperature@xtranophilist + +extensiondir = $(topextensiondir)/$(uuid) + +nodist_extension_DATA = metadata.json $(EXTRA_EXTENSION) + +EXTRA_DIST = metadata.json.in + +metadata.json: metadata.json.in $(top_builddir)/config.status + $(AM_V_GEN) sed -e "s|[@]LOCALEDIR@|$(datadir)/locale|" \ + -e "s|[@]GETTEXT_PACKAGE@|$(GETTEXT_PACKAGE)|" \ + -e "s|[@]uuid@|$(uuid)|" \ + -e "s|[@]url@|$(extensionurl)|" $< > $@ + +CLEANFILES = metadata.json + +gschemas_in = org.gnome.shell.extensions.sensors.gschema.xml.in + +@INTLTOOL_XML_NOMERGE_RULE@ + +gsettings_SCHEMAS = $(gschemas_in:.xml.in=.xml) @GSETTINGS_RULES@ + +EXTRA_DIST += $(gschemas_in) +CLEANFILES += $(gschemas_in:.xml.in=.valid) $(gsettings_SCHEMAS) diff --git a/metadata.json b/data/metadata.json.in similarity index 60% rename from metadata.json rename to data/metadata.json.in index 8b0260d..1ad0b68 100644 --- a/metadata.json +++ b/data/metadata.json.in @@ -2,13 +2,14 @@ "description": "Shows CPU temperature, HDD temperature, voltage and fan RPM", "name": "Sensors", "settings-schema": "org.gnome.shell.extensions.sensors", - "gettext-domain": "gse-sensors", + "gettext-domain": "@GETTEXT_PACKAGE@", "shell-version": [ "3.2", "3.4", "3.6", "3.8" - ], - "url": "https://github.com/xtranophilist/gnome-shell-extension-sensors", - "uuid": "temperature@xtranophilist" + ], + "localedir": "@LOCALEDIR@", + "url": "@url@", + "uuid": "@uuid@" } diff --git a/schemas/org.gnome.shell.extensions.sensors.gschema.xml b/data/org.gnome.shell.extensions.sensors.gschema.xml.in similarity index 100% rename from schemas/org.gnome.shell.extensions.sensors.gschema.xml rename to data/org.gnome.shell.extensions.sensors.gschema.xml.in diff --git a/m4/.gitignore b/m4/.gitignore new file mode 100644 index 0000000..9f841b0 --- /dev/null +++ b/m4/.gitignore @@ -0,0 +1 @@ +intltool.m4 diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..ba82226 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,10 @@ +# Change these to modify how installation is performed +topextensiondir = $(datadir)/gnome-shell/extensions + +uuid = temperature@xtranophilist + +extensiondir = $(topextensiondir)/$(uuid) + +dist_extension_DATA = extension.js convenience.js prefs.js utilities.js + +nodist_extension_DATA = $(EXTRA_EXTENSION) diff --git a/convenience.js b/src/convenience.js similarity index 100% rename from convenience.js rename to src/convenience.js diff --git a/extension.js b/src/extension.js similarity index 100% rename from extension.js rename to src/extension.js diff --git a/prefs.js b/src/prefs.js similarity index 100% rename from prefs.js rename to src/prefs.js diff --git a/utilities.js b/src/utilities.js similarity index 100% rename from utilities.js rename to src/utilities.js