uwproj.md

changeset 125
325f72ef6096
child 126
c82d46627c72
equal deleted inserted replaced
124:a93fe3c0b916 125:325f72ef6096
1 ## Overview
2
3 UWproj is a configure script generator for make-based build systems. The generated scripts resemble GNU Autoconf configure scripts in appearance and behavior, making them familiar to users who just want to build the software. However the underlying system is significantly less complex. The output is just a single *config.mk* file, that can be included by makefiles.
4
5 Currently, UWproj does not contain any makefile generator, however this might change in the future.
6
7 ## Project Status
8
9 UWproj is not released yet, and I do not encourage anyone to use it at this stage. However, it is used in my personal projects, so anyone inspecting those build systems might encounter UWproj and wonder what it is. This page exists primarily to inform such individuals about my somewhat unconventional build system.
10
11 That doesn't mean it is unusable, if anyone likes it and wants to use it, I am happy to support their efforts.
12
13 ## Why Not Autoconf
14
15 GNU autotools are widely used and anyone knows how to build software with `./configure; make; make install` and how to setup the install prefix and other settings. That's why I personally prefer having a configure script and not any other build system like cmake. However autoconf is really old and some conecpts are probably outdated. It is overly complex, slow, many checks are unnecessary these days and debugging the generated script is not fun.
16
17 UWproj approaches things differently and introduces some improvements:
18
19 - In general, source code repositories already include a pre-generated configure script. This allows users to check out the code and build it without additional steps like running autoreconf (or uwproj)
20 - The script contains far fewer tests, mostly checks for the compiler and dependencies
21 - If dependencies are missing, the uwproj configure script lists all missing dependencies, no need to run the script 10 times for 10 different error messages
22
23 ## Example
24
25 UWproj uses a `project.xml` file to generate a configure script. Here is a simple example:
26
27 <?xml version="1.0" encoding="UTF-8"?>
28 <project xmlns="http://unixwork.de/uwproj">
29 <!-- global dependency for all targets -->
30 <dependency>
31 <!-- check if a C Compiler is available, this will add the CC variable to the config.mk file -->
32 <lang>c</lang>
33 </dependency>
34
35 <!-- libxml2 pkg-config check -->
36 <dependency name="libxml2">
37 <!-- this will run pkg-config --cflags and pkg-config --libs for the specified package -->
38 <pkgconfig>libxml-2.0</pkgconfig>
39 </dependency>
40 <!-- libxml2 xml2-config check -->
41 <dependency name="libxml2">
42 <!-- any command can be used to add CFLAGS -->
43 <cflags exec="true">xml2-config --cflags</cflags>
44 <ldflags exec="true">xml2-config --libs</ldflags>
45 </dependency>
46
47 <!-- openssl on bsd-like systems, but not on macos -->
48 <dependency name="openssl" platform="bsd" not="macos">
49 <!-- static flags without any command -->
50 <ldflags>-lssl -lcrypto</ldflags>
51 </dependency>
52 <dependency name="openssl">
53 <pkgconfig>openssl</pkgconfig>
54 </dependency>
55 <dependency name="openssl">
56 <pkgconfig>openssl</pkgconfig>
57 </dependency>
58
59 <!--
60 targets have their own CFLAGS/LDFLAGS with the target name as prefix
61 MYTARGET_CFLAGS
62 MYTARGET_LDFLAGS
63 -->
64 <target name="mytarget">
65 <dependencies>libxml2,openssl</dependencies>
66 </target>
67
68 <target name="other">
69 <dependencies>libxml2</dependencies>
70 </target>
71 </project>
72
73 The configure script generated by uwproj will then check the dependencies and generates a *config.mk* file, that contains *CFLAGS/LDFLAGS* for the targets.
74
75 There are two types of dependencies: general dependencies without a name, and named dependencies. Named dependencies can be specified multiple times for different variations. For example, there is a check if *libxml-2.0* is available via pkg-config, but if this check fails, the alternative *xml2-config* is used.
76
77 ## Howto
78
79 Clone the repository:
80
81 $ hg clone https://code.unixwork.de/hg/uwproj
82
83 Build (requires jdk and maven)
84
85 $ cd uwproj
86 $ mvn package
87
88 Install (as root):
89
90 $ cd dist
91 $ ./install.sh
92
93 Create a new uwproj based project somewhere:
94
95 $ uwproj --init
96
97 The init command creates a *make* directory, that contains all required files, including an empty *project.xml* file. Run *uwproj* to generate a configure script:
98
99 $ uwproj
100 In: make/project.xml
101 Tpl: make/configure.vm
102 Out: configure
103
104 # Documentation
105
106 Doesn't exist yet, however there is a *.xsd* file. For more examples, check out these projects: [dav][e0], [idav][e1], [ucx][e2].
107
108 [e0]: https://code.unixwork.de/hg/dav
109 [e1]: https://code.unixwork.de/hg/idav
110 [e2]: https://uap-core.de/hg/ucx
111
112 # Why Java? It sucks.
113
114 I know. I used Java for the first prototype, which is now the final product. Rookie mistake.
115

mercurial