Download presentation
Presentation is loading. Please wait.
Published byVictoria Liliana Perkins Modified over 8 years ago
1
Miguel Telleria telleriam AT unican.es
2
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 2 de Copyright Notice ● This means (coarsely): (Details in http://creativecommons.org/licenses/by-sa/3.0/) http://creativecommons.org/licenses/by-sa/3.0/ ● that you are free to: – Share, copy, distribute and transmit the work – Remix, adapt the work (even for commercial purposes) ● under the following conditions: – Attribution: You must give the original author credit. – ShareAlike: If you alter, transform or build upon this work, you may distribute the resulting work only under the same, similar or a compatible licence. ● Any of the above conditions can be waived if you get permission from the copyright holder. ● If you have received this work in the PDF, the original editable.odp content must be available from the same source. Initial web URL should probably be http://people.cs.kuleuven.be/~dirk.craeynest/ada- belgium/events/11/110205-fosdem.html http://people.cs.kuleuven.be/~dirk.craeynest/ada- belgium/events/11/110205-fosdem.html This document, Ada packaging example by Miguel Telleria from the Computadores and Tiempo Real lab (a)) of the Univ of Cantabria is licensed under a Creative-Commons Attribution ShareAlike 3.0 license (b)). (a) http://www.ctr.unican.eshttp://www.ctr.unican.es (b) http://creativecommons.org/licenses/by-sa/3.0/legalcodehttp://creativecommons.org/licenses/by-sa/3.0/legalcode
3
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 3 de About MAST ● MAST is a schedulability and time-completion analysis tool for real- time systems ● WCET computation ● Jitter, time slacks...... ● COPYRIGHT: University of Cantabria, CTR-lab ● Under GPLv2 ● http://mast.unican.es http://mast.unican.es ● Uses: ● GtkAda => GUI tools ● XmlAda => Data conversion ● Original upstream build not suitable for packaging: ● No centralized placement of binaries ● We would like to export general utility code as a library
4
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 4 de What we want to accomplish ● Start from the upstream tarball ● Add our own building system based on GPR files ● Create a single source package from it ● Obtain 4 packages from the same source package: ● mast ● libctr-ada-utils1 ● libctr-ada-utils1-dbg ● libctr-ada-utils2-dev
5
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 5 de ● 1 shared library: ● Ctr-ada-utils: General purpose (Abstract Data Types) ● Packaged as: libctr-ada-utils, libctr-ada-utils-dev, libctr-ada-utils-dbg ● Lots of common code for MAST code (depends on ctr-ada-utils) ● Won't be packaged separately but linked statically in each executable. ● 5 projects (depend on ctr-ada-utils and the common code): ● Gmast: 1 main executable ● GmastEditor: 1 main executable ● GmastResults: 1 main executable ● Mast_xml: 2 main executables ● Mast_Analysis: 2 main executables ● Packaged as: mast (all in a single package) MAST software architecture Depend on GTKAda Depends on XMLAda
6
Part I: Upstream GPR Building system
7
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 7 de GPR Building system ● GPR (Gnat Project Manager) large scale software construction. ● Input file (.gpr) that GnatMake takes as input to alter its work. ● Idea: ● GnatMake: – Manages dependencies – Applies typical task-oriented switches in toolchain (-c, -fPIC, -Wl soname) ● GPR files: Drives gnatmake. Defines per-project: – Directories for Input (source), intermediate (object, ali) and final (exe, lib) – Specific switches (debug, optimization, Ada checks) ● Project description can be chained creating dependencies ● For more info: Gnat's User Manual... ● … and our examples :)
8
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 8 de Our build Makefile SOVERSION = 1 # Dynamic library could be built through dependencies (but needs the SOVERSION arg) Build: gnatmake -j2 -p -Pctr-ada-utils.gpr -XSOVERSION=$(SOVERSION) - XLIB_TYPE=dynamic gnatmake -j2 -p -Pctr-ada-utils.gpr -XSOVERSION=$(SOVERSION) - XLIB_TYPE=static gnatmake -j2 -p -P gmast.gpr gnatmake -j2 -p -P gmasteditor.gpr gnatmake -j2 -p -P gmastresults.gpr gnatmake -j2 -p -P mast_analysis.gpr gnatmake -j2 -p -P mast_xml.gpr – Options: -p (make directories) -X -P -j ● We need to write: ● 1 gpr file for the library with switches SOVERSION and LIBTYPE ● 1 gpr for the shared code (mast_common) ● 5 gpr files (1 for each main project)
9
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 9 de ctr_ada_utils.gpr project Ctr_Ada_Utils is for Library_Name use "ctr-ada-utils"; for Library_Kind use External("LIB_TYPE","dynamic"); for Library_Version use "libctr-ada-utils.so." & External("SOVERSION", "1"); for Library_Dir use "build/lib"; for Library_ALI_Dir use "build/ali/ctr_ada_utils"; for Source_Dirs use ("../utils"); for Object_Dir use "build/obj/ctr_ada_utils/" & Ctr_Ada_Utils'Library_Kind; package Compiler is for Default_Switches("Ada") use ("-g"); end Compiler; end Ctr_Ada_Utils; ● A library project compiles ALL files in the search path in a library – There is a way to rule some of them out. ● It is used for both building and linking against the library – Thus preserving the compilation dependance update ● Separate object directories for static and dynamic ('Library_Kind) Library parameters (soname, file, dynamic/static) Library dirs lib and Exported Ali files) Library dirs lib and Exported Ali files) Source search path Compiler switches
10
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 10 de Common objects: mast_common.gpr ● Does not mandate any compilation or building ● Just written to be used (not included) by other projects with "ctr_ada_utils.gpr"; project Mast_Common is for Source_Dirs use ("../mast_analysis"); for Object_Dir use "build/obj/mast_common"; package Compiler is for Default_Switches("Ada") use ("-g"); end Compiler; end Mast_Common
11
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 11 de Executable GPR file with "/usr/share/ada/adainclude/xmlada.gpr"; with "ctr_ada_utils.gpr"; with "mast_common.gpr"; project Mast_Xml is for Source_Dirs use ("../mast_xml"); for Object_Dir use "build/obj/mast_xml"; for Exec_Dir use "build/bin"; for Main use ("mast_xml_convert.adb", "mast_xml_convert_results.adb"); package Compiler is for Default_Switches ("Ada") use("-g"); end Compiler; end Mast_Xml; Use (not include) dependencies Package directories Main files Compiler switches ● with to use library projects that it depends on ● May specify more than one main file
12
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 12 de Resulting building layout Build │ ├─obj─┬─ctr-ada-utils ─┬─dynamic => obj (-fPIC) and ali files │ │ └─static => obj and ali files │ │ ├─mast_analysis => obj and ali files of common and mast_analysis │ │ ├─gmasteditor => obj and ali files of GmastEditor │ │ ├─gmast => obj and ali files of Gmast │ │ ├─gmastresults => obj and ali files of GmastResults │ │ └─mast_xml => obj and ali files of MastXml │ ├─ali──ctr-ada-utils => ali files in the library │ ├─lib => libctr-ada-utils.so.1 libctr-ada-utils.a │ └─bin => executable files: gmast_analysis, gmasteditor
13
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 13 de Exported library gpr: ctr_ada_utils.gpr.in ● Used for external builds of projects against the library ● sed -e 's|@prefix@|$(DESTDIR)|' file.out ● Reflects the placement of files after installation ● Uses Externally_Built to disallow the update chain to continue – Normal user's won't have write permissions on the library to rebuild it – An attempt to link against a more recent sublibrary will create an error project Ctr_Ada_Utils is for Library_Name use "ctr-ada-utils"; for Library_Kind use "dynamic"; for Library_Version use "libctr-ada-utils.so." & External("SOVERSION", "1"); for Library_Dir use "@prefix@/lib"; for Library_ALI_Dir use "@prefix@/lib/ada/adalib/ctr_ada_utils"; for Source_Dirs use ("@prefix@/share/ada/adainclude/ctr_ada_utils"); For Externally_Built use "true"; end Ctr_Ada_Utils;
14
Part II: Upstream installation
15
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 15 de Upstream installation ● For the library package: ● Copy the lib file (with soname) to $(DESTDIR)@prefix@/lib ● (Eventually) Run ldconfig to update the ld.so cache ● For the library-dev package ● Create a symlink:.so →.so.@soversion@ ● Copy the static library to $(DESTDIR)@prefix@/lib ● Copy the *ali files -m a=r under $(DESTDIR)@prefix@/lib/ada/adalib/library ● Copy the *ads files and (at least needed) *adb files -m a=r to $(DESTDIR)@prefix@/share/ada/adainclude/library ● Copy the exported GPR file -m a=r to $(DESTDIR)@prefix@/share/ada/adainclude ● For the bin package ● Copy the executables to $(DESTDIR)@prefix@/bin
16
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 16 de GPR Makefile install part PREFIX ?= /usr/local SOVERSION = 1 install: install -d $(DESTDIR)$(PREFIX)/lib install build/lib/libctr-ada-utils.so.$(SOVERSION) $(DESTDIR)$(PREFIX)/lib # ADAINCLUDE = $(DESTDIR)$(PREFIX)/share/ada/adainclude/ ADALIB = $(DESTDIR)$(PREFIX)/lib/ada/adalib/ ln -s libctr-ada-utils.so.$(SOVERSION) $(DESTDIR)$(PREFIX)/lib/libctr-ada-utils.so mkdir -p $(ADAINCLUDE)/ctr_ada_utils sed -e 's|@prefix@|$(PREFIX)|' $(ADAINCLUDE)/ctr_ada_utils.gpr chmod a=r $(ADAINCLUDE)/ctr_ada_utils.gpr install -m a=r../utils/*.ad[bs] $(ADAINCLUDE) mkdir -p $(ADALIB)/ctr_ada_utils install -m a=r build/ali/ctr_ada_utils/* $(ADALIB)/ctr_ada_utils install build/lib/libctr-ada-utils.a $(DESTDIR)$(PREFIX)/lib Install -d $(DESTDIR)$(PREFIX)/bin install build/bin/* $(DESTDIR)$(PREFIX)/bin clean: rm -rf *~ build
17
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 17 de How to use this library once installed ● Preferred way: with a top GPR file ● See the examples of GmastEditor, Gmast... – with “/usr/share/ada/adainclude/ctr-ada-utils.gpr” ● With GnatMake switches: You need the 3 of them ● -aI => -aI/usr/share/ada/adainclude/ctr_ada_utils/ ● -aO => -aO/usr/lib/ada/adalib/ctr_ada_utils ● -largs -lctr-ada-utils ● With Environment variables + -largs -l ● ADA_INCLUDE_PATH += :/usr/share/ada/adainclude/ctr_ada_utils ● ADA_OBJECT_PATH += :/usr/lib/ada/adalib/ctr_ada_utils ● Still use -largs -lctr-ada-utils
18
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 18 de Summarizing upstream GPR and install ● For every library: ● 1 internal.gpr file (used to build and link-against during compilation) – With a switch for static and dynamic libraries – Separating the object files of each kind (one with -fPIC and another without) ● 1 exported.gpr file (will be used to link-against from external programs) ● Installation: – Lib.so, lib.a, ali files, ads and adb files, exported.gpr – Launch ldconfig ● For each project that uses the same libraries and share an object naming scheme: ● 1 internal.gpr that withes the library ● Installation: Just place them in the PATH
19
Part III: Debian Packaging
20
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 20 de Control file (I): Source and main ● Initial Debianisation ● dh_make -c gpl2 -f../mast_1-3-10.orig.tar.gz -m -p mast ● debian/control source part ● Debian/control mast (main package) part Source: mast Section: development Priority: optional Maintainer: Miguel Telleria de Esteban Build-Depends: debhelper (>= 7.0.50~), gnat, libgtkada2.14.2-dev, libxmlada3.2-dev Standards-Version: 3.9.1 Homepage: Package: mast Architecture: i386 amd64 Depends: ${shlibs:Depends}, ${misc:Depends} Description: MAST real-time analysis tool Modelling and Analysis Suite for Real Time applications. A series of graphic editors and analysis calculation tools that...
21
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 21 de Control file (II): Library ● Binary lib (SOVERSION = 1) -DEV lib (ALIVERSION=2) Package: libctr-ada-utils Section: libs Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Description: General purpose Ada library for ADT and String management... Package: libctr-ada-utils2-dev Architecture: any Depends: ${misc:Depends}, gnat, gnat-4.4, ada-compiler, libctr-ada-utils (= ${binary:Version}) Conflicts: libctr-ada-utils1-dev Replaces: libctr-ada-utils1-dev Description: General purpose Ada library for ADT and String management... Package: libctr-ada-utils1-dbg Section: debug Architecture: any Depends: ${misc:Depends}, libctr-ada-utils1 (= ${binary:Version}) Recommends: libctr-ada-utils2-dev (= ${binary:Version}) Suggests: gnat, gnat-4.4, ada-compiler Description: General purpose Ada library for ADT and String management...
22
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 22 de Changelog ● debian/changelog defines the version number of the package ● dch -i “first line to create a correct template” ● Then edit the debian/changelog by hand adding a final prefix and more required lines. ● The version number will be 1-3-8-ctr1 => orig.tar.gz number is 1-3-8 ● The distribution name is stable (in Debian only testing or unstable) mast (1-3-8-ctr1) stable; urgency=low * Porting to Debian Squeeze (adjusting gtkada dependencies) * Using dpkg 3.0-quilt format * Providing an upstream GPR building and installation system -- Miguel Telleria de Esteban Fri, 11 Feb 2011 13:30:39 +0100
23
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 23 de Top Makefiles ● We create a top Makefile that uses GPR building system ● The debian/rules file reduces to all: make -C gpr_build_system PREFIX=/usr building clean: make -C gpr_build_system PREFIX=/usr clean install: make -C gpr_build_system PREFIX=/usr install export DH_OPTIONS %: dh $@ build: cp debian/Makefile_root Makefile make override_dh_compress: dh_compress --all --exclude=.ads --exclude=.adb override_dh_strip: dh_strip --package=libctr-ada-utils1 --dbg-package=libctr-ada-utils1-dbg dh_strip –remaining-packages override_dh_clean: dh_clean Makefile
24
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 24 de Files for dh_install and dh_links ● libctr-ada-utils2-dev.install ● libctr-ada-utils2-dev.links ● libctr-ada-utils1.install ● mast.install usr/share/ada/adainclude usr/lib/ada/adalib/ctr_ada_utils usr/lib/libctr-ada-utils.a usr/lib/libctr-ada-utils.so.1 usr/lib/libctr-ada-utils.so usr/lib/libctr-ada-utils.so.1 usr/bin
25
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 25 de Manpages ● I am not an expert in manpages, I use a very simple one ● I name the file mast.1 and create a symlink for every other executable ll (mast_analysis.1, gmasteditor.1...). All of them in debian/manpages ● Then in debian/mast.manpages I write.TH "MAST TOOLS" 1 "Feb 2011" "Debian Project" "Debian Linux".SH NAME gmast_analysis, gmasteditor, gmastresults, mast, mast_analysis, mast_analysis_help, mast_read_results, mast_xml_convert, mast_xml_convert_results \- MAST Tools.SH DESCRIPTION Those programs are part of MAST a real time analysis tool..SH AUTHOR This manpage has been written by Miguel Telleria, for the Debian GNU/Linux project. debian/manpages/*
26
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 26 de Building the package ● All actions: ● debuild – Goes through all the process – Generates a log file (.build) – Calls lintian to verify Debian Policy rules (shows errors and warnings only) ● Fix non-build issues (install or packages): ● Copy gpr_build_system/build outside ● Issue fakeroot debian/rules clean ● Copy back build/ directory to gpr_build_system ● Issue debian/rules binary – Gnatmake will see that all objects are built and the compiling phase will be skipped.
27
Part IV: Ubuntu PPA upload
28
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 28 de Ubuntu PPA ● PPA: Personal Package Archive ● Infrastructure freely provided by launchpad to host non-official Ubuntu packages. ● Includes an automatic builder ● Only currently supported Ubuntu versions are allowed ● Fortunately Debian Squeeze and Ubuntu Lucid (LTS) are quite aligned in Ada library versions ● To create a PPA from your free launchpad account ● Upload you public GPG key (it will serve to authenticate uploads!!) and sign Ubuntu's code of conduct ● Activate your personal PPA (by default ppa-name = launchpad-id) ● It will be available: – From sources.list: deb http://ppa.launchpad.net/ /ppa/ubuntu/http://ppa.launchpad.net/ – From the web: https://launchpad.net/~ /+archive/ppahttps://launchpad.net/~ /+archive/ppa
29
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 29 de Uploading to Ubuntu PPA (I) ● Change the distro in the last entry of debian/changelog: ● Use debuild -S -sa to build only the source packages and force the inclusion of the original source. ● debuild -S -sa (and sign the result files) ● You should have obtained a sources.changes file ● Use dput to upload the sources.changes file: ● dput mast_1-3-8-ctr1_source.changes ● Where corresponds to the entry in ~/.dput.cf or /etc/dput.cf mast (1-3-8-ctr1) lucid; urgency=low * Porting to Debian Squeeze (adjusting gtkada dependencies) * Using dpkg 3.0-quilt format * Providing an upstream GPR building and installation system -- Miguel Telleria de Esteban Fri, 11 Feb 2011 13:30:39 +0100
30
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 30 de Uploading to Ubuntu PPA (II) ● Once the upload finishes the process goes as follows: ● In ~10 min the package will be accepted or rejected (you will receive an email) ● You will be able to see it in the PPA's package list page in the build-process ● The automatic build process will start for x86 and amd64 architectures ● You can find my MAST packages at: ● https://launchpad.net/~snapy/+archive/ppa https://launchpad.net/~snapy/+archive/ppa ● deb(-src) http://ppa.launchpad.net/snapy/ppa/ubuntu lucid mainhttp://ppa.launchpad.net/snapy/ppa/ubuntu
31
FOSDEM: Free Open Source Developers European Meeting Brussels, 6 Feb 20110Miguel Telleria de Esteban telleriam AT unican.es)Páge 31 de Credits and references ● Credits: – MAST: http://mast.unican.es by CTR lab, Univ Cantabria. Http://www.ctr.unican.eshttp://mast.unican.es Http://www.ctr.unican.es – Ada Belgium and its Ada-FOSDEM initiative. – Ludovic Brenta for his insight in the packaging techniques. – Nicolas Boulengez for his work in packaging libtexttools ● References: – Debian Policy for Ada:http://people.debian.org/~lbrenta/debian-ada-policy.htmlhttp://people.debian.org/~lbrenta/debian-ada-policy.html – GNAT's User Guide (Debian package gnat- doc)http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/ – Debian New Maintainer's guide (Debian package maint-guide) http://www.debian.org/doc/maint-guide/ http://www.debian.org/doc/maint-guide/ – Debian policy manual (Debian package debian-policy) http://www.debian.org/doc/debian-policy/ http://www.debian.org/doc/debian-policy/
32
Thanks for your attention Questions?
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.