My favorites | Sign in
Logo
                
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<project name="BlueCove GPL" default="default" basedir=".">
<description>
Open source implementation of JSR-82 Java Bluetooth API. Additional GPL licensed module to support BlueCove runtime on Linux BlueZ
</description>

<!--
You may use to build the project
ant -Dbuild.compiler=jikes

You may skip adding shared library to jar file
ant -Dbluecove.native.resources.skip=true jar

You may change linker options if you need to
ant -Dbluecove.native.linker.options=
-->

<property name="product_version" value="2.1.1-SNAPSHOT"/>

<property name="bluecove_main_dist_dir" location="../bluecove/target"/>
<property name="bluecove_main_jar" location="${bluecove_main_dist_dir}/bluecove-${product_version}.jar"/>

<property name="basedir" value="."/>

<!-- set global properties for this build -->
<property name="src" location="src/main/java"/>
<property name="src_c" location="src/main/c"/>
<property name="resources" location="src/main/resources"/>
<property name="target" location="target"/>
<property name="build_classes" location="${target}/classes"/>
<property name="build_native" location="${target}/native"/>
<property name="dist" location="${target}"/>

<property name="libs-universal" value="${basedir}/libs-universal"/>

<property name="CC" value="gcc"/>
<property name="CC_compiler_options" value="-fPIC -fno-stack-protector"/>
<property name="bluecove.native.linker.options" value="-nodefaultlibs"/>

<target name="default" depends="compile, jni-headers, native-lib"/>

<target name="init-native">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build_classes}"/>
<mkdir dir="${build_native}"/>
<echo message="java.home ${java.home}"/>
<available property="java-home.exists" file="${java.home}" type="dir"/>
<antcall target="verify-java-home"/>
<antcall target="verify-cruisecontrol"/>
</target>

<target name="init" depends="init-native">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build_classes}"/>
<mkdir dir="${build_native}"/>
<mkdir dir="${resources}"/>
<available property="bluecove-main.exists" file="${bluecove_main_jar}" type="file"/>
<antcall target="verify-bluecove-main-exists"/>
</target>

<target name="verify-bluecove-main-exists" unless="bluecove-main.exists">
<fail>
The path "${bluecove_main_jar}" does not exist.
Download or build main BlueCove jar.
</fail>
</target>

<target name="verify-java-home" unless="java-home.exists">
<fail>
The path "${java.home}" does not exist.
</fail>
</target>

<target name="verify-cruisecontrol" unless="bluecove-main.exists">
<condition property="universal-bluez.not-found">
<and>
<equals arg1="${buildEnv}" arg2="cruisecontrol" />
<not>
<available property="universal-bluez.exists" file="${libs-universal}/libbluetooth.so" type="file"/>
</not>
</and>
</condition>
<fail if="universal-bluez.not-found">.
Expected libs directory [${libs-universal}].
The universal-bluez does not exist on build server.
</fail>
</target>

<target name="compile" depends="init"
description="Compile the source">

<echo message="compiling on java ${java.version}, OS ${os.name} ${os.version} ${os.arch}"/>
<javac source="1.3" target="1.1" debug="true"
srcdir="${src}" destdir="${build_classes}">
<classpath>
<pathelement path="${bluecove_main_jar}"/>
</classpath>
</javac>

</target>

<target name="jni-headers" depends="init" unless="jni_headers_skip"
description="Create JNI headers">

<echo message="create JNI headers using java.home ${java.home}"/>
<javah destdir="src/main/c" classpath="${build}">
<classpath>
<pathelement path="${build_classes}"/>
<pathelement path="${bluecove_main_jar}"/>
</classpath>
<class name="com.intel.bluetooth.BluetoothStackBlueZ"/>
<class name="com.intel.bluetooth.BluetoothStackBlueZConsts"/>
<class name="com.intel.bluetooth.BluetoothStackBlueZNativeTests"/>
</javah>

</target>

<target name="native-lib" depends="jni-headers, compile-native-lib"
description="Create Native shared library">
</target>

<target name="compile-native-lib" depends="init-native"
description="Create Native shared library">
<echo message="compiling .c -> .o (${CC_compiler_options})"/>

<apply executable="${CC}" dest="${build_native}" parallel="false" failonerror="true">
<arg line="${CC_compiler_options}"/>
<arg value="-I${java.home}/../include" />
<arg value="-I${java.home}/../include/linux" />
<arg value="-c"/>
<srcfile/>
<arg value="-o"/>
<targetfile/>
<fileset dir="${src_c}"/>
<mapper type='glob' from='*.c' to='*.o'/>
</apply>

<!-- i386 version does not have any sufix, See NativeLibLoader.java -->
<condition property="library_sufix" value="">
<os arch="i386"/>
</condition>
<condition property="library_sufix" value="">
<os arch="x86"/>
</condition>
<condition property="library_sufix" value="_x64">
<os arch="amd64"/>
</condition>
<condition property="library_sufix" value="_x64">
<os arch="x86_64"/>
</condition>
<condition property="library_sufix" value="_${os.arch}">
<not>
<isset property="library_sufix" />
</not>
</condition>

<property name="library_name" value="libbluecove${library_sufix}.so"/>

<echo message="linking .o -> ${library_name} (${bluecove.native.linker.options})"/>

<apply executable="${CC}" parallel="true" failonerror="true">
<arg value="-shared"/>
<!--
This is used on Build Server to create Universal binary
ldd libbluecove.so
linux-gate.so.1 =>
libbluetooth.so =>
The directory should contain libbluetooth.so binary edited to remove version from name e.g.
libbluetooth.so.2 -> libbluetooth.so
libbluetooth.so.3 -> libbluetooth.so
-->
<arg value="-L${libs-universal}"/>
<arg value="-lbluetooth"/>
<arg line="${bluecove.native.linker.options}"/>
<arg value="-Wl,-soname,libbluecove${library_sufix}-${product_version}"/>
<arg value="-o"/>
<arg value="${target}/${library_name}"/>
<fileset dir='${build_native}' includes="*.o"/>
<srcfile/>
</apply>

<echo message="ldd ${library_name}"/>
<exec executable="ldd" failonerror="true">
<arg value="-v"/>
<arg value="${target}/${library_name}"/>
</exec>

<antcall target="native-lib-resources"/>

</target>

<target name="native-lib-resources" unless="bluecove.native.resources.skip">
<copy file="${target}/${library_name}" todir="${resources}"/>
<copy file="${target}/${library_name}" todir="${build_classes}"/>
</target>

<target name="jar" depends="compile, native-lib"
description="Create the distribution jar">

<!-- Create the distribution directory -->
<mkdir dir="${dist}"/>

<tstamp>
<format property="today" pattern="yyyy-MM-dd hh:mm:ss" />
</tstamp>

<!-- Put everything in ${build} into the BlueCove-${DSTAMP}.jar file -->
<jar jarfile="${dist}/bluecove-gpl-${product_version}.jar">
<manifest>
<attribute name="Description" value="BlueCove JSR-82 implementation, runtime module for Linux BlueZ"/>
<attribute name="License" value="GNU General Public License (GPL)"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Implementation-Version" value="${product_version}"/>
<attribute name="Build-Date" value="${today}"/>
<attribute name="Build-Jdk" value="${java.runtime.version}"/>
<attribute name="Build-Platform" value="${os.arch} ${os.name} ${os.version}"/>
</manifest>
<fileset dir="${build_classes}">
<include name="**/*.class"/>
<exclude name="**/*.log"/>
<exclude name="**/.*"/>
<exclude name="**/Thumbs.db"/>
</fileset>
<fileset dir="${resources}">
<include name="*.so"/>
</fileset>
<fileset dir=".">
<include name="LICENSE.txt"/>
</fileset>
</jar>
</target>

<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>

<target name="all" depends="clean, jar"/>
</project>
Show details Hide details

Change log

r2923 by skarzhevskyy on Mar 14, 2009   Diff
Updated manifest creation using ant
Go to: 
Project members, sign in to write a code review

Older revisions

r2913 by skarzhevskyy on Mar 13, 2009   Diff
create resources since they are no
longer in svn
r2710 by skarzhevskyy on Jan 17, 2009   Diff
commit echo options during build
r2709 by skarzhevskyy on Jan 17, 2009   Diff
add soname
All revisions of this file

File info

Size: 9584 bytes, 242 lines

File properties

svn:mergeinfo
svn:mime-type
text/xml
svn:eol-style
native
svn:keywords
Date Author Id Revision
Hosted by Google Code