Sun, 15 Dec 2024 14:35:58 +0100
add missing version attribute to project.xml example
125
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | ## Overview |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
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. |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | Currently, UWproj does not contain any makefile generator, however this might change in the future. |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | ## Project Status |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
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. |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | That doesn't mean it is unusable, if anyone likes it and wants to use it, I am happy to support their efforts. |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | ## Why Not Autoconf |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
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. |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | UWproj approaches things differently and introduces some improvements: |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
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) |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | - The script contains far fewer tests, mostly checks for the compiler and dependencies |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
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 |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | ## Example |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | UWproj uses a `project.xml` file to generate a configure script. Here is a simple example: |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | <?xml version="1.0" encoding="UTF-8"?> |
126
c82d46627c72
add missing version attribute to project.xml example
Mike Becker <universe@uap-core.de>
parents:
125
diff
changeset
|
28 | <project version="0.3" xmlns="http://unixwork.de/uwproj"> |
125
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | <!-- global dependency for all targets --> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | <dependency> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | <!-- check if a C Compiler is available, this will add the CC variable to the config.mk file --> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | <lang>c</lang> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | </dependency> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | <!-- libxml2 pkg-config check --> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | <dependency name="libxml2"> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | <!-- this will run pkg-config --cflags and pkg-config --libs for the specified package --> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | <pkgconfig>libxml-2.0</pkgconfig> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | </dependency> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | <!-- libxml2 xml2-config check --> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | <dependency name="libxml2"> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | <!-- any command can be used to add CFLAGS --> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | <cflags exec="true">xml2-config --cflags</cflags> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | <ldflags exec="true">xml2-config --libs</ldflags> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | </dependency> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | <!-- openssl on bsd-like systems, but not on macos --> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | <dependency name="openssl" platform="bsd" not="macos"> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | <!-- static flags without any command --> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | <ldflags>-lssl -lcrypto</ldflags> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | </dependency> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | <dependency name="openssl"> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | <pkgconfig>openssl</pkgconfig> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | </dependency> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | <dependency name="openssl"> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | <pkgconfig>openssl</pkgconfig> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | </dependency> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | <!-- |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | targets have their own CFLAGS/LDFLAGS with the target name as prefix |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | MYTARGET_CFLAGS |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | MYTARGET_LDFLAGS |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | --> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | <target name="mytarget"> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | <dependencies>libxml2,openssl</dependencies> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | </target> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | <target name="other"> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | <dependencies>libxml2</dependencies> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | </target> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | </project> |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
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. |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
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. |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | ## Howto |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | Clone the repository: |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | $ hg clone https://code.unixwork.de/hg/uwproj |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | Build (requires jdk and maven) |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | $ cd uwproj |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | $ mvn package |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | Install (as root): |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | $ cd dist |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | $ ./install.sh |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | Create a new uwproj based project somewhere: |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | $ uwproj --init |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
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: |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | $ uwproj |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | In: make/project.xml |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | Tpl: make/configure.vm |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | Out: configure |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | # Documentation |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | Doesn't exist yet, however there is a *.xsd* file. For more examples, check out these projects: [dav][e0], [idav][e1], [ucx][e2]. |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | [e0]: https://code.unixwork.de/hg/dav |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | [e1]: https://code.unixwork.de/hg/idav |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | [e2]: https://uap-core.de/hg/ucx |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | # Why Java? It sucks. |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | I know. I used Java for the first prototype, which is now the final product. Rookie mistake. |
325f72ef6096
add draft for website
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 |