An introductionto mGAR (Dublin 2011)

  • View

  • Download

Embed Size (px)



Text of An introductionto mGAR (Dublin 2011)

  • 1. mGAR Producing complex packages for Solaris the easy wayOpenCSW Technical WintercampDublin 2011 Dagobert Michelsen dam@opencsw.orgSamstag, 19. Februar 20111

2. Once upon a time find /usr/local/pkg -print > /tmp/files cat /tmp/files | pkgproto > /tmp/Prototype vim /tmp/Prototype PKG=FOOtree NAME=tree - A recursive directory listing program ARCH=sparc VERSION=1.5.3,REV=2010.02.02 CATEGORY=application VENDOR= PSTAMP=joe@darkstar-20100202140539 CLASSES=none HOTLINE= pkgmk -o -r / -d /tmp -f Prototype pkgtrans . tree.pkg FOOtree gzip tree.pkgSamstag, 19. Februar 20112 3. What is missing? Whats wrong? Compilation Packaging standards Checking for errors Hardcoded prototypes Hardcoded pkginfoSamstag, 19. Februar 20113 4. Enter mGARgmake packageSamstag, 19. Februar 2011 4 5. What is mGAR? A system to build packages for Solaris Origins are GAR LNX-BBC and GARNOME m = modulated multiple similar builds Files written in GNU Make5Samstag, 19. Februar 2011 5 6. The simplest caseThe minimal information to build a package:1. What should the package be named2. Where to get the sources3. What the dependencies areSamstag, 19. Februar 2011 6 7. Example: gperfNAME = gperfVERSION = 3.0.3CATEGORIES = develDESCRIPTION = A perfect hash function generatorMASTER_SITES = $(GNU_MIRROR)DISTFILES = $(NAME)-$(VERSION).tar.gzCONFIGURE_ARGS = $(DIRPATHS)TEST_TARGET = checkinclude gar/category.mkSamstag, 19. Februar 2011 7 8. Categoriesinclude gar/category.mkShould be really named profilesContains settings common to aclass of builds Generic Perl Modules Ruby Gems Python EggsSamstag, 19. Februar 20118 9. Typical customization needsCode needs to be patched to compile or run on SolarisCode doesnt honor information passed via ./configureFiles need to placed at specific locations in the packageSamstag, 19. Februar 2011 9 10. Phasesprerequisites fetch checksum exract patch configure build test install merge package checkpkg...and custom targets: pre-fetchpost-fetch pre-extract(...)Samstag, 19. Februar 2011 10 11. Modulations A Modulation is the process of varying one waveform in relation to anotherwaveform For soft ware builds that means:A Modulation is the process of varying a build in relation to certain parametersSamstag, 19. Februar 2011 11 12. Phases and modulationsPrerequisitesExecuted OneFetch modulationgloballyChecksumExtractPatchConfigure Executed insideBuildTest modulationInstallMergePackageExecuted globallySamstag, 19. Februar 201112 13. What can be used as modulator?ISA for build architectureFor 32/64 bit versions and optimized binaries.See lamePackage versionUseful when multiple versions of a library should be includedSee automake...anything that controls the build Static vs. dynamic linked versions See wget Parameter size See nrpe Wide vs. narrow characters See ncursesSamstag, 19. Februar 2011 13 14. Modulationover ISAAllows easy building of multiple ISAsBuilt-in special case of modulationNo merge needed alsoSimplest caseBUILD64 = 1AdvancedEXTRA_BUILD_ISAS = sparcv8plus+vis pentium_proSamstag, 19. Februar 201114 15. Modulation over ISA requirementsCertain ISAs require specific platformsx64 requires Solaris 10, but integrated package for Solaris 8-10Parallelizing modulation buildsMay require builds on multiple hostsBuild platform for each modulation canbe specified in the package manifestHow does ISAEXEC relate to multi-ISA?Samstag, 19. Februar 201115 16. Modulation over static/dynamic linkingAdds modulator withGARNAME = wget this name... Cool trick:EXTRA_MODULATORS = STATIC Use dynamically expanded variablesto set per-modulationMODULATIONS_STATIC = disable enableEXTRA_CONFIGURE_STATIC-disable = --with-sslEXTRA_CONFIGURE_STATIC-enable = --disable-sharedEXTRA_CONFIGURE_STATIC-enable += --enable-staticEXTRA_CONFIGURE_STATIC-enable += --without-ssl...CONFIGURE_ARGS += $(EXTRA_CONFIGURE_STATIC-$(STATIC))MERGE_SCRIPTS_isa-sparcv8-static-disable = copy-all MERGE_SCRIPTS_isa-sparcv8-static-enable = rename-wget copy-onlyMERGE_DIRS_isa-sparcv8-static-enable = $(bindir)MERGE_SCRIPTS_isa-i386-static-disable = copy-all MERGE_SCRIPTS_isa-i386-static-enable = rename-wget copy-onlyMERGE_DIRS_isa-i386-static-enable = $(bindir)merge-rename-wget:@mv $(DESTDIR)$(bindir)/wget $(DESTDIR)$(bindir)/wget.static...include gar/category.mkSamstag, 19. Februar 201116 17. Modulation over parameter sizeOk, I guess you understoodGARNAME = nrpehow this works...EXTRA_MODULATORS = SIZE Use patchfiles on aMODULATIONS_SIZE = 1k 8k per-modulation basis...PATCHFILES_isa-sparcv8-size-8k = common.h.diffPATCHFILES_isa-i386-size-8k = common.h.diff...MERGE_SCRIPTS_isa-sparcv8-size-1k = copy-allMERGE_SCRIPTS_isa-sparcv8-size-8k = copy-nrpe-onlyMERGE_SCRIPTS_isa-i386-size-1k = copy-allMERGE_SCRIPTS_isa-i386-size-8k = copy-nrpe-onlyinclude gar/ $(INSTALLISADIR)$(bindir)/nrpe_1k $(PKGROOT)$(bindir)/nrpe_8kcp $(INSTALLISADIR)$(LIBEXECDIR)/check_nrpe $(PKGROOT)$(LIBEXECDIR)/check_nrpe_8k@$(MAKECOOKIE)Samstag, 19. Februar 2011 17 18. Modulationsand their namesThe name of a modulation is----...Call each phase from a modulation manually with-Example:gmake build-isa-sparcv8This results in a sub-make-invocation-modulated MODULATION== ...Example:gmake build-modulated MODULATION=isa-sparcv8ISA=sparcv8Samstag, 19. Februar 2011 18 19. Merging Why is this needed?Optimized binaries with isaexecLibraries may be located elsewhere inthe package than they were configured/lib/32 -> ./lib/64 -> sparcv9 | amd64Pathes stored in pkgconfig-filesSamstag, 19. Februar 2011 19 20. Merging Why is this needed?32 and 64 bit need different install locationsto have sane pkgconfig-filesbuild-isa-sparcv8/opt/csw/bin/myapp Installbuild-isa-sparcv9/opt/csw/bin/64/myapppkgroot/opt/csw/bin/myappMergepkgroot/opt/csw/bin/sparcv9/myapp /opt/csw/bin/myapp -> isaexecPackage/opt/csw/bin/sparcv8/myapp /opt/csw/bin/sparcv9/myappSamstag, 19. Februar 201120 21. Merging Builtin rules Copy allCopy only someMERGE_DIRS_Do not relocatecopy-allcopy-only Do relocate copy-relocate copy-relocated-onlySamstag, 19. Februar 201121 22. Mergingwith custom rulesOnly merge specific files This is the default buildGARNAME = nrpe Just copy everything over...MERGE_SCRIPTS_isa-sparcv8-size-1k = copy-allMERGE_SCRIPTS_isa-sparcv8-size-8k = copy-nrpe-only We want to control exactly what is usedfrom the additional modulationMERGE_SCRIPTS_isa-i386-size-1k = copy-allMERGE_SCRIPTS_isa-i386-size-8k = copy-nrpe-onlyMerging copies from the installinclude gar/category.mklocation to PKGROOT...merge-copy-nrpe-only:cp $(INSTALLISADIR)$(bindir)/nrpe_1k $(PKGROOT)$(bindir)/nrpe_8kcp $(INSTALLISADIR)$(LIBEXECDIR)/check_nrpe $(PKGROOT)$(LIBEXECDIR)/check_nrpe_8k@$(MAKECOOKIE)Samstag, 19. Februar 201122 23. Class Action ScriptsThey mean more or less hooks f cswinitsmf /opt/csw/etc/init.d/cswpuppetd i. scripts handle the files i.cswinitsmf r.cswinitsmfGAR integration: INITSMF = $(prefix)/init.d/cswpuppetdFully automated: Texinfo registration Configuration file preser vation Placement of README.CSW in package docs ...Samstag, 19. Februar 201123 24. checkpkg and overrides Examines a set of .pkg files Looks for common issues Written mostly in Python, with lintian in mindallows to override checksSamstag, 19. Februar 2011 24 25. Your package is ready!Samstag, 19. Februar 201125 26. Questions?Bueller? Anybody?Samstag, 19. Februar 2011 26