Mercurial > projects > doodle
comparison configure.d @ 134:89e8b0d92f36
Ported to bob2 !!!
author | David Bryant <bagnose@gmail.com> |
---|---|
date | Thu, 02 Aug 2012 17:20:52 +0930 |
parents | 9e1a313d8003 |
children | be50d20643a1 |
comparison
equal
deleted
inserted
replaced
133:9e1a313d8003 | 134:89e8b0d92f36 |
---|---|
1 // Configure script, to be run with rdmd. | |
2 // | 1 // |
3 // Checks dependencies, sets up a build directory, builds | 2 // Configure script for the reuse repo |
4 // a local copy of the builder into the build directory, | |
5 // and puts assorted scripts into the build directory to | |
6 // facilitate building. | |
7 // | |
8 // If your project depends on installed libraries, you need to | |
9 // add an options file containing command-line options such as: | |
10 // -L-lgtkd | |
11 // You also need to install the libraries somewhere that the compiler | |
12 // can find them. Two simple options are: | |
13 // * In the dmd installation directory, or | |
14 // * Elsewhere, and edit dmd.conf to point to there. | |
15 // | |
16 // | |
17 // The source paths you depend on need to be listed in a uses file. | |
18 // Uses files are not transitive - only the one in the directory | |
19 // you execute the configure script applies. | |
20 // | |
21 // Usage: rdmd configure.d <target-path> | |
22 // | |
23 // eg: rdmd configure.d ~/builds/myproject | |
24 // | 3 // |
25 | 4 |
5 import configure_functions; | |
26 | 6 |
27 import std.stdio; | 7 import std.process; |
28 import std.path; | 8 import std.string; |
29 import std.file; | 9 import std.file; |
30 import std.string; | |
31 import std.stdio; | |
32 import std.process; | |
33 | 10 |
34 | 11 |
35 int main(string[] args) { | 12 void main(string args[]) { |
13 auto data = initialise(args, "doodle"); | |
36 | 14 |
37 string sourcePath = getcwd; | 15 // |
16 // open | |
17 // | |
38 | 18 |
39 // parse command-line options | 19 // libssh2 and dependencies required by net |
40 if (args.length < 2) { | 20 usePackage(data, "libssh2", Constraint.AtLeast, "1.2"); |
41 writefln("Error - usage is: rdmd <configure.d-path> <build-path>"); | 21 useHeader( data, "gcrypt.h"); |
42 return -1; | 22 useLibrary(data, "libgcrypt.so"); |
43 } | 23 |
44 string targetPath = args[1]; | 24 // TAO is required by corba-tao |
25 //useTao(data); | |
45 | 26 |
46 // check that source_path looks like a source tree by making sure | 27 |
47 // that a README and options file are present | 28 // |
48 writefln("Examining source"); | 29 // reuse |
49 if (!buildPath(sourcePath, "README").exists || !buildPath(sourcePath, "options").exists) { | 30 // |
50 writefln("Error - current directory must contain README and options"); | 31 |
51 return -1; | 32 usePackage(data, "libxml-2.0"); |
33 usePackage(data, "libpng"); | |
34 usePackage(data, "freetype2"); | |
35 usePackage(data, "gtkmm-2.4", Constraint.AtLeast, "2.18"); | |
36 usePackage(data, "gtkglext-1.0"); | |
37 usePackage(data, "gstreamer-0.10", Constraint.AtLeast, "0.10.22"); | |
38 usePackage(data, "gstreamermm-0.10", Constraint.AtLeast, "0.10.1"); | |
39 usePackage(data, "xv"); | |
40 usePackage(data, "xext"); | |
41 usePackage(data, "xextproto"); | |
42 usePackage(data, "neon", Constraint.AtLeast, "0.28.2"); | |
43 usePackage(data, "libconfig", Constraint.AtLeast, "1.3.1"); | |
44 usePackage(data, "libconfig++", Constraint.AtLeast, "1.3.1"); | |
45 | |
46 useHeader( data, "jpeglib.h"); | |
47 useLibrary(data, "libjpeg.so"); | |
48 | |
49 useExecutable(data, "IMAGE_MAGICK_CONVERT", ["convert"]); | |
50 useExecutable(data, "ZIP", ["zip"]); | |
51 | |
52 appendBobVar(data, "CCFLAGS", | |
53 ["-DGTKMM_MACRO_SHADOW_ERROR", | |
54 "-DGTKMM_DISABLE_DEPRECATED", | |
55 "-DGDKMM_DISABLE_DEPRECATED", | |
56 "-DGLIBMM_DISABLE_DEPRECATED", | |
57 "-DGDK_DISABLE_DEPRECATED", | |
58 "-DG_DISABLE_DEPRECATED", | |
59 "-DLIBSIGC_DISABLE_DEPRECATED", | |
60 "-DGTK_DISABLE_DEPRECATED", | |
61 "-DGSEAL_ENABLE"]); | |
62 | |
63 if (exists("/opt/acacia/ecw")) { | |
64 string[][Use] dirs; | |
65 dirs[Use.Inc] = ["/opt/acacia/ecw/include"]; | |
66 dirs[Use.Lib] = ["/opt/acacia/ecw/lib"]; | |
67 setProjectDirs(data, dirs); | |
68 | |
69 useHeader( data, "NCSFile.h"); | |
70 useLibrary(data, "libNCSUtil.so"); | |
71 useLibrary(data, "libNCSCnet.so"); | |
72 useLibrary(data, "libNCSEcw.so"); | |
73 | |
74 appendBobVar(data, "CCFLAGS", ["-DUSE_ECW_CHARTING_RASTER_SOURCE"]); | |
75 appendBobVar(data, "ECW_LIBRARIES", ["NCSEcw", "NCSUtil", "NCSCnet"]); | |
52 } | 76 } |
53 | 77 |
54 // ensure that target_path exists | |
55 writefln("Establishing build directory"); | |
56 if (targetPath.exists) { | |
57 writefln("Error - %s exists - abandoning configure", targetPath); | |
58 return -1; | |
59 } | |
60 targetPath.mkdirRecurse; | |
61 string binPath = buildPath(targetPath, "bin"); | |
62 binPath.mkdir; | |
63 | 78 |
64 // compile builder into bin_path | 79 appendRunVar(data, "GST_PLUGIN_PATH", ["${DIST_PATH}/lib/plugins"]); |
65 writefln("Building the builder"); | 80 |
66 int ret = system(format("dmd -m64 -w -wi %s -O -of%s", | 81 |
67 buildPath(sourcePath, "builder.d"), buildPath(binPath, "builder"))); | 82 finalise(data, [/*"open"*/]); |
68 if (ret) { | |
69 writefln("Error - builder failed to compile"); | |
70 return -1; | |
71 } | |
72 buildPath(binPath, "builder.o").remove; | |
73 | |
74 // set up scripts | |
75 { | |
76 auto file = File(buildPath(targetPath, "build"), "w"); | |
77 file.writefln("#!/bin/bash"); | |
78 file.writefln("%s %s %s", buildPath(binPath, "builder"), sourcePath, targetPath); | |
79 } | |
80 system("chmod +x " ~ buildPath(targetPath, "build")); | |
81 writefln("All done"); | |
82 | |
83 return 0; | |
84 } | 83 } |