GAR: Automating Entire OS Builds
Suppose you want to perform a configure step, but there is no actual program or script associated with that step. For example, you could conceivably want to run a series of shell commands to create a configuration file. Simply pick a file associated with the configure step (or ``none'' if there isn't one) and set your CONFIGURE_SCRIPTS to that. Then write a configure- rule to handle that file (or ``configure-none'' if you used ``none'').
For example, look at the way the traceroute package (Gavron's Traceroute) performs its build step. There was no Makefile, so the maintainer had to provide a method for the compilation commands to be run semi-manually. So the BUILD_SCRIPTS is set to the .c file, and a build- rule for that file is created:
BUILD_SCRIPTS = $(WORKSRC)/traceroute.c build-$(WORKSRC)/traceroute.c: mkdir -p $(COOKIEDIR)/build-$(WORKSRC) $(CC) $(CFLAGS) -o $(WORKSRC)/traceroute \ $(WORKSRC)/traceroute.c -lresolv -lm $(MAKECOOKIE) include ../../gar.mk
This is in fact similar to the way that the default rules are defined in the GAR libraries. For example, here is how the library handles Makefiles as BUILD_SCRIPTS:
build-%/Makefile: mkdir -p $(COOKIEDIR)/build-$* $(BUILD_ENV) $(MAKE) -C $* $(BUILD_ARGS)In make, the % is a wildcard (matching) character when used in the name of a rule, and the $* variable holds whatever it matched. This means that if we told the system to build using work/robotfindskitten-1.0/Makefile, then $* would be set to work/robotfindskitten-1.0 when this rule is run.
The GAR library takes advantage of many of the advanced features of GNU make and is written with the strengths of make in mind. This has been advantageous for a number of reasons. Namely, the size of the GAR library files is a few hundred lines. The BSD Ports libraries are written more like shell scripts and weigh in at several thousand lines.
In addition, the pattern-and-rule handling of package-specific build features fits the realm of make nicely. Also, make has facilities that help avoid redundant behavior. If a package has been installed, running make install will cause it to quickly run through the seven steps, verifying that it had already performed them. To force a package to rebuild from scratch, the make clean target is provided.
GAR provides many features that are not present in most binary package systems, such as dpkg or RPM. This makes user customization of compiles much easier and allows you to rebuild your whole system with whatever optimization flags you choose. The software GAR builds can all be put in /usr/local, for example. The software can also be installed to a scratch directory or secondary volume for later packaging into a complete OS image.
GAR has largely been a product of the LNX-BBC Project, but has also been adopted by many GNOME developers as a means for building the latest CVS build of GNOME from scratch. For more information on the LNX-BBC Project and the GAR system, visit http://lnx-bbc.org/. If you have any specific questions about GAR, feel free to ask on the lnx-bbc-devel list at http://zork.net/mailman/listinfo/lnx-bbc-devel/.
Nick Moffitt is a free software enthusiast in San Francisco, California where he maintains a multiuser community shell server. He is a member of the LNX-BBC Project and maintains GAR, nwall and the popular game of robotfindskitten. When he's not building software projects in make or m4, he prefers the more conventional Scheme and Python languages.
|Contrast Security's Contrast Enterprise||Aug 30, 2016|
|illusive networks' Deceptions Everywhere||Aug 29, 2016|
|Happy Birthday Linux||Aug 25, 2016|
|ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs||Aug 24, 2016|
|Updates from LinuxCon and ContainerCon, Toronto, August 2016||Aug 23, 2016|
|NVMe over Fabrics Support Coming to the Linux 4.8 Kernel||Aug 22, 2016|
- Contrast Security's Contrast Enterprise
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- illusive networks' Deceptions Everywhere
- Happy Birthday Linux
- What I Wish I’d Known When I Was an Embedded Linux Newbie
- Tech Tip: Really Simple HTTP Server with Python
- New Version of GParted
- All about printf
- ContainerCon Vendors Offer Flexible Solutions for Managing All Your New Micro-VMs
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide