Code

better compilation for linux
[inkscape.git] / build-lx.xml
1 <!--
2  * Inkscape build file.
3  *
4  * See buildtool.cpp for use.
5  *
6  * Authors:
7  *   Bob Jamison
8  *   Others 
9  *
10  * Copyright (C) 2006-2008 Inkscape.org
11  *
12  *  This library is free software; you can redistribute it and/or
13  *  modify it under the terms of the GNU Lesser General Public
14  *  License as published by the Free Software Foundation; either
15  *  version 2.1 of the License, or (at your option) any later version.
16  *
17  *  This library is distributed in the hope that it will be useful,
18  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  *  Lesser General Public License for more details.
21  *
22  *  You should have received a copy of the GNU Lesser General Public
23  *  License along with this library; if not, write to the Free Software
24  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
25 -->
29 <!--
30 ########################################################################
31 ## P R O J E C T   :   I N K S C A P E
32 ########################################################################
33 -->
34 <project name="Inkscape" default="dist" basedir=".">
35     <description>
36         Build file for the Inkscape SVG editor.  This version
37         is configured for Unix/Linux, but hopefully we can merge 
38         in the future.
39     </description>
41   <!-- set global properties for this build -->
42   <property name="version"       value="0.46+devel"/>
43   <property name="src"           location="src"/>
44   <property name="lib"           location="lib"/>
45   <property name="build"         location="build"/>
46   <property name="dist"          location="inkscape"/>
48   <!-- Use these settings for Unix -->  
49   <!-- -->
50   <property name="arch"          value=""/>
51   <property name="archutil"      value=""/>
52   <property name="devlibs"       location="/usr"/>
53   <property name="datadir"       location="${dist}/share"/>
55    <!-- -->
57   <!-- Use these settings for the MinGW native compiler -->  
58   <!--
59   <property name="arch"          value="mingw32-"/>
60   <property name="archutil"      value=""/>
61   <property name="devlibs"       location="c:/devlibs"/>
62   -->
64   <!-- Use these settings for the MinGW cross compiler -->  
65   <!--
66   <property name="arch"          value="i686-pc-mingw32-"/>
67   <property name="archutil"      value="${arch}"/>
68   <property name="gtk"           location="/target"/>
69   -->
71   <!-- Extra properties -->  
72   <property name="refresh"       value="false"/>
74   <!--
75     This is for package-config.  With these two settings, pkg-config
76     queries can be as simple as ${pcc.packageName} for cflags, and
77     ${pcl.packageName} for libs.  Dependencies are calculated automatically.
78   -->
79   <property name="pkg-config-path"   location="${devlibs}/lib/pkgconfig"/>
80   <property name="pkg-config-prefix" location="${devlibs}"/>
83   <!--
84   ########################################################################
85   ## T A R G E T    :    I N I T
86   ########################################################################
87   -->
88   <target name="init"
89       description=
90       "Do all preparatory tasks, like make directories and copy files">
93     <mkdir dir="${build}"/>
94     <mkdir dir="${build}/java"/>
95     <mkdir dir="${build}/java/classes"/>
96     <mkdir dir="${build}/java/lib"/>
98     <mkdir dir="${build}"/>
99     <mkdir dir="${dist}"/>
100     <copy file="${src}/helper/sp-marshal.h.mingw"
101           tofile="${src}/helper/sp-marshal.h"/>
102     <copy file="${src}/helper/sp-marshal.cpp.mingw"
103           tofile="${src}/helper/sp-marshal.cpp"/>
104     <makefile file="inkscape_version.h">
105         #define INKSCAPE_VERSION "${version}"
106     </makefile>
107     <makefile file="config.h">
108         #ifndef _CONFIG_H_
109         #define _CONFIG_H_
111         /*######################################
112         ## This is for require-config.h, whose
113         ## purpose I cannot fathom.
114         ######################################*/
115         
116         #define PACKAGE_TARNAME
118         /*######################################
119         #### RESOURCE DIRECTORIES
120         ######################################*/
122         #define INKSCAPE_DATADIR       "."
123         #define PACKAGE_LOCALE_DIR     "locale"
126         /*######################################
127         #### OTHER DEFINITIONS
128         ######################################*/
130         #define GETTEXT_PACKAGE "inkscape"
132         #define PACKAGE_STRING                VERSION
134         #define HAVE_GETOPT_H                 1
135         #define HAVE_STRING_H                 1
136         #define HAVE_LIBINTL_H                1
137         #define HAVE_MALLOC_H                 1
138         #define HAVE_STDLIB_H                 1
139         #define HAVE_SYS_STAT_H               1
140         #define HAVE_INTTYPES_H               1
141         #define HAVE_ZLIB_H                   1
143         #define ENABLE_LCMS                   1
145         #define ENABLE_NLS                    1
146         #define HAVE_BIND_TEXTDOMAIN_CODESET  1
148         /* make us relocatable */
149         #define BR_PTHREADS                   1
150         #define ENABLE_BINRELOC               1
152         /* CairoPDF options */
153         #define HAVE_CAIRO_PDF                1
154         #define PANGO_ENABLE_ENGINE           1
155         #define RENDER_WITH_PANGO_CAIRO       1
157         #define HAVE_GTK_WINDOW_FULLSCREEN    1
158         
159         /* internal interpreter */
160         #define WITH_PYTHON                   1
162         /* shared whiteboard */
163         #define WITH_INKBOARD                 1
164         #define HAVE_SSL                      1
165         
166         /* use poppler for pdf import? */
167         #define HAVE_POPPLER                  1
168         #define HAVE_POPPLER_CAIRO            1
170         /* do we want bitmap manipulation? */
171         #define WITH_IMAGE_MAGICK             1
173         /* Allow reading WordPerfect? */
174         #define WITH_LIBWPG                   1
176         #endif /* _CONFIG_H_ */
177     </makefile>
178   </target>
182   <!--
183   ########################################################################
184   ## T A R G E T    :    T O U C H A B O U T
185   ########################################################################
186   -->
187   <target name="touchabout"
188       description="update the modification time of aboutdialog.cpp">
189     <!-- not good <touch file="${src}/ui/dialog/aboutdialog.cpp"/> -->
190     <!-- better -->
191     <delete file="${build}/obj/ui/dialog/aboutdialog.o"/>
192   </target>
195   <!--
196   ########################################################################
197   ## T A R G E T    :    C O M P I L E
198   ########################################################################
199   -->
200   <target name="compile" depends="init"
201         description="compile the source to .o" >
203     <!-- Compile from source to build -->
204     <cc cc="${arch}gcc" cxx="${arch}g++"
205              destdir="${build}/obj"
206                          continueOnError="false"
207                          refreshCache="${refresh}">
208         <fileset dir="${src}">
209             <!-- THINGS TO EXCLUDE -->
210             <exclude name="2geom/chebyshev.cpp"/>
211             <exclude name="ast/.*"/>
212             <exclude name="bonobo/.*"/>
213             <exclude name="deptool.cpp"/>
214             <exclude name="test-all.cpp"/>
215             <exclude name="display/testnr.cpp"/>
216             <exclude name="display/bezier-utils-test.cpp"/>
217             <exclude name="dom/work/.*"/>
218             <exclude name="dom/odf/SvgOdg.cpp"/>
219             <exclude name="extension/api.cpp"/>
220             <exclude name="extension/dxf2svg/.*"/>
221             <exclude name="extension/implementation/plugin.cpp"/>
222             <exclude name="extension/script/bindtest.cpp"/>
223             <exclude name="extension/script/cpptest.cpp"/>
224             <exclude name="extension/plugin/.*"/>
225             <exclude name="extract-uri-test.cpp"/>
226             <exclude name="helper/units-test.cpp"/>
227             <!-- exclude name="inkview.cpp"/-->
228             <exclude name="libnr/test-nr.cpp"/>
229             <exclude name="libnr/test-nr-main.cpp"/>
230             <exclude name="libnr/testnr.cpp"/>
231             <exclude name="libnr/in-svg-plane-test.cpp"/>
232             <exclude name="libnr/nr-compose-reference.cpp"/>
233             <exclude name="libnr/nr-compose-test.cpp"/>
234             <exclude name="libnr/nr-matrix-test.cpp"/>
235             <exclude name="libnr/nr-point-fns-test.cpp"/>
236             <exclude name="libnr/nr-rotate-fns-test.cpp"/>
237             <exclude name="libnr/nr-rotate-test.cpp"/>
238             <exclude name="libnr/nr-scale-test.cpp"/>
239             <exclude name="libnr/nr-translate-test.cpp"/>
240             <exclude name="libnr/nr-types-test.cpp"/>
241             <exclude name="livarot/Path-test.cpp"/>
242             <exclude name="mod360-test.cpp"/>
243             <exclude name="trace/potrace/potest.cpp"/>
244             <exclude name="round-test.cpp"/>
245             <exclude name="sp-gradient-test.cpp"/>
246             <exclude name="svg/ftos.cpp"/>
247             <exclude name="svg/test-svg.cpp"/>
248             <exclude name="svg/test-svg-main.cpp"/>
249             <exclude name="utest/.*"/>
250             <exclude name="widgets/test-widgets.cpp"/>
251             <exclude name="xml/quote-test.cpp"/>
252             <exclude name="xml/repr-action-test.cpp"/>
253             <exclude name="xml/test-xml.cpp"/>
254             <exclude name="xml/test-xml-main.cpp"/>
255             <exclude name="io/streamtest.cpp"/>
256             <!--JABBER-->
257             <exclude name="pedro/pedrogui.cpp"/>
258             <exclude name="pedro/pedrogui.h"/>
259             <exclude name="pedro/work/.*"/>
260             <!--WHITEBOARD-->
261             <exclude name="ui/dialog/session-player.cpp"/>
262             <exclude name="ui/dialog/whiteboard-connect.cpp"/>
263             <exclude name="ui/dialog/whiteboard-sharewithchat.cpp"/>
264             <exclude name="ui/dialog/whiteboard-sharewithuser.cpp"/>
265             <exclude name="dialogs/whiteboard-connect-dialog.cpp"/>
266             <exclude name="dialogs/whiteboard-common-dialog.cpp"/>
267             <exclude name="dialogs/whiteboard-sharewithchat-dialog.cpp"/>
268             <exclude name="dialogs/whiteboard-sharewithuser-dialog.cpp"/>
269             <exclude name="jabber_whiteboard/node-tracker.cpp"/>
270             <exclude name="jabber_whiteboard/node-utilities.cpp"/>
271             <!--OVERLAP-->
272             <exclude name="removeoverlap/placement_SolveVPSC.cpp"/>
273             <exclude name="removeoverlap/placement_SolveVPSC.h"/>
274             <exclude name="removeoverlap/test.cpp"/>
275             <exclude name="removeoverlap/remove_rectangle_overlap-test.cpp"/>
276             <exclude name="removeoverlap/remove_rectangle_overlap-test.h"/>
277             <!--WIN32 -->
278             <exclude name="registrytool.cpp"/>
279             <exclude name="extension/internal/win32.cpp"/>
280             <exclude name="libgdl/gdl-win32.c"/>
281         </fileset>
282         <excludeinc dir="${src}">
283             <file name="extension/param"/>
284         </excludeinc>
285         <flags>
286             -Wall -Wformat -Werror=format-security -W -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch
287             -O2 -g
288             -mms-bitfields
289         </flags>
290         <defines>
291             -DVERSION=\"${version}\"
292             -DHAVE_CONFIG_H
293             -D_INTL_REDIRECT_INLINE
294             -DHAVE_SSL
295             -DRELAYTOOL_SSL="static const int libssl_is_present=1; static int __attribute__((unused)) libssl_symbol_is_present(char *s){ return 1; }" <!-- inkboard -->
296         </defines>
297         <includes>
298             -I${devlibs}/include
299             <!-- GTK / GTKMM -->
300             ${pcc.gtkmm-2.4}
301             <!-- OTHER -->
302             -I${devlibs}/include/libxml2 
303             ${pcc.freetype2}
304             ${pcc.cairo}
305             ${pcc.poppler}
306             -I${devlibs}/include/gc
307             -I${devlibs}/include/libwpg-0.1
308             -I${devlibs}/include/libwpd-0.8
309             <!-- PERL -->
310             <!-- -Wno-comment -I${devlibs}/perl/lib/CORE -->
311             <!-- PYTHON -->
312             -I${devlibs}/python/include
313             <!-- JAVA -->
314             -I${src}/bind/javainc -I${src}/bind/javainc/linux
315         </includes>
316     </cc>
317   </target>
318   
320   <!--
321   ########################################################################
322   ## T A R G E T    :    L I B
323   ########################################################################
324   -->
325   <target name="lib" depends="compile"
326       description="create a static library">
327     <staticlib command="${archutil}ar crsv"
328            file="${build}/libinkscape.a">
329        <fileset dir="${build}/obj">
330            <exclude name="main.o"/>
331            <exclude name="winmain.o"/>
332            <exclude name="inkview.o"/>
333        </fileset>
334     </staticlib>
335   </target>
339   <!--
340   ########################################################################
341   ## T A R G E T    :    I 1 8 N
342   ########################################################################
343   -->
344   <target name="i18n" depends="compile"
345       description="compile gettext .po files to .mo">
347     <msgfmt todir="${build}/locale" owndir="true"
348          out="LC_MESSAGES/inkscape.mo">
349        <fileset dir="po">
350        </fileset>
351     </msgfmt>
352   </target>
358   <!--
359   ########################################################################
360   ## T A R G E T    :    L I N K
361   ########################################################################
362   -->
363   <target name="link" depends="lib"
364       description="link objects and library to create executable">
366     <link command="${arch}g++" out="${build}/inkscape"
367               strip="true" symfile="${build}/inkscape.dbg"
368               stripcommand="${archutil}strip"
369               objcopycommand="${archutil}objcopy">
370        <flags>
371        </flags>
372        <fileset dir="${build}">
373            <include name="obj/main.o"/>
374            <include name="libinkscape.a"/>
375        </fileset>
376        <libs>
377           -L${devlibs}/lib
378            ${pcl.poppler} ${pcl.poppler-cairo} ${pcl.poppler-glib}
379            ${pcl.gtkmm-2.4}
380            ${pcl.cairo} ${pcl.cairomm-1.0}
381            ${pcl.gthread-2.0}
382            -lxml2 -lxslt
383            -lwpg-0.1 -lwpg-stream-0.1
384            ${pcl.ImageMagick++}
385            ${pcl.fontconfig} ${pcl.freetype2}
386            ${pcl.lcms}
387            ${pcl.gsl}
388            -lssl -lcrypto
389            -lpng -ljpeg -ltiff -lpopt -lz
390            -lgc
391            -lm
392            <!-- 2geom -->
393            <!-- -l2geom -->
394        </libs>
395     </link>
396   </target>
397   
402   <!--
403   ########################################################################
404   ## T A R G E T    :    L I N K I N K V I E W
405   ########################################################################
406   -->
407   <target name="linkinkview" depends="lib"
408         description="link objects and library to create Inkview executable">
410     <link command="${arch}g++" out="${build}/inkview"
411               strip="true" symfile="${build}/inkview.dbg"
412               stripcommand="${archutil}strip"
413               objcopycommand="${archutil}objcopy">
414        <flags>
415        </flags>
416        <fileset dir="${build}">
417            <include name="obj/inkview.o"/>
418            <include name="libinkscape.a"/>
419        </fileset>
420        <libs>
421            -L${devlibs}/lib
422            ${pcl.poppler}
423            ${pcl.gtkmm-2.4}
424            ${pcl.cairo} ${pcl.cairomm-1.0}
425            <!-- PERL -->
426            -L${devlibs}/perl/lib/CORE -lperl58
427            <!-- PYTHON -->
428            -L${devlibs}/python/libs -lpython25
429            -lxml2 -lxslt
430            -lwpg-0.1 -lwpg-stream-0.1
431            ${pcl.ImageMagick++}
432            ${pcl.fontconfig} ${pcl.freetype2}
433            ${pcl.lcms}
434            -lssl -lcrypto
435            -lpng -ljpeg -ltiff -lpopt -lz
436            -lgc
437            -lintl -liconv -lm
438        </libs>
439     </link>
440   </target>
444   <!--
445   ########################################################################
446   ## T A R G E T    :    D I S T
447   ########################################################################
448   -->
449   <target name="dist" depends="link,i18n"
450       description="generate the distribution directory with all needed files">
452     <!-- Create the distribution directory -->
453     <mkdir dir="${dist}/bin"/>
454     <mkdir dir="${dist}/lib"/>
456     <!-- Copy Inkscape files -->
457     <copy file="${build}/inkscape"     todir="${dist}/bin"/>
458     <copy file="${build}/inkscape.dbg" todir="${dist}/bin"/>
459     <copy file="AUTHORS"               todir="${dist}"/>
460     <copy file="COPYING"               todir="${dist}"/>
461     <copy file="COPYING.LIB"           todir="${dist}"/>
462     <copy file="NEWS"                  todir="${dist}"/>
463     <copy file="README"                todir="${dist}"/>
464     <copy file="TRANSLATORS"           todir="${dist}"/>
465     <copy todir="${datadir}/inkscape">  
466         <fileset dir="share/clipart"> <exclude name=".*\.am"/> </fileset>
467     </copy>
468     <copy todir="${datadir}/inkscape">  
469         <fileset dir="share/examples"> <exclude name=".*\.am"/> </fileset>
470     </copy>
471     <copy todir="${datadir}/inkscape">  
472         <fileset dir="share/extensions"> <exclude name=".*\.am"/> </fileset>
473     </copy>
474     <copy todir="${datadir}/inkscape">  
475         <fileset dir="share/fonts"> <exclude name=".*\.am"/> </fileset>
476     </copy>
477     <copy todir="${datadir}/inkscape">  
478         <fileset dir="share/gradients"> <exclude name=".*\.am"/> </fileset>
479     </copy>
480     <copy todir="${datadir}/inkscape">  
481         <fileset dir="share/icons"> <exclude name=".*\.am"/> </fileset>
482     </copy>
483     <copy todir="${datadir}/inkscape">  
484         <fileset dir="share/keys"> <exclude name=".*\.am"/> </fileset>
485     </copy>
486     <copy todir="${datadir}/inkscape">  
487         <fileset dir="share/markers"> <exclude name=".*\.am"/> </fileset>
488     </copy>
489     <copy todir="${datadir}/inkscape">  
490         <fileset dir="share/palettes"> <exclude name=".*\.am"/> </fileset>
491     </copy>
492     <copy todir="${datadir}/inkscape">  
493         <fileset dir="share/patterns"> <exclude name=".*\.am"/> </fileset>
494     </copy>
495     <copy todir="${datadir}/inkscape">  
496         <fileset dir="share/screens"> <exclude name=".*\.am"/> </fileset>
497     </copy>
498     <copy todir="${datadir}/inkscape">  
499         <fileset dir="share/templates"> <exclude name=".*\.am"/> </fileset>
500     </copy>
501     <copy todir="${datadir}/inkscape">  
502         <fileset dir="share/tutorials"> <exclude name=".*\.am"/> </fileset>
503     </copy>
504     <copy todir="${datadir}/inkscape">  
505         <fileset dir="share/ui"> <exclude name=".*\.am"/> </fileset>
506     </copy>
507     <copy todir="${datadir}">
508         <fileset dir="${build}/locale"> <exclude name=".*\.am"/> </fileset>
509     </copy>
511     <!-- Copy devlibs files -->
514   </target>
517   <!--
518   ########################################################################
519   ## T A R G E T    :    JAVAC
520   ########################################################################
521   -->
522   <target name="javac" depends="init"
523       description="compile java binding classes">
524     <javac srcdir="${src}/bind/java" destdir="${build}/java/classes"/>
525   </target>
528   <!--
529   ########################################################################
530   ## T A R G E T    :    JAR
531   ########################################################################
532   -->
533   <target name="jar" depends="javac"
534       description="pack java classes and resources into a jar file">
535     <copy todir="${build}/java/classes"> <fileset dir="bind/data"/></copy>
536     <jar basedir="${build}/java/classes" destfile="${build}/java/lib/inkscape.jar"/>
537   </target>
539   <!--
540   ########################################################################
541   ## T A R G E T    :    BINDDIST
542   ########################################################################
543   -->
544   <target name="binddist" depends="jar"
545       description="pack java classes and resources into a jar file">
546     <copy todir="${datadir}/inkscape/bind">      <fileset dir="bind/java"/> </copy>
547     <copy todir="${datadir}/inkscape/bind/java"> <fileset dir="${build}/java/lib"/>    </copy>
549   </target>
551   <!--
552   ########################################################################
553   ## T A R G E T    :    BINDCLEAN
554   ########################################################################
555   -->
556   <target name="bindclean" depends=""
557       description="clean up java binding classes">
558         <delete dir="${build}/java"/>
559   </target>
564   <!--
565   ########################################################################
566   ## T A R G E T    :    D I S T - A L L
567   ########################################################################
568   -->
569   <target name="dist-all" depends="dist"
570         description="generate the distribution, along with inkview" >
572     <copy file="${build}/inkview"     todir="${dist}/bin"/>
573     <copy file="${build}/inkview.dbg" todir="${dist}/bin"/>
575   </target>
581   <!--
582   ########################################################################
583   ## T A R G E T    :    C L E A N
584   ########################################################################
585   -->
586   <target name="clean" depends="bindclean"
587         description="clean up.  deleting build and distro dirs" >
589     <delete dir="${build}"/>
590     <delete dir="${dist}"/>
591     <delete file="build.dep"/>
592     <delete file="config.h"/>
594   </target>
598 </project>
599 <!--
600 ########################################################################
601 ## E N D
602 ########################################################################
603 -->