forked from Unidata/UDUNITS-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
184 lines (164 loc) · 4.34 KB
/
build.gradle
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
180
181
182
183
184
apply plugin: 'cpp'
//apply plugin: 'cpp-lib'
//apply plugin: 'cpp-exe'
version = '2.1.25'
group = 'edu.ucar.unidata'
description = "Units of Physical Quantities"
/*
* Apparently, there is no Maven repository for the Expat development package;
* consequently, the dependency on that package is explicitly managed.
*/
task checkExpat(type: Exec) {
ignoreExitValue = true
standardOutput = new ByteArrayOutputStream()
commandLine 'yum', 'info', 'expat-devel'
}
task ensureExpat(type: Exec, dependsOn: 'checkExpat') {
onlyIf {
checkExpat.execResult.getExitValue() != 0
}
commandLine 'yum', 'install', 'expat-devel'
}
/*
* Build the HTML documentation from texinfo(5) files.
*/
task ensureLibHtml(type: Exec) {
onlyIf { !new File("src/lib/udunits2lib.html").exists() }
workingDir "src/lib"
commandLine 'makeinfo', '--html', '--no-split', '-o', 'udunits2lib.html', 'udunits2lib.texi'
}
task ensureProgHtml(type: Exec) {
onlyIf { !new File("src/prog/udunits2prog.html").exists() }
workingDir "src/prog"
commandLine 'makeinfo', '--html', '--no-split', '-o', 'udunits2prog.html', 'udunits2prog.texi'
}
task ensureHtml(type: Exec, dependsOn: ['ensureLibHtml', 'ensureProgHtml']) {
onlyIf { !new File("src/udunits2.html").exists() }
workingDir "src"
commandLine 'makeinfo', '--html', '--no-split', '-o', 'udunits2.html', 'udunits2.texi'
}
/*
* Build the parser of unit specifications from yacc(1) and lex(1) input.
*/
task parser(type: Exec) {
onlyIf { !new File("src/lib/parser.c").exists() }
workingDir "src/lib"
commandLine 'bison', '-t', '-p', 'ut', '-o', 'parser.c', 'parser.y'
}
task scanner(type: Exec) {
onlyIf { !new File("src/lib/scanner.c").exists() }
workingDir "src/lib"
commandLine 'flex', '-d', '-P', 'ut', '-o', 'scanner.c', 'scanner.l'
}
sources {
lib {
c {
source {
srcDirs = ["src/lib"]
include "*.c"
exclude "scanner.c", "test*.c"
}
exportedHeaders {
srcDirs = ["src/lib"]
include "udunits.h"
include "udunits2.h"
include "converter.h"
}
}
}
exe {
c {
source {
srcDirs = ["src/prog"]
include "*.c"
}
}
}
}
libCExtractHeaders.dependsOn parser
libCExtractHeaders.dependsOn scanner
libraries {
main {
source sources.lib
binaries.all {
compilerArgs "-DDEFAULT_UDUNITS2_XML_PATH=\"${projectDir}" +
'/share/udunits/udunits2.xml"'
}
}
}
/*
* The following dependency requires use of "afterEvaluate" because the task
* "mainSharedLibrary" doesn't exist until after this entire file is parsed
* and then the "sources" section is evaluated.
*/
afterEvaluate {
mainSharedLibrary.dependsOn ensureExpat
}
executables {
main {
source sources.exe
binaries.all {
lib libraries.main.shared
compilerArgs "-I" + projectDir.toString() + "/src/lib"
linkerArgs "-lexpat"
}
}
}
def libTask = "${name}SharedLibrary"
task "installLib"(dependsOn: "mainSharedLibrary", type: Copy) {
from "${buildDir}/binaries/$libTask"
into "lib"
}
task installHeaders(type: Copy) {
from "${rootDir}/src/lib"
include "udunits.h"
include "udunits2.h"
include "converter.h"
into "include"
}
task installDatabase(type: Copy) {
from "${rootDir}/src/lib"
include "*.xml"
into "share/udunits"
}
task installLibHtml(type: Copy, dependsOn: 'ensureLibHtml') {
from "${rootDir}/src/lib"
include "*.html"
into "share/doc/udunits"
}
task installProgHtml(type: Copy, dependsOn: 'ensureProgHtml') {
from "${rootDir}/src/prog"
include "*.html"
into "share/doc/udunits"
}
task installHtml(type: Copy, dependsOn: ['ensureHtml', "installLibHtml", "installProgHtml"]) {
from "${rootDir}/src"
include "*.html"
into "share/doc/udunits"
}
task "installProg"(dependsOn: "installMainExecutable", type: Copy) {
from "${buildDir}/install/${name}Executable"
into "bin"
}
task install(dependsOn: ["installLib",
"installHeaders", "installDatabase", "installProg", "installHtml"]) {
}
apply plugin: 'maven'
/*
dependencies {
archives
}
*/
uploadArchives {
repositories {
mavenDeployer {
repository(url: uri("${buildDir}/repo"))
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = "1.9-20130910220037+0000"
//gradleVersion = "1.9-20130903235553+0000"
//gradleVersion = "1.9-20130829220030+0000"
//gradleVersion = "1.9-20130825220029+0000"
}