source: grass-addons/tools/addons/compile.sh

Last change on this file was 71528, checked in by martinl, 7 years ago

addons build scripts: grass-addons renamed to grass_addons (publish)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:mime-type set to text/x-sh
File size: 3.4 KB
Line 
1#!/bin/sh
2
3# This script compiles GRASS Addons, it's called by compile-xml.sh.
4
5if [ -z "$3" ]; then
6 echo "usage: $0 svn_path topdir addons_path [separate]"
7 echo "eg. $0 ~/src/grass_addons/grass7/ ~/src/grass_trunk/dist.x86_64-pc-linux-gnu ~/.grass7/addons"
8 exit 1
9fi
10
11SVN_PATH="$1"
12TOPDIR="$2"
13ADDON_PATH="$3"
14GRASS_VERSION=`echo -n ${SVN_PATH} | tail -c 1`
15INDEX_FILE="index"
16
17if [ ! -d "$3" ] ; then
18 mkdir -p "$3"
19fi
20
21if [ -n "$4" ] ; then
22 SEP=1 # useful for collecting files (see build-xml.py)
23else
24 SEP=0
25fi
26
27if [ `uname -m` = "x86_64" ] ; then
28 PLATFORM=x86_64
29else
30 PLATFORM=x86
31fi
32
33rm -rf "$ADDON_PATH"
34mkdir "$ADDON_PATH"
35
36cd "$SVN_PATH"
37
38date=`date -R`
39uname=`uname`
40mkdir "$ADDON_PATH/logs"
41touch "$ADDON_PATH/logs/${INDEX_FILE}.log"
42echo "<!--<?xml-stylesheet href=\"style.css\" type=\"text/css\"?>-->
43<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"
44 \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">
45
46<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" >
47
48<head>
49<meta http-equiv=\"Content-Type\" content=\"application/xhtml+xml; charset=utf-8\" />
50<title>GRASS $ADDON_PATH AddOns Logs ($PLATFORM)</title>
51<style type=\"text/css\">
52h1 { font-size: 125%; font-weight: bold; }
53table
54{
55border-collapse:collapse;
56}
57table,th, td
58{
59border: 1px solid black;
60}
61</style>
62</head>
63<body>
64<h1>GRASS $GRASS_VERSION AddOns ($PLATFORM) / $uname (logs generated $date)</h1>
65<hr />
66<table cellpadding=\"5\">
67<tr><th style=\"background-color: grey\">AddOns</th>
68<th style=\"background-color: grey\">Status</th>
69<th style=\"background-color: grey\">Log file</th></tr>" > "$ADDON_PATH/logs/${INDEX_FILE}.html"
70
71echo "-----------------------------------------------------"
72echo "AddOns '$ADDON_PATH'..."
73echo "-----------------------------------------------------"
74
75pwd=`pwd`
76# .. "hadoop"
77# from ../../grass7/
78for c in "db" "display" "general" "gui/wxpython" "imagery" "misc" "raster" "raster3d" "temporal" "vector" ; do
79 if [ ! -d $c ]; then
80 continue
81 fi
82 cd $c
83 for m in `ls -d */Makefile 2>/dev/null` ; do
84 m="${m%%/Makefile}"
85 echo -n "Compiling $m..."
86 cd "$m"
87 if [ $SEP -eq 1 ] ; then
88 path="$ADDON_PATH/$m"
89 else
90 path="$ADDON_PATH"
91 fi
92
93 export GRASS_ADDON_BASE=$path
94 echo "<tr><td><tt>$c/$m</tt></td>" >> "$ADDON_PATH/logs/${INDEX_FILE}.html"
95 make MODULE_TOPDIR="$TOPDIR" clean > /dev/null 2>&1
96 make MODULE_TOPDIR="$TOPDIR" \
97 BIN="$path/bin" \
98 HTMLDIR="$path/docs/html" \
99 MANBASEDIR="$path/docs/man/man1" \
100 SCRIPTDIR="$path/scripts" \
101 ETC="$path/etc" \
102 SOURCE_URL="https://trac.osgeo.org/grass/browser/grass-addons/grass${GRASS_VERSION}/" > \
103 "$ADDON_PATH/logs/$m.log" 2>&1
104 if [ `echo $?` -eq 0 ] ; then
105 printf "%-30s%s\n" "$c/$m" "SUCCESS" >> "$ADDON_PATH/logs/${INDEX_FILE}.log"
106 echo " SUCCESS"
107 echo "<td style=\"background-color: green\">SUCCESS</td>" >> "$ADDON_PATH/logs/${INDEX_FILE}.html"
108 else
109 printf "%-30s%s\n" "$c/$m" "FAILED" >> "$ADDON_PATH/logs/${INDEX_FILE}.log"
110 echo " FAILED"
111 echo "<td style=\"background-color: red\">FAILED</td>" >> "$ADDON_PATH/logs/${INDEX_FILE}.html"
112 fi
113 echo "<td><a href=\"$m.log\">log</a></td></tr>" >> "$ADDON_PATH/logs/${INDEX_FILE}.html"
114 cd ..
115 done
116 cd $pwd
117 unset GRASS_ADDON_BASE
118done
119
120echo "</table><hr />
121<div style=\"text-align: right\">Valid: <a href=\"http://validator.w3.org/check/referer\">XHTML</a></div>
122</body></html>" >> "$ADDON_PATH/logs/${INDEX_FILE}.html"
123
124exit 0
Note: See TracBrowser for help on using the repository browser.