/usr/share/help/fr/gnome-devel-demos/weatherAutotools.js.page is in gnome-devel-docs 3.18.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | <?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" style="task" id="weatherAutotools.js" xml:lang="fr">
<info>
<link type="guide" xref="weatherApp.js#main" group="#last"/>
<revision version="0.1" date="2012-03-09" status="stub"/>
<credit type="author copyright">
<name>Susanna Huhtanen</name>
<email its:translate="no">ihmis.suski@gmail.com</email>
<years>2012</years>
</credit>
<desc/>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Luc Rebert,</mal:name>
<mal:email>traduc@rebert.name</mal:email>
<mal:years>2011</mal:years>
</mal:credit>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Alain Lojewski,</mal:name>
<mal:email>allomervan@gmail.com</mal:email>
<mal:years>2011-2012</mal:years>
</mal:credit>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Luc Pionchon</mal:name>
<mal:email>pionchon.luc@gmail.com</mal:email>
<mal:years>2011</mal:years>
</mal:credit>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Bruno Brouard</mal:name>
<mal:email>annoa.b@gmail.com</mal:email>
<mal:years>2011-12</mal:years>
</mal:credit>
<mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
<mal:name>Luis Menina</mal:name>
<mal:email>liberforce@freeside.fr</mal:email>
<mal:years>2014</mal:years>
</mal:credit>
</info>
<title>Autotools et icônes</title>
<synopsis>
<p>Dans cette partie du guide, nous allons construire les « autotools » et personnaliser les icônes dont nous avons besoin pour que l'application météo fasse partie intégrante de notre bureau. Pour écrire et lancer tous les exemples de code, vous avez besoin d'un éditeur pour écrire le code, de l'application Terminal et d'un ordinateur sur lequel GNOME 3 ou supérieur est installé. Dans ce guide, nous illustrerons les éléments suivants :</p>
<list>
<item><p><link xref="#autotools"> Autotools</link></p></item>
<item><p><link xref="#icons">Custom icons for your application</link></p></item>
</list>
</synopsis>
<section id="autotools">
<title>Autotools et fichiers nécessaires</title>
<p>Having more than one file in your folder makes using autotools a bit tricky. You need the .desktop file, autogen.sh, Makefile.am, configure.ac and as a new file: myapp.sh.in file. Hacking the autotools file is a complicated field. More information can be found in many different sources, <link href="http://en.wikipedia.org/wiki/GNU_build_system">the wikipedia article</link> provides a good overview on the subject.
</p>
<list>
<item><p>weatherapp.desktop</p></item>
<item><p>weatherapp.sh.in</p></item>
<item><p>Makefile.am</p></item>
<item><p>configure.ac</p></item>
<item><p>autogen.sh</p></item>
</list>
<p>weatherapp.desktop</p>
<code mime="text/.desktop" style="numbered"><![CDATA[
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Weather app
Comment=Weather showing application
Exec=weatherapp.sh
Icon=application-default-icon
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;]]></code>
<p>La chose à noter dans ce fichier est que la ligne « Exec » rendra fonctionnel ce fichier « desktop » seulement après avoir exécuté tous les autres « makefiles ». Weatherapp.sh est un petit script créé avec le weatherapp.sh.in.</p>
<p>weatherapp.sh.in</p>
<code mime="text/sh.in" style="numbered"><![CDATA[
#!/bin/sh
export GJS_PATH=@bindir@
gjs @bindir@/weatherapp.js]]></code>
<p>Ce fichier est un modèle que le fichier Makefile va créer pour être lancé à partir de .desktop.</p>
<p>Makefile.am</p>
<code mime="text/am" style="numbered"><![CDATA[
# The actual runnable program is set to the SCRIPTS primitive. Prefix bin_ tells where to copy this
bin_SCRIPTS = weatherapp.js geonames.js weatherapp.sh
# List of files to be distributed
EXTRA_DIST= \
$(bin_SCRIPTS) \
$(private_icons) \
$(NULL)
CLEANFILES =
# The desktop files
desktopdir = $(datadir)/applications
desktop_DATA =weatherapp.desktop
# convenience command for doing Makefile variable substitutions in non-Makefile
# files (scripts, service files, etc.)
do_subst = sed -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
-e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
-e 's|@localedir[@]|$(localedir)|g' \
-e 's|@bindir[@]|$(bindir)|g' \
-e 's|@libexecdir[@]|$(libexecdir)|g' \
-e 's|@pkglibdir[@]|$(pkglibdir)|g' \
-e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
-e 's|@have_libnotify[@]|$(HAVE_LIBNOTIFY)|g' \
-e 's|@have_libsoup[@]|$(HAVE_LIBSOUP)|g' \
-e 's|@have_cheese[@]|$(HAVE_CHEESE)|g'
weatherapp.sh: weatherapp.sh.in
$(AM_V_GEN) $(do_subst) $< > $@
chmod +x $@
CLEANFILES += weatherapp.sh
EXTRA_DIST += weatherapp.sh.in
#the application icon
appicondir=$(datadir)/icons/hicolor/scalable/apps
appicon_DATA=weather-icon.svg
#icons in the application
NULL =
private_icons = \
weather-clear.svg \
weather-few-clouds.svg \
weather-fog.svg \
weather-icon.svg \
weather-overcast.svg \
weather-showers.svg \
weather-showers-scattered.svg \
weather-snow.svg \
$(NULL)
install-icons:
for icon in $(private_icons); do \
mkdir -p $(DESTDIR)$(pkgdatadir)/icons/; \
$(INSTALL_DATA) $(srcdir)/$$icon $(DESTDIR)$(pkgdatadir)/icons/; \
done
install-data-local: install-icons]]></code>
<p>Ceci nécessite un peu plus d'explications. Comparé au Makefile.am de Helloworld, celui-ci a été fortement modifié. Parcourons tous les nouveaux blocs :</p>
<p>« bin_scripts » sont les fichiers nécessaires pour exécuter votre application. Dans ce cas, les deux premiers fichiers sont les programmes eux-mêmes et le troisième est le script qui lance l'application.</p>
<p>EXTRA_DIST sont les fichiers qui doivent être distribués.</p>
<p>le bloc « do_subst » est quelque chose qui a besoin d'être là où il est.</p>
<p>Après le commentaire « #icons in the application » se trouvent toutes les icônes qui sont utilisées par le programme. Pour qu'elles soient utiles, vous devez installer les icônes aux emplacements corrects, ce qui est réalisé par la partie « install-icons ».</p>
<p>configure.ac</p>
<code mime="text/ac" style="numbered"><![CDATA[
dnl This file is processed by autoconf to create a configure script
AC_INIT([Weather App], 1.0)
AM_INIT_AUTOMAKE([1.10 no-define foreign])
AC_CONFIG_FILES(Makefile)
AC_OUTPUT]]></code>
<p>autogen.sh</p>
<code mime="text/sh" style="numbered"><![CDATA[
#!/bin/sh
# This will run autoconf, automake, etc. for us
autoreconf --force --install]]></code>
</section>
<section id="icons">
<title>Icônes personnalisées pour votre application</title>
<p>Lorsque vous pensez icônes personnalisées, une bonne règle est : souhaitez-vous que cette icône puisse être utilisée autre part ou est-elle privée ? Dans le premier cas (par ex. des icônes dans le fichier desktop qui sont affichées par le shell) alors vous avez besoin de /usr/share/hicolor sinon (par ex. les icônes météo de votre application) /usr/share/$application/bla/bla</p>
<p>Pour utiliser autotools, vous devez apporter quelques modifications à vos fichiers .desktop et Makefile. Dans le fichier desktop, modifiez le nom de l'icône Icon=weather-icon. Dans le fichier Makefile.am, ajoutez ces deux lignes à la fin de votre application #the application icon.</p>
<p>appicondir=$(datadir)/icons/hicolor/scalable/apps</p>
<p>appicon_DATA=weather-icon.svg</p>
</section>
</page>
|