GEM-Manual.tex 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338
  1. %% LyX 1.4.0 created this file. For more info, see http://www.lyx.org/.
  2. %% Do not edit unless you really know what you are doing.
  3. \documentclass[11pt,english]{article}
  4. \usepackage{pslatex}
  5. \usepackage[T1]{fontenc}
  6. \usepackage[latin1]{inputenc}
  7. \usepackage{geometry}
  8. \geometry{verbose,a4paper,tmargin=2.5cm,bmargin=2.5cm,lmargin=2cm,rmargin=2cm}
  9. \setcounter{secnumdepth}{2}
  10. \setcounter{tocdepth}{2}
  11. \setlength\parskip{\medskipamount}
  12. \setlength\parindent{0pt}
  13. \usepackage{calc}
  14. \usepackage{color}
  15. \usepackage{setspace}
  16. \onehalfspacing
  17. \IfFileExists{url.sty}{\usepackage{url}}
  18. {\newcommand{\url}{\texttt}}
  19. \makeatletter
  20. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
  21. \newenvironment{lyxcode}
  22. {\begin{list}{}{
  23. \setlength{\rightmargin}{\leftmargin}
  24. \setlength{\listparindent}{0pt}% needed for AMS classes
  25. \raggedright
  26. \setlength{\itemsep}{0pt}
  27. \setlength{\parsep}{0pt}
  28. \normalfont\ttfamily}%
  29. \item[]}
  30. {\end{list}}
  31. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
  32. \usepackage{babel}
  33. \makeatother
  34. \begin{document}
  35. \title{GRASS Extensions Manager (GEM), Version 1.0\\
  36. Manual}
  37. \author{Benjamin Ducke (benducke@compuserve.de)}
  38. \maketitle
  39. \begin{abstract}
  40. GRASS 6 Extensions Manager (GEM) is a small stand-alone program intended
  41. to make it easy for GRASS GIS users to download, compile and install
  42. additional GRASS modules. GEM manages source code, scripts and pre-compiled
  43. binaries in a simple file layout called an \emph{extension}. Extensions
  44. are accompanied by a set of ASCII files that store all relevant information
  45. including dependencies on other extensions or specific GRASS versions.
  46. Extensions can be stored conveniently in a single compressed archive
  47. file, a so-called \emph{extension package} using external programs
  48. such as tar and gzip. An extension (package) can be created easily
  49. by copying existing source codes into the right places of a skeleton
  50. file layout and filling in some information in simple, commented ASCII
  51. files. Makefiles written for GRASS 6 should work with minimal changes
  52. as GEM uses a simplified version of the orginal GRASS make system.
  53. This Document provides instructions for using GEM and for writing
  54. portable GRASS extensions to be installed with GEM.
  55. \newpage{}
  56. \end{abstract}
  57. \tableofcontents{}
  58. \newpage{}
  59. \section{Why Do I Need GEM?}
  60. GRASS GIS (\url{www.grass.itc.it}) is a powerful, modularized open
  61. source Geographic Information System. The base distribution comes
  62. with hundreds of useful modules. However, there are a few flaws in
  63. the design:
  64. \begin{enumerate}
  65. \item Installation of add-on modules that are not part of the main distribution
  66. (\url{http://grass.gdf-hannover.de/twiki/bin/view/GRASS/GrassAddOns})
  67. is tedious. It requires a full copy of the GRASS source codes. Add-on
  68. sources must be copied to the right locations, compilation and installation
  69. must then be started as though one was to install the whole system
  70. from scratch.
  71. \item Users willing to install add-on functionality must have at least a
  72. basic knowledge of how to compile and install modules from C source
  73. code.
  74. \item The sheer number of modules makes it hard to find the one that has
  75. exactly the functionality needed. There is no thematic grouping of
  76. modules. This becomes worse as more add-on modules are installed.
  77. \item Developers of add-on functionality currently have no way to make this
  78. process more user-friendly. Add-on developers as a rule write modules
  79. that are functionaly closely related. These should be grouped and
  80. distributed as a package along with some over-arching documentation
  81. to bind them together and make them more accessible from a user's
  82. perspective.
  83. \item Some add-ons modules exist in the official CVS and in another place
  84. such as the developer's homepage. For a user, it is hard to know which
  85. version is more current. In fact, GRASS has no versioning scheme except
  86. for the base distribution itself.
  87. \end{enumerate}
  88. GEM, the GRASS Extensions Manager, was developed as an open source
  89. solution to address all of these issues. It is a tool that simplifies
  90. development, distribution and installation of additional modules (extensions)
  91. for GRASS GIS (version 6.0 and above).
  92. From the GRASS user's perspective GEM can be used to:
  93. \begin{itemize}
  94. \item Conveniently download and install add-on GRASS modules (extensions)
  95. that are not part of the CVS.
  96. \item Avoid having to keep a complete GRASS source tree on the disk for
  97. installing new functionality.
  98. \item Install add-on modules from provided binaries without the need to
  99. have any development tools installed.
  100. \item Manage installed extensions: query, update, uninstall them.
  101. \end{itemize}
  102. Form the GRASS developer's perspective GEM allows for:
  103. \begin{enumerate}
  104. \item Development of GRASS modules completely outside the CVS tree. In a
  105. dedicated directory that is much easier to maintain and sync.
  106. \item Packaging of module source code, documentation and pre-compiled binaries
  107. and deployment as a single file (extension package).
  108. \item Simple outsourcing of sets of GRASS functionality from the base distribution
  109. into extension packages.
  110. \end{enumerate}
  111. GEM works on Linux/Unix, MacOS X and cygwin systems. There are some
  112. OS specific issues which are discussed in the appendix.
  113. \section{How Does GEM Work?}
  114. The GEM program itself is a relatively simple frontend written in
  115. ANSI C that interacts with more complex installation scripts (make
  116. system) contained in each individual extension package. These scripts
  117. are a scaled-down and slightly modified version of the original GRASS
  118. 6 make system. Files in an extension package correspond 1:1 with the
  119. layout of the original GRASS source tree, the only difference being
  120. that an extension package only contains source code for the add-on
  121. modules plus a few things that are needed to setup the source code,
  122. parse HTML documentation etc.
  123. A GRASS extension is essentially a minimal replication of the GRASS
  124. source tree including all necessary makefiles. It contains only the
  125. source code for a few modules that constitute the extensions. On the
  126. top level, you will find a number of ASCII files that contain the
  127. information gem needs to manage the extension. All information is
  128. managed in plain ASCII format.
  129. Installed extensions will be registered in \emph{\$(PATH\_TO\_GRASS)/etc/extensions.db}.
  130. This registry file also contains version and dependencies information.
  131. Each extension should also provide an uninstall script to be run when
  132. the user wants to get rid of that extension.
  133. They are stored in \emph{\$(PATH\_TO\_GRASS)/etc/uninstall.<extension\_name>}.
  134. Extension may add a submenu to the GIS Manager. The first extension
  135. installed creates an additional \char`\"{}Xtns\char`\"{} top level
  136. menu under which each extension can register a nested submenu.
  137. Gem modifies \$\emph{(PATH\_TO\_GRASS)/etc/d.m/menu.tcl} for this.
  138. The extension source code is in the \emph{src} directory, along with
  139. all the necessary makefiles. Other directories may hold pre-compiled
  140. binaries and should be named appropriately (\emph{win32}, \emph{macosx},
  141. ...).
  142. Extensions may provide code for C language modules and libraries,
  143. scripts and HTML documentation.
  144. GEM compiles and install add-on modules using the sources and makefiles
  145. contained in the extension.
  146. For the user, GEM is really simple to use. All that is required is
  147. a download of the extension package to install and knowledge of where
  148. the local GRASS installation resides. If the user does not have permission
  149. to install new files in the GRASS installation directory, a password
  150. for a user with sufficient permissions will be required (see next
  151. section).
  152. Developers of add-on modules will (hopefully) also find the process
  153. of migrating their work to a GEM extension package a matter of minutes
  154. and well worth the effort. More information for developers can be
  155. found in section \ref{sec:Developing-Extensions-for} of this document.
  156. \section{Installation and Usage}
  157. Note: in addition to GEM itself, you will probably want to install
  158. GNU C compiler and maketools for compilation. Tar, gzip, unzip, bunzip2
  159. for handling various archive formats. Wget for fetching extensions
  160. from the internet.
  161. \subsection{Program Installation\label{sub:Program-Installation}}
  162. You can download GEM source code and binaries for several different
  163. platforms from the author's homepage (\url{http://www.uni-kiel.de/ufg/index1.htm}).
  164. Check the links at the bottom of the page. You will also find several
  165. extension packages for installation with GEM.
  166. Download the file \emph{gem-someversion.tar.gz} to a convenient location,
  167. unpack it and change into the newly created directory:
  168. \begin{lyxcode}
  169. tar~-xzvf~gem-\emph{someversion}.tar.gz
  170. cd~gem-\emph{someversion}
  171. \end{lyxcode}
  172. In this directory, you will find a folder \emph{bin} that contains
  173. binaries for different platforms. Change into it and list its contents:
  174. \begin{lyxcode}
  175. cd~bin
  176. ls
  177. \end{lyxcode}
  178. You will see a number of programs. Pick the one that corresponds to
  179. your OS and start it. E.g., if you are working in a cygwin environment
  180. under Windows, do:
  181. \begin{lyxcode}
  182. ./gem-cygwin.exe
  183. \end{lyxcode}
  184. You should get a text explaining the program's options on your screeen.
  185. If you want (and have the required permissions), you can copy the
  186. file to a directory for system-wide binaries so you can call GEM from
  187. anywhere without having to prefix a directory path (./ in the example
  188. above) by typing just \texttt{gem}:
  189. \begin{lyxcode}
  190. cp~gem-cygwin.exe~/usr/local/bin/gem
  191. \end{lyxcode}
  192. Once GEM has reached a stable release version (1.0), it will also
  193. become part of the GRASS CVS version. If you download and install
  194. such a version on your computer, you will automatically have GEM available
  195. system-wide (usually \emph{/usr/local/bin}) and can just start it
  196. with:
  197. \begin{lyxcode}
  198. gem
  199. \end{lyxcode}
  200. Instructions on how to user GEM to install an actual extension are
  201. given in section \ref{sub:Basic-Usage}.
  202. \subsection{Installation from Source Code}
  203. %
  204. \begin{minipage}[t][1\totalheight]{1\columnwidth}%
  205. Note: please make sure that you system-wide linker path includes the
  206. location of the GRASS dynamic libraries (e.g. \emph{/usr/local/grass-6.3.cvs/libs}).
  207. This is usually done by adding an appropriate entry to \emph{/etc/ld.so.conf}
  208. and running \emph{ldconfig}. You may have to consult your system's
  209. administrator.%
  210. \end{minipage}%
  211. You must have a C compiler, preferably GNU C, and the corresponding
  212. make tools installed. Most Linux/Unix systems should come with these
  213. installed. If not, use your distributions package manager to install
  214. them (look for something like {}``Development tools''). Mac OS X
  215. and Cygwin users: see OS specific notes in section \ref{sec:OS-Specific-Issues}.
  216. Download the file \emph{gem-someversion.tar.gz} to a convenient location,
  217. unpack it and change into the newly created directory:
  218. \begin{lyxcode}
  219. tar~-xzvf~gem-\emph{someversion}.tar.gz
  220. cd~gem-\emph{someversion}
  221. \end{lyxcode}
  222. In this directory, start the compilation process:
  223. \begin{lyxcode}
  224. make
  225. \end{lyxcode}
  226. Afer a few seconds, the compilation is done and you have an executable
  227. file that you can start from the current directory:
  228. \begin{lyxcode}
  229. ./gem
  230. \end{lyxcode}
  231. \ldots{} or copy the executable to a system-wide directory, such
  232. as \emph{/usr/local/bin}.
  233. \subsection{Quickstart}
  234. %
  235. \framebox{\parbox[t][1\totalheight]{1\columnwidth}{%
  236. Note: please be aware that GEM can only install modules in a specially
  237. prepared package. See section 4 for how to do this.%
  238. }}%
  239. For the impatient. To install an extension into your running version
  240. of GRASS: start a GRASS session, download an extension and install
  241. it from inside the GRASS session using:
  242. \begin{lyxcode}
  243. gem~-{}-install=\emph{ExtensionName}.tar.gz
  244. \end{lyxcode}
  245. Provide the superuser password if needed. Restart GIS Manager and
  246. look in the {}``Xtns'' menu for new modules (some modules may not
  247. provide such entries). If anything goes wrong or confuses you: read
  248. the rest of this section!
  249. \subsection{Basic Usage\label{sub:Basic-Usage}}
  250. %
  251. \framebox{\parbox[t][1\totalheight]{1\columnwidth}{%
  252. Note: Operation of GEM under Cygwin is only possible in verbose mode
  253. (option {}``-v'' or {}``--verbose'')! Please read section A.2
  254. on Windows specific issues.%
  255. }}%
  256. This section will show you how to use GEM to perform basic things:
  257. installing, querying and removing (un-installing) extensions for GRASS
  258. GIS. For the sake of simplicity, I will assume that your GRASS installation
  259. resides in \emph{/usr/local/grass-6.x.y} and you may have to adjust
  260. this path in the examples below, so that it reflects your individual
  261. setup (Mac OS X users: see notes on system specific issues in section
  262. \ref{sub:Mac-OS-X} for how to find the path to your installation).
  263. Also, the extension package used in the following examples is called
  264. \emph{RasterTools.tar.gz} and is in {}``tar'd gzip'' format. Replace
  265. this with the name of the extension you wish to install as needed.
  266. I will further assume that you (or your system's administrator) have
  267. copied the executable \emph{gem} into a directory from where it can
  268. be started system-wide (such as \emph{/usr/local/bin}) without having
  269. to prefix the path to the executable (see instructions in \ref{sub:Program-Installation}).
  270. %
  271. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  272. Note: in order to install extensions that do not provide binaries,
  273. you need to have a C compiler (preferably GNU CC) and make tools installed.
  274. Please refer to the OS specific section A for more details.
  275. For unpacking extension packages you need the appropriate software.
  276. Depending on the format of the archive, this could be \emph{tar},
  277. \emph{gzip}, \emph{bunzip2} and \emph{unzip}.
  278. If you want to get extensions from an internet source (http or ftp),
  279. you also need \emph{wget}. These programs will very likely already
  280. be installed on your system. If not, you will find it easy to locate
  281. a copy for your OS using an internet search engine.%
  282. \end{minipage}}%
  283. GEM understands short and long options. Long options are just a more
  284. legible version of the short options, which is why I will use them
  285. in this document. E.g. {}``-i'' is a short option that does exactly
  286. the same as {}``--install=''. To see all options, short and long,
  287. simply call GEM without any options or {}``--help'':
  288. \begin{lyxcode}
  289. gem
  290. \end{lyxcode}
  291. The {}``--version'' action shows information about the GEM version
  292. you are using.
  293. You will notice that GEM knows a special sort of options called {}``actions''
  294. this are options that cause GEM to operate in some way on the extension.
  295. The regular {}``options'' are just used to modify the way GEM works.
  296. To install a module into your GRASS installation (in this example
  297. \emph{/usr/local/grass-6.x.y}), simply pass the name of the archive
  298. containing the extension or the directory with the unpacked files
  299. to the {}``--install='' action and supply the path to the GRASS
  300. installation for which you wish to install the extension (using the
  301. {}``--grass='' option):
  302. \begin{lyxcode}
  303. gem~-{}-grass=/usr/local/grass-6.x.y~-{}-install=RasterTools.tar.gz
  304. \end{lyxcode}
  305. If everything goes well, you will see a few messages on the screen
  306. and after a short while the program will inform you that it is done.
  307. If you do not have permission to write into the system-wide GRASS
  308. installation directory, you will be asked for the password of the
  309. user owning the GRASS binary files.
  310. If any errors occur, use option {}``-v'' ({}``--verbose'') to
  311. see what is going on.
  312. By default, the {}``--install='' action performs an installation
  313. from source code. This will first configure the sources for your system's
  314. individual setup, then compile the source code into binaries, finally
  315. install them in the appropriate locations.
  316. %
  317. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  318. Note: an extension may also provide shell scripts that do not need
  319. to be compiled. Installation does, however, by default work in the
  320. same way. Look for the keyword {}``scripts'' in the extension details
  321. (under {}``Binary installation files'') by querying it as discussed
  322. in section 3.5 on installation of binaries. If it exists, you can
  323. perform a binary install (again, see section 3.5) for {}``scripts'',
  324. skipping configuration and compilation steps and avoiding the need
  325. to have C development tools installed. %
  326. \end{minipage}}%
  327. If you invoke GEM from inside a running GRASS session, you can ommit
  328. the {}``--grass='' option. GEM will then automatically install the
  329. extension into the GRASS installation that is currently running. We
  330. will assume this to be true for the following usage examples, as it
  331. saves me some typing work (\ldots{}).
  332. The new modules provided by the extension should be available to you
  333. immediately from within a GRASS session. The extension will be registered
  334. as {}``RasterTools''. To get a list of newly installed GRASS modules:
  335. \begin{lyxcode}
  336. gem~-{}-query=RasterTools
  337. \end{lyxcode}
  338. This will display all sorts of information about your freshly installed
  339. extension, including the installed modules (under {}``Commands provided'').
  340. If it is too much information to display on your terminal, pipe it
  341. through \emph{more} and press space to see one page after another:
  342. \begin{lyxcode}
  343. gem~-{}-query=RasterTools~|~more
  344. \end{lyxcode}
  345. Alternatively, you can browse the GRASS HTML offline help which should
  346. now contain a link to the extension and its modules from its main
  347. page \emph{index.html}.
  348. Some extensions may provide menu entries for a GRASS GUI. Currently,
  349. \emph{d.m} and \emph{gis.m} are supported by GEM. Both of these GUIs
  350. need to be restarted. If the extension provides menu entries, you
  351. will find them under {}``Xtns'' in the main menu bar.
  352. If you want to know details about an extension before you install
  353. it, you can also query the extension package itself:
  354. \begin{lyxcode}
  355. gem~-{}-query=RasterTools.tar.gz
  356. \end{lyxcode}
  357. Actions {}``--details='' and {}``--license='' will give additional
  358. information if needed. To list all installed extensions (shows name,
  359. version and type of installation, i.e. binaries or compiled from source)
  360. in the current GRASS installation, just query without any extension
  361. name:
  362. \begin{lyxcode}
  363. gem~-q
  364. \end{lyxcode}
  365. %
  366. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  367. Note: Awful detail: you must use the short action name {}``-q''
  368. in this case, not {}``--query='' and it has to be at the end of
  369. the GEM command line!%
  370. \end{minipage}}%
  371. You can also un-install an extension to remove it from the system-wide
  372. GRASS installation (take name from list produced by above command).
  373. Again, you need write-access to the GRASS installation dir.
  374. \begin{lyxcode}
  375. gem~-{}-uninstall=AdvancedViewshedAnalysis~
  376. \end{lyxcode}
  377. This should clean your system of all installed modules, HTML pages
  378. and GUI menu entires. Quit and restart the GIS-Manager (\emph{d.m})
  379. to see the effects of these actions. If something goes wrong or you
  380. overwrite GIS Manager's menu config file (\emph{\$(PATH\_TO\_GRASS)/\-etc/\-dm/\-menu.tcl}),
  381. or you have installed a new version of GRASS (e.g. from CVS) and are
  382. now missing GUI menu entries and HTML pages for your extensions:
  383. \begin{lyxcode}
  384. gem~-{}-restore~
  385. \end{lyxcode}
  386. \ldots{} will try to put everything back in order. The program will
  387. also create a backup copy \emph{menu.tcl.gem.bak} before it alters
  388. \emph{menu.tcl}. The \char`\"{}--restore\char`\"{} action is also
  389. useful if you update or re-install GIS-Manager or the GRASS HTML-Documentation
  390. in which case both menu entries and HTML references have to be restored
  391. for all extensions installed.
  392. \subsection{Installation of Pre-compiled Binary Extension Files\label{sub:Installation-of-Pre-compiled}}
  393. Some extensions may provide pre-compiled binary files for one or more
  394. operating systems. A user wishing to install an extension that provides
  395. binaries for his OS does not need to have C development tools installed.
  396. This may frequently be the case for users of Mac OS X and Cygwin (but
  397. see OS specific issues in section \ref{sec:OS-Specific-Issues}).
  398. It is recommended for all users of GRASS and GEM to install C development
  399. tools and install extensions from sources (the regular way as described
  400. in section \ref{sub:Basic-Usage}). This will compile the source code
  401. into custom binaries that are optimally tailored to your system. However,
  402. there may be circumstances that make using pre-compiled binaries appear
  403. more convenient or even unavoidable.
  404. You can check whether an extension provides such pre-compiled binary
  405. files for your OS by querying the extension package:
  406. \begin{lyxcode}
  407. gem~-{}-query=RasterTools.tar.gz
  408. \end{lyxcode}
  409. If any binaries are provided, they will be listed under \char`\"{}Binary
  410. installation files\char`\"{}. You should be able to see whether they
  411. are suitable for your system from the names. E.g. {}``cygwin'' would
  412. provide binaries for Cygwin users (see section \ref{sub:Developers'-Guidelines}
  413. for conventional names of binaries for different OS).
  414. Use the option \char`\"{}--binary=\char`\"{} in conjunction with the
  415. \char`\"{}--install=\char`\"{} action to install the binaries you
  416. deem right:
  417. \begin{lyxcode}
  418. gem~-{}-binary=cygwin~-{}-install=RasterTools.tar.gz
  419. \end{lyxcode}
  420. This process should finish quicker than regular installation from
  421. source code as it will skip source code configuration and compilation.
  422. If you have chosen a wrong set of binaries, new commandes will simply
  423. fail to start when you try to use them.
  424. \subsection{Additional Options}
  425. Option {}``-f'' ({}``--force'') can be used to force GEM to re-install
  426. an existing extension, over-writing anything that was installed previously.
  427. This is not a recommended thing to do! There is currently no clean
  428. updating mechanism for GEM, so you are advised to first de-install
  429. the existing extension (which might involve de-installing all dependent
  430. extensions first), then install freshly.
  431. You can also download and install, query etc. an extension packages
  432. directly from an internet source (http or ftp), provided that \emph{wget}
  433. is installed (\url{http://www.gnu.org/software/wget/wget.html}):
  434. \begin{lyxcode}
  435. gem~-{}-install=http://www.uni-kiel.de/ufg/dateienDucke/RasterTools.tar.gz
  436. \end{lyxcode}
  437. \subsection{Module Versions and Dependencies}
  438. Information about all installed extensions is stored in the file \emph{etc/extensions.db}
  439. in your system-wide GRASS installation directory. This file contains
  440. the names, versions and \emph{dependencies} of all installed extensions.
  441. Some extensions may need another extension or a particular GRASS version
  442. to be installed before it can function properly. If an extension's
  443. dependencies are not met, GEM will abort the installation and you
  444. need to first install all required software.
  445. Querying an extension package will let you see the dependencies it
  446. has before you attempt to install (under {}``Dependencies''):
  447. \begin{lyxcode}
  448. gem~-{}-query=RasterTools.tar.gz
  449. \end{lyxcode}
  450. Compare this with the output of
  451. \begin{lyxcode}
  452. gem~-q
  453. \end{lyxcode}
  454. ... and you will know if you need to install something else first.
  455. You can force installation of extensions with unmatched dependencies
  456. by using the \char`\"{}--force\char`\"{} option. This is not a recommended
  457. thing to do!
  458. GEM also guards against de-installation of extensions that are still
  459. needed by other extensions still present on the system. You need to
  460. un-install all dependent extension in reverse order of installation
  461. first.
  462. There is currently no clean updating mechanism for GEM, so you are
  463. advised to first un-install an existing extension (which might involve
  464. de-installing all dependent extensions first) before you install a
  465. newer version.
  466. Do not edit \emph{extensions.db} manually, unless you now \emph{exactly}
  467. what you are doing!
  468. \section{Developing Extensions for Use with GEM\label{sec:Developing-Extensions-for}}
  469. Converting existing GRASS add-on modules to a GEM extension package
  470. is easy. Extensions may provide C program code and headers for modules
  471. and libraries, shell scripts and tcl code. Basically anything that
  472. you find a directory for in the skeleton package.
  473. %
  474. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  475. Note: if your extension needs to install {}``unusual'' things (additional
  476. fonts, tcl widgets, ...) you may need to adapt the top-level Makefile
  477. in your extension package.%
  478. \end{minipage}}%
  479. \subsection{GEM Developers' Support\label{sub:GEM-Developers'-Support}}
  480. The skeleton package (see section \ref{sub:The-Skeleton-Package})
  481. is an almost complete GRASS extension. Use this as a template for
  482. starting new extensions or migrating existing source code from the
  483. GRASS source tree. All you need to do is copy your source files, scripts
  484. etc. into the appropriate places in the \emph{src} directory (you
  485. will find that everything mirrors the way GRASS sources are organized)
  486. and fill necessary information into the toplevel ASCII files.
  487. GEM can configure, compile and install extensions from a plain directory.
  488. Just provide the name of the directory for all actions. This allows
  489. you to conveniently keep all your sources and documentations in a
  490. small, portable directory outside the GRASS source tree and maintain
  491. everything in there.
  492. You can test whether an extension compiles and installs on your system
  493. by using the {}``--test='' action. This will perform all steps except
  494. for actually copying the files to their destinations.
  495. %
  496. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  497. Note: the {}``--test='' action simulates the entire installation
  498. process, including checks for dependencies and already installed extensions.
  499. This means that testing may result in an error message after successful
  500. compilation. If this annoys, you, use the {}``--force'' option.%
  501. \end{minipage}}%
  502. The {}``--clean='' action merely exists for the convenience of the
  503. developer: it performs a make clean in the extensions \emph{src} directory.
  504. Two more options exist to make life easier for developers: {}``--skip-config''
  505. to skip source code configuration for speeding up the testing. and
  506. {}``--options='' (sorry about the awful name). Everything you specify
  507. here will be passed through to the C compiler upon compilation of
  508. your extension.
  509. \subsection{The Skeleton Package\label{sub:The-Skeleton-Package}}
  510. The skeleton package is an almost complete GRASS extension. Use this
  511. as a template for starting new extensions or migrating existing source
  512. code from the GRASS source tree. All you need to do is copy your source
  513. files, scripts etc. into the appropriate places in the \emph{src}
  514. directory (you will find that everything mirrors the way GRASS sources
  515. are organized) and fill necessary information into the toplevel ASCII
  516. files (see following sections).
  517. Look into the skeleton extension directory and open the ASCII files
  518. with a texteditor of your choice. You will find lots of comments that
  519. help you make sense of their contents. You can put comments starting
  520. with \char`\"{}\#\char`\"{} at the beginning of a line or at the end
  521. in any file. These will be filtered out upon parsing of the file by
  522. GEM.
  523. The skeleton contains a copy of the GPL as the default license. Creators
  524. of new extensions need to be aware of this! Either insert the name
  525. of your extension at the end of that license or provide your own custom
  526. licensing information.
  527. %
  528. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  529. Note: please always provide licensing information!%
  530. \end{minipage}}%
  531. \subsection{Arranging the Source Code\label{sub:Arranging-the-Source}}
  532. You will find that your makefiles for individual moduls and libs can
  533. stay largely the way they are. One thing that may need to be adjusted
  534. is the \texttt{MODULE\_TOPDIR = ..} statement that points to the location
  535. of the global GRASS makefile \emph{include} directory. Also be aware
  536. that references to other include files libraries etc. that you reference
  537. in a makefile may have to be adjusted depending on how you decide
  538. to structure the source for your extension.
  539. Take a look at the example module in \emph{src/raster/r.example}.
  540. \subsection{Documenting Extension Files}
  541. It is extremely important to provide sufficient documentation about
  542. your extension's intended use, functionality, dependencies and shortcomings!
  543. A number of ASCII files in the toplevel extension directory store
  544. all this information about an extension. They must be edited appropriately.
  545. GEM's {}``--query='', {}``--license='' and {}``--details=''
  546. actions will dump their contents to the screen. These are:
  547. \emph{authors}, \emph{bugs}, \emph{commands}, \emph{depends}, \emph{description},
  548. \emph{entries-gisman}, \emph{entries-gisman2}, \emph{headers}, \emph{id},
  549. \emph{info}, \emph{libs}, \emph{license} and \emph{name} and \emph{version}.
  550. Files \emph{authors}, \emph{bugs}, \emph{commands}, \emph{description},
  551. \emph{headers}, \emph{id}, \emph{info}, \emph{libs}: These files are
  552. merely for the user's information. Their contents will be dumped by
  553. the {}``--query='' action. Much of this information will also go
  554. into the system-wide GRASS HTML help. Each extension registers its
  555. own section in \emph{\$GISBASE/docs/html/index.html} which links to
  556. an individual index page for that extension. This allows the user
  557. convenient access to inidividual modules' help pages as well as the
  558. contents of files \emph{description} and \emph{info}.
  559. Because of this, some description files can contain HTML tags. These
  560. will be ignored when the user queries the extension on a console but
  561. will be interpreted when the same information is accessed from the
  562. GRASS HTML offline help. There are two important exceptions: \texttt{<p>}
  563. and \texttt{<br>} will produce paragraph and line breaks for console
  564. output, as well.
  565. %
  566. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  567. Note: all other things inside {}``<'' and {}``>'' will be filtered
  568. out as HTML tags, even if they are not!%
  569. \end{minipage}}%
  570. Take a look at the files in the skeleton package for their individual
  571. meanings and format. Files that will be parsed for HTML tags are:
  572. \emph{authors}, \emph{bugs}, \emph{description} and \emph{info}.
  573. %
  574. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  575. Note: your modules' individual HTML manual pages have to be slightly
  576. adapted: please prefix \texttt{<a href=>} style references to GRASS
  577. modules that are not part of the extension with \texttt{../../html/}. %
  578. \end{minipage}}%
  579. File \emph{license}: this will be display by the {}``--license=''
  580. action.
  581. File \emph{info}: this will be displayed by the {}``--details=''
  582. action and also integrated in the HTML index page for the extension.
  583. Files \emph{depends}, \emph{name} and \emph{version}: see section
  584. \ref{sub:Version-Information}.
  585. Files \emph{entries-gisman} and \emph{entries-gisman2}: see section
  586. \ref{sub:Providing-GUI-Hooks}.
  587. \subsection{Version Information\label{sub:Version-Information}}
  588. The file \emph{name} is a very crucial one! It contains the name under
  589. which GEM will register your extension. Please see \ref{sub:Developers'-Guidelines}
  590. about naming conventions!
  591. The file \emph{version} stores the current version number of your
  592. extension. Make sure to keep this up-to-date prior to new releases.
  593. If your extension depends on other extensions or a specific GRASS
  594. version, you can state this in the \emph{depends} file. See the example
  595. in the skeleton extension for details. GEM will respect this information
  596. when a user tries to install or uninstall any extension.
  597. \subsection{Un-install and Post-install Actions}
  598. Two files remain that have not been discussed yet: \emph{uninstall}
  599. and \emph{post}.
  600. The \emph{uninstall} file is a shell script that contains all commands
  601. necessary to clean up the GRASS installation after the user invoked
  602. GEM with the {}``--uninstall='' action to un-install an extension.
  603. It takes care of deleting module binaries, HTML manpages, C include
  604. files and libraries provided by that extension from \emph{\$GISBASE}.
  605. In the most simple case, all you need to do is provide the list of
  606. your extension's user commands in \texttt{EXT\_MODULES=''''}. For
  607. more complex extensions, you may have to provide additional files
  608. to delete or even customize \emph{uninstall}. Take a look at the file
  609. in the skeleton extension to see what it does in detail.
  610. GEM will copy your extension's uninstall script to \emph{\$GISBASE/etc/uninstall.ExtensionName}
  611. and it will be run from there by the {}``--uninstall='' action.
  612. %
  613. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  614. Note: be very careful when adapting the \emph{uninstall} script! It
  615. is run with superuser privileges (or those of whatever user owns the
  616. GRASS installation directory). If you provide wrong paths there is
  617. no limit to the damage it can do to the user's system! Try to keep
  618. your changes to a minimum if you have to make any.%
  619. \end{minipage}}%
  620. The \emph{post} script can be used to customise many actions in case
  621. your extension needs anything not provided by the regular make system
  622. or GEM description files. GEM exports a number of environment variables
  623. depending on what options and actions the user chose to run it with.
  624. The \emph{post} script is automatically run after many actions and
  625. can be used to carry out custom tasks depending on the type of action.
  626. Take a look at the file provided by the skeletion extension to see
  627. what can be done.
  628. %
  629. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  630. Note: be very careful when adapting the \emph{post} script! It is
  631. run with superuser privileges (or those of whatever user owns the
  632. GRASS installation directory). If you add flawed commands there is
  633. no limit to the damage it can do to the user's system!%
  634. \end{minipage}}%
  635. \subsection{Providing GUI Hooks\label{sub:Providing-GUI-Hooks}}
  636. GEM currently supports the installation of menu items for GIS Manager:
  637. the old version (\emph{d.m}) and the new one (\emph{gis.m}) are both
  638. support. Support for \emph{d.m} menus is quite limited. You can only
  639. create one submenu and any number of menu items and separators inside
  640. of it. Menus for \emph{gis.m} can contain any tk menu code. You can
  641. have as many levels of menu hierarchy as you like. See the examples
  642. in the skeleton extension to learn how they are organized.
  643. The file responsible for creating \emph{d.m} menu entries is \emph{entries-gisman}.
  644. For \emph{gis.m} it is \emph{entries-gisman2}. For \emph{d.m} menus,
  645. \emph{entries-gisman} is directly merged into \emph{\$GISBASE/etc/dm/menu.tcl}.
  646. GEM will also place a copy of the original \emph{entries-gisman} file
  647. into \emph{\$GISBASE/etc/dm/gem-entries}. This is used by the {}``--restore''
  648. action to restore \emph{d.m} menus in case the user updates the GRASS
  649. installation and menu.tcl gets overwritten. For the purpose of un-installation,
  650. markers are stored as comments at the end of \emph{menu.tcl}. This
  651. allows the {}``--uninstall='' action to find an extensions menu
  652. entries and delete them. The file \emph{menu.tcl} will be backed up
  653. as \emph{menu.tcl.gem.bak} so a user can restore it if anything should
  654. wrong.
  655. Things work much simpler for \emph{gis.m}. In this case, \emph{\$GISBASE/etc/gm/gmmenu.tcl}
  656. dynamically re-builds the {}``Xtns'' menu upon start-up. If \emph{entries-gisman2}
  657. exists in an extension package, GEM will make sure to create an directory
  658. \emph{Xtns} in \emph{\$GISBASE/etc/gm/} and copies \emph{entries-gisman2}
  659. into it, renaming it to the extension's name. From these files, \emph{gis.m}
  660. will automatically build the {}``Xtns'' menu via some parsing code
  661. in \emph{gmmenu.tcl}.
  662. Your submenu will be sorted in under the \char`\"{}Xtns\char`\"{}
  663. menu in alphabetical position according to either the name of the
  664. top level menu item (\emph{d.m}) or the extension name (\emph{gis.m})
  665. it is smart to keep both the same (see guidelines in section \ref{sub:Developers'-Guidelines}).
  666. Both \emph{d.m} and \emph{gis.m} need to be restarted to see the effects
  667. of installing new menu entries.
  668. \subsection{Providing Binary Distributions}
  669. %
  670. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  671. Note: due to great heterogenity of installed system libraries, it
  672. is probably not worth the effort trying to create generic linux binaries.
  673. Binaries will work better for homogeneous platforms such as Cygwin
  674. and Lorenzo Moretti's GRASS for Mac OS X.%
  675. \end{minipage}}%
  676. It is possible to create an extension package that will
  677. If not done yet, unpack the extension files into a directory:
  678. \begin{lyxcode}
  679. tar~-xzvf~extensionname.tar.gz
  680. \end{lyxcode}
  681. Compile the extension under the OS that you wish to prepare binaries
  682. for (see OS specific issues in section \ref{sec:OS-Specific-Issues}
  683. about the additional software you may need to do this). You do not
  684. need to install, compilation will suffice (don't worry if you get
  685. an error message about the extension being already installed):
  686. \begin{lyxcode}
  687. ./gem~-{}-grass=pathToGRASS~-t~extensionName
  688. \end{lyxcode}
  689. If the compilation was successful, you will find two new folders in
  690. the \emph{src} directory of the extension directory: \emph{bin.architecture-osname}
  691. and \emph{dist.architecture-osname}. E.g. for a Windows/Cygwin compilation
  692. the {}``dist'' directory will frequently be
  693. \begin{lyxcode}
  694. dist.i686-pc-cygwin
  695. \end{lyxcode}
  696. (or similar).
  697. Create a new directory on the same level as the \emph{src} directory.
  698. For an appropriate name, follow the guidelines in section \ref{sub:Developers'-Guidelines}.
  699. In our Cygwin example, this would be \emph{cygwin}. In this directory:
  700. \begin{enumerate}
  701. \item move the \emph{dist.architecture-osname} directory here
  702. \item copy \emph{src/Makefile} here
  703. \item copy \emph{src/include} (with all subdirectories) here
  704. \end{enumerate}
  705. Make a slight modification to the copy of Makefile: at the top of
  706. the file following the definitions for install directories (BINDIR=,
  707. INST\_DIR=). Add another line that reads:
  708. \begin{lyxcode}
  709. GISBASE~=~\emph{dist.architecture-osname}
  710. \end{lyxcode}
  711. For our example, this might be:
  712. \begin{lyxcode}
  713. GISBASE~=~dist.i686-pc-cygwin
  714. \end{lyxcode}
  715. (or similar). This makes sure that the install command will install
  716. binaries from the right directory.
  717. Now, since we are preparing a binary distribution for the sake of
  718. people who do not have any development tools installed, we need to
  719. supply them with a copy of the GNU make tools, since this is the tool
  720. that will take care of the actual installation. What we need is really
  721. just the program \emph{make}. We will copy it into a folder \emph{bin}
  722. under our new directory. In our example, then the copy would go into
  723. \emph{cygwin/bin}.
  724. The skeleton extension package already has copies of \emph{make} for
  725. Cygwin and Mac OS X in place. If you need them for another architecture,
  726. download sources from \url{http://www.gnu.org/software/make/} and
  727. compile the appropriate binaries.
  728. %
  729. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  730. Note: if your extension consists of only platform independent things
  731. that need not be compiled (shell script, tcl code, ...), you can create
  732. a set of binaries on any system in the same way as described above
  733. and call the binary set \char`\"{}scripts\char`\"{} this will allow
  734. the user to install those scripts without having developer tools installed!%
  735. \end{minipage}}%
  736. \subsection{Preparing an Extension for Release}
  737. 1. make sure all ASCII files in the top-level extension directory
  738. have the necessary information (licensing!).
  739. 2. Compile binaries that you may wish to provide for those poor people
  740. who cannot afford C development tools
  741. 3. Clean the sources of compiled binaries (this will not affect binaries
  742. that you wish to provide and copied into their individual directories).
  743. 4. If not done yet, delete the example module directory \emph{src/raster/r.example}.
  744. And remove it from the list of subdirs in \emph{src/raster/Makefile}.
  745. 5. Pack everything into an archive using GNU tar and gzip.
  746. 6. Announce your shiny new extension on the appropriate GRASS mailling
  747. list!
  748. SHORTCOMINGS:
  749. GEM is not very well-suited to install add-ons consisting of just
  750. a single module. This would need an entire extension with the whole
  751. shebang for a single module! I is assumed, that people who program
  752. for a GIS as a rule produce more than just one module for a certain
  753. purose and that these can well be grouped into extensions.
  754. \subsection{Developers' Guidelines\label{sub:Developers'-Guidelines}}
  755. \subsubsection{Naming Extensions}
  756. Please do not use anything fancy for your extension's name (as stored
  757. in the \emph{name} file in the toplevel directory of your extension):
  758. no special characters, no whitespaces (including simple {}``space'').
  759. Use the same restrictions any sane programmer would use for file naming.
  760. This ensures that GEM can always correctly parse your extension's
  761. name.
  762. \subsubsection{Packaging Extensions}
  763. The recommended way to package an extension is to use GNU \emph{tar}
  764. and \emph{gzip} utilities as these will normally be available on any
  765. OS running GRASS. I recommend you use \emph{.tar.gz} as file extension:
  766. \begin{lyxcode}
  767. tar~-czvf~ExtensionName.tar.gz~DirectoryWithExtensionFiles
  768. \end{lyxcode}
  769. Make sure that you do not tar up the files from inside the extension
  770. directory! This will result in a non-functioning package and also
  771. gets users annoyed because the files will get decompressed directly
  772. into whatever directory the extension was compiled and it will be
  773. hard to clean up the mess. Also, do not use an absolute path to the
  774. files. Rather, build the archive from the directory that contains
  775. your extension directory, as shown in the example above.
  776. \subsubsection{HTML-Documentation}
  777. Check the GRASS HTML documentation and follow its style! Please provide
  778. good documentation for your individual modules as well as some brief
  779. and detailed information about the intended use, functionality and
  780. shortcomings of your extension (files \emph{description} and \emph{info},
  781. respectively).
  782. \subsubsection{Binaries}
  783. Suggested folder names for binary distributions:
  784. Mac OS X: \emph{macosx}
  785. Cygwin: \emph{cygwin}
  786. Linux (glibc 2.2): \emph{linux22}
  787. Linux (glibc 2.3): \emph{linux23}
  788. Shell scripts: \emph{scripts}
  789. \subsubsection{Menu Entries}
  790. Name the Toplevel menu item in your menu files (\emph{entries-gisman}
  791. and \emph{entries-gisman2}) the same as the Extension. This will make
  792. things much clearer for the user!
  793. \appendix
  794. \section{OS Specific Issues\label{sec:OS-Specific-Issues}}
  795. \subsection{Mac OS X\label{sub:Mac-OS-X}}
  796. If you want to run GRASS under Mac OS X you can install Lorenzo Moretti's
  797. binaries. They are frequently updated and easy to install. GEM has
  798. been tested for this version of GRASS and works well with it.
  799. In order to get this working, you need to install some additinal software
  800. from the Mac OS X install media. Just download from \url{http://wwwamb.bologna.enea.it/forgrass/}
  801. and follow the instructions in the documentation that comes with the
  802. program files.
  803. %
  804. \framebox{\begin{minipage}[t][1\totalheight]{1\columnwidth}%
  805. Note: if you want to be able to use any extension package, not only
  806. those that provide binaries for Mac OS X, you need to install the
  807. complete GNU C development tools from the Mac OS X installation media.%
  808. \end{minipage}}%
  809. If you are using Lorenzo's binaries, the path to GRASS for any GEM
  810. operation will be:
  811. \emph{/Applications/Grass/grass6x.app/Contents/Resources/grass-6.x.y}
  812. or
  813. \emph{/Applications/Grass/grass63cvs.app/Contents/Resources/grass-6.3.cvs}
  814. if you decided to also install Lorenzo's copy of the CVS version.
  815. I cannot provide any information about compiling GRASS from sources
  816. for Mac OS X as I do not have access to such a machine.
  817. \subsection{GRASS under Windows with Cygwin\label{sub:GRASS-under-Windows}}
  818. %
  819. \framebox{\parbox[t][1\totalheight]{1\columnwidth}{%
  820. Note: Operation of GEM under Cygwin is only possible in verbose mode
  821. (option {}``-v'' or {}``--verbose'')! The problem is that Windows
  822. cannot redirect output to stderr. This interferes with GEM's message
  823. hiding.%
  824. }}%
  825. Although there is now work underway to create a native Win32 version
  826. of GRASS, for now the only way to get it running is to use the Cygwin
  827. emulation layer. For instructions on how to do this, see \url{http://geni.ath.cx/grass.html}.
  828. Some additional hints about setting up Cygwin:
  829. \begin{itemize}
  830. \item Make sure you set the {}``Default Text File Type'' to {}``Unix''
  831. during Setup.
  832. \item If you want to be able to use any extension package, not only those
  833. that provide binaries for Cygwin, jsut install everything in the {}``Devel''
  834. category and you will have a complete development system.
  835. \item If you want to be able install extension packages directly from the
  836. internet (http or ftp sources) using GEM, make sure to install wget,
  837. located the {}``Network'' category.
  838. \item If you want to use an installation in a network environment with NT
  839. domain authentication, you may need to update \emph{cygwin1.dll} to
  840. a newer version. Download from \url{http://cygwin.com/snapshots/}
  841. and replace the old version in your system search path.
  842. \end{itemize}
  843. Under Cygwin, there is no support for the Unix \emph{su} command.
  844. This means that installation of extensions has to be done by someone
  845. with appropriate access rights to the GRASS installation directory
  846. inside the Cygwin installation directory (e.g. if you installed cygwin
  847. to \emph{C:\textbackslash{}cygwin}, this would be something like \emph{C:\textbackslash{}cygwin\textbackslash{}usr\textbackslash{}local\textbackslash{}grass-someversion}).
  848. \subsubsection{CygwinGRASS}
  849. CygwinGRASS (\url{https://www.geographie.uni-freiburg.de/~mlechner/CygwinGRASS/})
  850. is nice because it has all you need to install and use GRASS under
  851. Windows on one CD. Unfortunately, it has not been updated for a while
  852. and now contains fairly outdated versions of GRASS. See the document
  853. on the CD for installation instructions.
  854. Some hints regarding the setup:
  855. \begin{itemize}
  856. \item The CygwinGRASS setup has a little flaw in that it assumes the wrong
  857. location for the local package directory. Click on {}``Browse''
  858. and select the folder repository on the setup medium.
  859. \item If you want to be able to use any extension package, not only those
  860. that provide binaries for Cygwin, jsut install everything in the {}``Devel''
  861. category and you will have a complete development system.
  862. \item If you want to be able install extension packages directly from the
  863. internet (http or ftp sources) using GEM, make sure to install wget,
  864. located the {}``Network'' category.
  865. \item If you want to use a CygwinGRASS installation in a network environment
  866. with NT domain authentication, you will need to update \emph{cygwin1.dll}
  867. to a newer version. Download from \url{http://cygwin.com/snapshots/}
  868. and replace the old version in your system search path.
  869. \end{itemize}
  870. Browsing HTML helpfiles with the default command {}``iexplore''
  871. seems to fail. However, you can install a different browser and change
  872. the environment variable \texttt{GRASS\_HTML\_BROWSER} accordingly.
  873. \section{Technical Information}
  874. \subsection{File Layout of a GRASS Extension}
  875. Blue items are \texttt{\textcolor{blue}{directories}}, green ones
  876. are \texttt{\textcolor{green}{files}}.
  877. \subsubsection{Toplevel}
  878. \texttt{\textcolor{green}{README}}
  879. \texttt{\textcolor{green}{authors, bugs, commands, depends, description,
  880. entries-gisman, entries-gisman2, headers, id, info, libs, license,
  881. name, post, uninstall, version}}
  882. \texttt{\textcolor{blue}{src {[}, cygwin, macosx, other-architecture,
  883. \ldots{}]}}
  884. \subsubsection{In Directory \emph{src}}
  885. \texttt{\textcolor{green}{COPYING}}
  886. \texttt{\textcolor{green}{README}}
  887. \texttt{\textcolor{green}{REQUIREMENTS.HTML}}
  888. \texttt{\textcolor{green}{Makefile, config.guess, config.sub, onfigure,
  889. configure.in, install-sh}}
  890. \texttt{\textcolor{blue}{db, demolocation, display, general, imagery,
  891. include, lib, man, paint, ps, raster, raster3d, scripts, sites, tools,
  892. vector, visualization}}
  893. \subsection{Changes to the GRASS Make System Files}
  894. GEM exports three environment variables that point to the directories
  895. storing GRASS 6 headers and libs and to the install location (e.g.
  896. \emph{/usr/local/grass-6.3.cvs}):
  897. \texttt{GINSTALL\_INC}
  898. \texttt{GINSTALL\_LIB}
  899. \texttt{GINSTALL\_DST }
  900. These have been added to the makefiles so that externally compiled
  901. modules are able to see those GRASS headers and libs they need. Thus,
  902. the following files were slightly altered:
  903. \subsubsection{configure script}
  904. Everything that checks for optional system libraries and could cause
  905. configure to fail went out. This means that extensions that have to
  906. check for optional system libraries will have to re-add these checks.
  907. In summary print-out section at end of script: got rid of: \texttt{echo
  908. \char`\"{} Startup script in directory: \$\{bindir\}\char`\"{}}. And
  909. added some custom text that refers to the extension having been configured.
  910. \subsubsection{main Makefile}
  911. L28: \texttt{INST\_DIR} is set according to \texttt{GINSTALL\_DST}
  912. which is exported by GEM.
  913. L168: install target \texttt{real-install}: commented out everything
  914. that seems not strictly necessary for a module installation and might
  915. interfere with the user's GRASS installation. Now exits with error
  916. code {}``1'' on write permission problems. This can be caught by
  917. GEM and dealt with. Only creates \emph{error.log} if a module did
  918. not compile. This is used to check for compilation errors and abort,
  919. if necessary.
  920. L171: commented out stuff for creating GRASS startup script
  921. \subsubsection{include/Make/Grass.make.in}
  922. L32: added \texttt{-I\$(GINSTALL\_INC)} to \texttt{GRASS\_INC}
  923. L53: added \texttt{-L\$(GINSTALL\_LIB)} to \texttt{ARCH\_LIBPATH}
  924. L81: added \texttt{\$(GEM\_C\_OPTS)} to \texttt{CFLAGS}
  925. \subsubsection{include/Make/Rules.make}
  926. L37: the path to the HTML docs is now expanded with \emph{/extensions/<extensionName>.}
  927. The name for the extension is read from \texttt{GEM\_EXT\_NAME} which
  928. is exported by GEM
  929. L55: added \texttt{\$(GINSTALL\_LIB)} to definition of \texttt{LD\_LIBRARY\_PATH\_VAR}
  930. .
  931. L49: this now makes two different copies: one to go into the extension's
  932. HTML folder \emph{docs/\-extensions/\-\$(GEM\_EXT\_NAME)} and one
  933. -- with adjusted relative links -- to go into \emph{docs/html}. \texttt{GEM\_EXT\_NAME}
  934. is exported by the GEM installer tool
  935. \subsubsection{include/Shlib.make}
  936. L3: \texttt{SHLIB = \$(ARCH\_LIBDIR)/\$(SHLIB\_PREFIX)\$(SHLIB\_NAME).\$(GEM\_EXT\_VERSION)\$(SHLIB\_SUFFIX)}
  937. L14: \texttt{\$(SHLIB): \$(SHLIB\_OBJS) \$(SHLIB\_LD) -o \$@ \$(LDFLAGS)
  938. \$\textasciicircum{} \$(EXTRA\_LIBS) \&\& ln -sf \$(notdir \$@) \$(patsubst
  939. \%.\$(GEM\_EXT\_VERSION)\$(SHLIB\_SUFFIX),\%\$(SHLIB\_SUFFIX),\$@)}
  940. \texttt{GEM\_EXT\_VERSION} installs lib with version number as given
  941. in \emph{version} file in extension package.
  942. \subsubsection{lib/init/Makefile}
  943. L32: commented out everything that seems not strictly necessary for
  944. a module installation and might interfere with the user's GRASS installation.
  945. \subsubsection{build\_html\_index.sh }
  946. L16: expand HTML with \emph{/extensions/\$GEM\_EXT\_NAME} (exported
  947. by GEM). The HTML default text has been altered in many places to
  948. reflect its new function for describing extensions. GEM also exports
  949. the following variables to enrich the HTML default text: \texttt{GEM\_EXT\_VERSION}
  950. (extension's version number).
  951. \newpage{}
  952. \subsection{GEM Synopsis}
  953. \begin{lyxcode}
  954. Usage:~gem~{[}OPTION]~{[}ACTION]~{[}FILE|DIR]
  955. Possible~ACTIONs~are:
  956. ~~-i,~-{}-install~~~~~~~~~install~a~GRASS~extension
  957. ~~-u,~-{}-uninstall~~~~~~~remove~an~extension~from~GRASS
  958. ~~-q,~-{}-query~~~~~~~~~~~display~information~about~extension/list~installed
  959. ~~-d,~-{}-details~~~~~~~~~display~additional~details~about~an~extension
  960. ~~-c,~-{}-clean~~~~~~~~~~~clean~extension's~source~code~directories
  961. ~~-t,~-{}-test~~~~~~~~~~~~configure~and~compile~extension,~but~don't~install
  962. ~~-l,~-{}-license~~~~~~~~~show~copyright~information~for~an~extension
  963. ~~-r,~-{}-restore~~~~~~~~~recreate~HTML~links~and~GIS~Manager~entries
  964. ~~-h,~-{}-help~~~~~~~~~~~~display~this~help~and~exit
  965. ~~-V,~-{}-version~~~~~~~~~output~version~information~and~exit
  966. Possible~OPTIONs~are:
  967. ~~-g,~-{}-grass=PATH~~~~~~path~to~GRASS~installation~dir
  968. ~~-b,~-{}-binary=NAME~~~~~no~compilation:~use~binary~files~for~system~NAME
  969. ~~-f,~-{}-force~~~~~~~~~~~force~action,~regardless~of~dependencies
  970. ~~-v,~-{}-verbose~~~~~~~~~display~detailed~status~information
  971. ~~-s,~-{}-skip-config~~~~~skip~configure~script
  972. ~~-o,~-{}-options~~~~~~~~~options~to~pass~to~the~C~compiler/linker
  973. \newpage{}
  974. \end{lyxcode}
  975. \subsection{Current Bugs and Shortcomings}
  976. \begin{itemize}
  977. \item Operation under Cygwin only works in verbose mode (option -v)!
  978. \item querying installed extensions or trying to uninstall an extension
  979. on a system that never had an extension installed will simply segfault
  980. (missing extensions.db is not handled gracefully)
  981. \item Installation from an internet source currently quits with {}``shell-init:
  982. error retrieving current directory: getcwd: cannot access parent directories:
  983. No such file or directory'' (may leave some temp files around?)
  984. \item Binary installation mode is not exhaustively tested.
  985. \item The installation of menu items for the old \emph{d.m} GUI is very
  986. sensitive to the precise syntax of \emph{menu.tcl}. If the user has
  987. altered this file substantially it is likely that registering the
  988. extension submenu entries will fail.
  989. \item There is no clean way to upgrade an existing extension and respecting
  990. dependencies \emph{automatically}. You can use option {}``-f'' or
  991. {}``--force'' to force over-writing of an extension, but it is safer
  992. to uninstall first, then install the new version.
  993. \item GEM can only manage system-wide installations of extension. There
  994. is no support for location or mapset-wide management.
  995. \item path to GRASS dynamic libraries needs to be present in system-wider
  996. linker paths.
  997. \end{itemize}
  998. \end{document}