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.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Petros Koutoupis' RapidDisk
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- The Italian Army Switches to LibreOffice
- Linux Mint 18
- Oracle vs. Google: Round 2
- The FBI and the Mozilla Foundation Lock Horns over Known Security Hole
- Varnish Software's Varnish Massive Storage Engine
- Firefox 46.0 Released
- Privacy and the New Math
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide