|
|
Home » Community » U++ community news and announcements » Universal makefile & UppBuilder
Universal makefile & UppBuilder [message #35381] |
Wed, 08 February 2012 18:59 |
|
Hi everyone!
A long post follows. If you are lazy to read, just scroll down for the short version
Almost exactly two years ago, I got inspired by extraordinary features of GNU make to create universal makefile, that could be used to build U++ apps without TheIDE. This beast then evolved and was rewritten few times. It was used used for building packages for ubuntu, and it worked well enough. But few days ago, there came Max and his improvements to gdb interface and broke the builds (no offense Max, it's great work ). The reason is that the universal makefile does not support including .brc files. So it is time to take next step in evolution and reveal a new makefile, that I have worked on for quite some time. I didn't want to publish it just yet, as some of the features are not 100% finished and some are even missing, but it builds TheIDE, even with .brc files, so it will save us for now. It can probably be called a beta version.
The biggest difference from the old one is that it does not rely on GNU make features. I tried as hard as possible to keep everything POSIX compatible, so that BSD make and others work with it as well. This resulted in complete change in philosophy, instead of some macro-magic parsing upp files there is now C++ parser embeded in the makefile. It is stored in compressed form and extracted and compiled upon first usage. This parser then reads and analyzes the upp files and creates temporary makefile, that builds the application.
Now good news for fans of other build systems than make: the parser is written with those in mind. The code can be found in uppbox/UppBuilder and whoever is interested can try to write an alternative backend that would generate something else than Makefile, e.g. cmake files or scons script. It would be even possible to create a backend that builds the application instead of just describing how to build it One strange thing about the parser is that it is NOT written in U++. There are two reasons for this: it must be simple to build and it must be fast to be build. The former is achieved by having all the code in single file and relying on minimum of dependencies (no libs, only 6 standard headers). The later requirement forced me to use almost no templates (only 1 class and 1 function) and compiling without optimizations. The result is ~15kB of code, that is compiled in less than 1s on any modern hardware (tested on my lazy Intel Atom netbook;) ), that can parse all the packages necessary to build TheIDE and generate the makefile in about 0.2s. This is definitely an improvement, compared to ~20s that it took with the old makefile Nice bonus is that the code is IMHO quite well documented, as well as it's usage.
Here are the major changes from the old makefile:
- C++ parser is used instead of make+bash magic
- Better POSIX compatibility and hence greater portability
- Faster... much faster
- Similar, but slightly improved interface (the make variables)
- Handles brc files
- Can perform some custom build steps (experimental)
- Interactive mode: user can be asked for some details, e.g. what configuration to use
- The file counter eye-candy was dropped (it was often broken anyways)
- Colorized output - new eye-candy
You can see the generated makefile in uppbox/lpbuild2/mkfile, if you don't want to examine the UppBuilder too closely.
TL;DR version:
There is new, better universal makefile here, if you used the old one you might want to switch.
If you intend to build U++ sources using other build systems than TheIDE or make, you might want to check new UppBuilder package.
Best regards,
Honza
|
|
|
|
|
Re: Universal makefile & UppBuilder [message #35385 is a reply to message #35382] |
Wed, 08 February 2012 23:33 |
|
Mindtraveller wrote on Wed, 08 February 2012 22:23 | Very cool!
Did you test its compatibility with *BSD?
|
I did tests on PCBSD in early stages of development, but I didn't have time to test it properly in this final form. So there might be some errors on BSD, but probably easy to fix.
Honza
|
|
|
Re: Universal makefile & UppBuilder [message #35386 is a reply to message #35384] |
Wed, 08 February 2012 23:44 |
|
Didier wrote on Wed, 08 February 2012 23:24 | Hi Honza,
I'm quite impressed, you went all this way just to enhance UPP build wow
| It's my long-term project, I like to see how I can improve on the same topic as my skills are leveling up Also, I'm actively using it to build packages in launchpad, to avoid chicken-egg problem with TheIDE, so that is a good motivation.
Didier wrote on Wed, 08 February 2012 23:24 | But managing all the portability issues with the make facilities is a pretty tough shot !
| I tried to use only documented, POSIX compatible features, so as long as the tools on other platforms follow POSIX, it should work. Some of the POSIX specifications are linked in documentation, if you're interested
Didier wrote on Wed, 08 February 2012 23:24 | I've been thinking for some while that boost-build is very well adapted to Upp package hierarchy and it works on WIN/LINUX/BSD/MAC/.... everywhere there is a decent C compiler.
boost-build is a build tool that has it's own syntax ( quite simple ) and that manages package dependencies (as in Upp) and it supports many compilers on many OS.
It is written in C ==> if you have a C compiler/linker and you can build it and then use it to build whatever you wan't ==> you don't depend on presence of make/gmake/imake/xxtools/...whatever.
On big gain is that the same "makefile" works on all platforms !! and that most common compilation options are available in generic form (optimisations, 32/64 bits, ...)
|
Hi Didier,
I've never seen boost-build in action, but I believe that if necessary I could almost match it's portability just by writing another backend in some common language. It should be possible to implement the builds in shell script or even in C and avoid make completely But for now, I believe that supporting systems with make is enough. When the code is stable and bug-less, we can play with other possibilities
Honza
|
|
|
|
Re: Universal makefile & UppBuilder [message #35392 is a reply to message #35387] |
Thu, 09 February 2012 07:35 |
|
Didier wrote on Wed, 08 February 2012 23:59 |
Quote: | I've never seen boost-build in action
|
Well I tried it out a few times mostly at home, but I used it once at work and it saved my ass when I had to turn over the project to another person in another company... which only had a linux station with no make tool installed (and on which it was forbidden to install anything !!!!)
So I just recompiled boost-build, added the 32bit compiler option (the new linux station was 64bits while mine was 32bits) and the app was running fine again.
|
Ok, so I've just looked at it and it looks as a nice tool. As long as it is installed on the targeted system. It is binary tool, just as make, so there is not much difference. The portability is nice, but I still think that POSIX compatible shell backend in UppBuilder could be even more portable But it is becoming kind of off-topic, I just wanted to announce that there is a new makefile, if anyone wants to use it
Honza
|
|
|
|
Re: Universal makefile & UppBuilder [message #35394 is a reply to message #35393] |
Thu, 09 February 2012 08:38 |
|
unodgs wrote on Thu, 09 February 2012 08:05 | That's great you put so much effort to get working upp packages on arch linux! But I have a one question. Wouldn't be better to simply compile umk first and then use it to build theide?
|
How could I compile umk, if you don't have umk to compile it with?
Umk consists of 200+ source files, that require correct flags to be set and correct libraries to be linked. OTOH UppBuilder parser is single file (actually there is 2, but they are merged for the purpose of makefile), which doesn't depend on any flags nor libraries. That simplifies things a lot
Honza
PS: Also, last time I checked, the U++ web said that "if the reinvented wheel spins about 4 times faster, reinventing is not that bad idea..."
[Updated on: Thu, 09 February 2012 08:42] Report message to a moderator
|
|
|
Re: Universal makefile & UppBuilder [message #35395 is a reply to message #35394] |
Thu, 09 February 2012 08:49 |
|
dolik.rce wrote on Thu, 09 February 2012 02:38 |
Umk consists of 200+ source files, that require correct flags to be set and correct libraries to be linked. OTOH UppBuilder parser is single file (actually there is 2, but they are merged for the purpose of makefile), which doesn't depend on any flags nor libraries. That simplifies things a lot
|
Ok, that's explain a lot.. I thought that recently separated umk is much simpler to compile
|
|
|
|
Re: Universal makefile & UppBuilder [message #35427 is a reply to message #35423] |
Sun, 12 February 2012 12:18 |
|
chickenk wrote on Sat, 11 February 2012 21:11 | Just a very small suggestion while I look at the code: it would be interesting to add the '-v' option to hexdump in brc.sh ; I let you read the manual page to understand.
| Good catch Lionel, hexdump -v is definitely good idea to prevent trouble
Thanks,
Honza
|
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 03:42:36 CEST 2024
Total time taken to generate the page: 0.03744 seconds
|
|
|