Programmation Sous Gnustep (1)

Total Page:16

File Type:pdf, Size:1020Kb

Programmation Sous Gnustep (1) Programmation sous GNUstep (1) Nicolas Roard et Fabien Vallon 13 mars 2003 Suite a` la presentation´ du projet GNUstep parue dans le Description de l’application numer´ o 47, nous allons commencer une petite applica- tion que nous allons faire evoluer´ et etendr´ e au cours de Ce mois-ci nous allons donc commencer par quelque l’annee´ . chose de simple. Le programme que nous allons realiser´ a pour but de noter et gerer´ des tachesˆ a` faire ; le nom de l’application sera <Todo.app>. News L’interface sera pour le moment tres` simple, affichant la liste des tachesˆ dans sa partie superieure´ et le – Le nouveau <text-system> (voir l’interview pa- contenu d’une tacheˆ (description, date, etc.) dans sa partie rue dans le LMF numero´ 47) a fusionne´ avec la inferieure.´ Il sera bien surˆ possible de rajouter ou suppri- branche principale deb´ ut fevrier´ . mer une tache,ˆ et memeˆ de sauver le tout dans un fichier. – Optimisations pour gnustep-gui (AppKit), no- Cela nous permettra d’aborder l’outil de RAD1 fourni tamment les methodes´ de dessin ainsi que di- avec GNUstep, Gorm, et d’introduire quelques uns des verses corrections liees´ au focus. Design Patterns2 couramment utilises´ dans une applica- – Maintenance/Corrections mineures (du dej´ a` tion GNUstep. stable) -base et -make. Vous constaterez d’ailleurs au fil des articles que le fra- mework GNUstep utilise lui-memeˆ intensement´ nombre de patterns connus. Les commandes clavier sous GNUstep s’utilisent via la touche <commande> (pomme pour Apple), en gen´ eral´ on affecte cette touche a` <ALT> sur Modele` – Vue – Controleurˆ un clavier de type PC. Les principales actions as- sociees´ a` la touche commande sont : Commenc¸ons par le tres` classique Modele-V` ue- – q pour Quitter Controleurˆ , que l’on peut voir sur la figure 1 page – w pour Fermer la fenetreˆ qui a le focus suivante. – h pour Cacher Ce pattern consiste a` separer´ en 3 parties une application. – o pour Ouvrir un document – Le Modele` represente´ votre partie metier´ , c’est-a-dire` – n pour Ouvrir un nouveau document la partie du code independante´ de la partie graphique – s pour Sauvegarder ou de l’interaction avec l’utilisateur. – t pour Afficher le Panneau de Fontes (si il y a) – La Vue est chargee´ de representer´ a` l’utilisateur le – c pour Afficher le Panneau de Couleurs (si il y Modele.` a) – Le Controleurˆ sert de lien entre le Modele` et la Vue. – w pour Fermer la fenetreˆ qui a le focus Cette separation´ en trois unites´ permet une conception – c pour Copier plus propre : rien n’empecheˆ de reutiliser´ votre modele` – v pour Coller ailleurs (dans une application GNUstepWeb par exemple), – x pour Supprimer ou de changer completement` votre vue en etant´ surˆ de ne Par def´ aut GNUstep n’utilise qu’un seul bouton pas affecter le reste de votre application. de la souris. Par exemple, en utilisant Gorm, on Dans notre cas l’interface graphique avec laquelle l’uti- selectionne un objet par un seul clic. En double- lisateur va interagir sera la partie <Vue>. Cette interface cliquant sur l’objet on <l’ouvre> : si l’objet contient d’autres objets (cas d’une boˆıte) ou si 1Rapid Application Development 2Design Patterns de Erich Gamma, Richard Helm, Ralph Johnson, et l’objet est un conteneur, on accede` aux objets a` John Vlissides. ISBN 0201633612 l’interieur´ de celui-ci. Sinon on peut editer´ <sur place> cet objet. 1 graphique sera cre´ee´ avec Gorm. Le Modele` (interface) Notre modele` sera ici la tacheˆ a` effectuer, c’est-a-dire` un Vue L’interface est reliée au controlleur objet contenant toutes les informations liees´ a` une tacheˆ Le controlleur mets à jour l’interface donnee.´ Nous appellerons cette classe d’objets <Todo>. Agit sur l’interface Un objet Todo contiendra pour le moment trois donnees´ Affiche les informations membres : une chaˆıne de caracteres` contenant la des- Utilisateur fournit les infos au controlleur Modèle Controlleur cription de la tache,ˆ une chaˆıne de caracteres` contenant répercute les actions sur le modèle une note ev´ entuellement plus detaill´ ee,´ et enfin un entier contenant l’indice de progression de la tacheˆ (sur 100). Chaque objet pourra ev´ entuellement contenir des sous- FIG. 1 – Le pattern MVC taches,ˆ c’est-a-dire` d’autres objets de classe <Todo>. Pour simplifier les choses, nous allons permettre d’avoir plusieurs tachesˆ au niveau de l’application ; nous aurons ainsi simplement un tableau contenant un ou plusieurs ob- La Del´ egation´ jets <Todo> au niveau du controleurˆ . Voici donc l’interface de notre modele` (mis dans un fichier Ce pattern consiste a` renvoyer vers un objet <aidant>, dit Todo.h) : del´ egu´ e,´ certains travaux. L’approche classique en pro- grammation objet pour ameliorer´ ou specialiser´ un objet #ifndef TODO H est de le sous-classer. La del´ egation´ consiste a` ne pas mo- #define TODO H difier l’objet, mais a` simplement demander certaines infos #include <Foundation/Foundation.h> ou certains traitements a` un objet <d’aide>. Ce pattern permet souvent de se passer de la creation´ d’une sous- @interface Todo : NSObject classe, et simplifie d’autant le programme. f 3 Pour reprendre l’analogie donnee´ par Aaron Hillegass , NSString ∗ note; le sous-classage revient a` l’approche <Robocop> : pour NSString ∗ description; ameliorer´ le policier, on emploie des dizaines de chirur- int progress; giens, et il faut connaˆıtre parfaitement le fonctionnement NSMutableArray ∗ childs; du corps humain. C’est un outil puissant, mais qui peut id parent; etreˆ complexe a` manipuler. g La del´ egation´ revient a` l’approche <K2000> : pour // Constructeur ameliorer´ Michael, on utilise simplement un outil cre´e´ −(id) initWithDescription: (NSString∗) pour lui, la voiture Kit, ayant tout ce qu’il faut comme description andNote: (NSString∗) note; gadgets indispensables a` la vie tem´ eraire´ d’un justicier a` // modifieurs roulettes. −(void) setDescription: (NSString ∗) Par exemple, quand un widget NSTableView (affichant un description; tableau ou une liste) doit s’afficher, au lieu de le sous- −(void) setNote: (NSString ∗) note; classer pour qu’il reponde´ a` nos besoins, on lui fournit un −(void) setProgress: (int) progress; objet del´ egu´ e.´ −(void) setChilds: (id) childs; Quand le NSTableView voudra se dessiner, il demandera −(void) addChild: (id) child; simplement a` son del´ egu´ e´ des choses comme <Combien −(void) setParent: (id) parent; ai-je de lignes ?> ou <Qu’est-ce qui doit etreˆ affiche´ dans −(void) removeChild: (id) child; la premiere` colonne de la troisieme` ligne ?>. // accesseurs −(NSString ∗) desc; −(NSString ∗) note; Realisation´ −(int) progress; −(id) parent; Voyons comment nous pouvons appliquer ces patterns a` −(NSArray∗) childs; notre programme. @end 3<Cocoa Programming for Mac OS X> de Aaron Hillegass, ISBN 0-201-72683-1 #endif 2 Chaque objet Todo pourra donc contenir ev´ entuellement −(id) parent f return parent; g des sous-tachesˆ (stockees´ dans le tableau childs) ; on pourra acceder´ a` la tacheˆ parente si elle existe en envoyant /∗ Modifieurs ∗/ le message parent : id tacheParente = [maTache parent] ; −(void) setDescription : (NSString ∗) Voici le code de notre modele` (mis dans un fichier description f Todo.m) : [ description release]; description = [[NSString alloc] #include ”Todo.h” initWithString: description]; g @implementation Todo −(void) setNote : (NSString ∗) note f /∗ Constructeurs ∗/ [ note release]; note = [[NSString alloc] initWithString −(id) init f : note]; self = [super init]; g note = [[NSString alloc] init]; description = [[NSString alloc] init]; −(void) setProgress: (int) progress f childs = [[NSMutableArray alloc] init]; if ((progress >= 0) && (progress < 100)) parent = nil; f progress = 0; progress = progress; return self; g g g −(id) initWithDescription: (NSString∗) −(void) addChild: (id) child f description andNote: (NSString∗) note f [ childs addObject: child]; self = [super init]; g description = [[NSString alloc] initWithString: description]; −(void) setParent: (id) parent f note = [[NSString alloc] initWithString ASSIGN ( parent, parent); : note]; g childs = [[NSMutableArray alloc] init]; parent = nil; −(void) setChilds: (id) childs f progress = 0; ASSIGN ( childs, childs); return self; g g −(void) removeChild: (id) child f /∗ Destructeur ∗/ [ childs removeObject: child]; g −(void) dealloc f RELEASE( childs); − (void) encodeWithCoder: (NSCoder∗) coder RELEASE( note); f RELEASE( description); [coder encodeObject: description]; [super dealloc]; [coder encodeObject: note]; g [coder encodeValueOfObjCType: @encode (int) at: & progress]; /∗ Accesseurs ∗/ [coder encodeObject: parent]; [coder encodeObject: childs]; −(NSString ∗) desc f return description; g g −(NSString ∗) note f return note; g −(int) progress; f return progress; g − (id) initWithCoder: (NSCoder∗) coder f −(NSArray ∗) childs f return childs; g 3 if (self = [super init]) Creation´ de l’interface graphique f [self setDescription: [coder <Pour le novice ou l’utilisateur occasionnel, l’in- decodeObject]]; terface doit etrˆ e simple et facile a` apprendre [self setNote: [coder et a` retenir. Elle ne devrait pas necessiter´ un decodeObject]]; reapr´ entissage apres` une longue absence de l’or- [coder decodeValueOfObjCType: dinateur.> @encode (int) at: & progress (guide de l’interface NeXT) ]; [self setParent: [coder Lancez Gorm : openapp Gorm.app. decodeObject]]; Creons´ une nouvelle application : Document!New Ap- [self setChilds: [coder plication. decodeObject]]; g return self; g @end La Vue Memeˆ si il est tout a` fait possible de dev´ elopper l’in- terface
Recommended publications
  • Source Code Trees in the VALLEY of THE
    PROGRAMMING GNOME Source code trees IN THE VALLEY OF THE CODETHORSTEN FISCHER So you’ve just like the one in Listing 1. Not too complex, eh? written yet another Unfortunately, creating a Makefile isn’t always the terrific GNOME best solution, as assumptions on programs program. Great! But locations, path names and others things may not be does it, like so many true in all cases, forcing the user to edit the file in other great programs, order to get it to work properly. lack something in terms of ease of installation? Even the Listing 1: A simple Makefile for a GNOME 1: CC=/usr/bin/gcc best and easiest to use programs 2: CFLAGS=`gnome-config —cflags gnome gnomeui` will cause headaches if you have to 3: LDFLAGS=`gnome-config —libs gnome gnomeui` type in lines like this, 4: OBJ=example.o one.o two.o 5: BINARIES=example With the help of gcc -c sourcee.c gnome-config —libs —cflags 6: gnome gnomeui gnomecanvaspixbuf -o sourcee.o 7: all: $(BINARIES) Automake and Autoconf, 8: you can create easily perhaps repeated for each of the files, and maybe 9: example: $(OBJ) with additional compiler flags too, only to then 10: $(CC) $(LDFLAGS) -o $@ $(OBJ) installed source code demand that everything is linked. And at the end, 11: do you then also have to copy the finished binary 12: .c.o: text trees. Read on to 13: $(CC) $(CFLAGS) -c $< manually into the destination directory? Instead, 14: find out how. wouldn’t you rather have an easy, portable and 15: clean: quick installation process? Well, you can – if you 16: rm -rf $(OBJ) $(BINARIES) know how.
    [Show full text]
  • Beginning Portable Shell Scripting from Novice to Professional
    Beginning Portable Shell Scripting From Novice to Professional Peter Seebach 10436fmfinal 1 10/23/08 10:40:24 PM Beginning Portable Shell Scripting: From Novice to Professional Copyright © 2008 by Peter Seebach All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-1043-6 ISBN-10 (pbk): 1-4302-1043-5 ISBN-13 (electronic): 978-1-4302-1044-3 ISBN-10 (electronic): 1-4302-1044-3 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Frank Pohlmann Technical Reviewer: Gary V. Vaughan Editorial Board: Clay Andres, Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Richard Dal Porto Copy Editor: Kim Benbow Associate Production Director: Kari Brooks-Copony Production Editor: Katie Stence Compositor: Linda Weidemann, Wolf Creek Press Proofreader: Dan Shaw Indexer: Broccoli Information Management Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013.
    [Show full text]
  • The GNOME Desktop Environment
    The GNOME desktop environment Miguel de Icaza ([email protected]) Instituto de Ciencias Nucleares, UNAM Elliot Lee ([email protected]) Federico Mena ([email protected]) Instituto de Ciencias Nucleares, UNAM Tom Tromey ([email protected]) April 27, 1998 Abstract We present an overview of the free GNU Network Object Model Environment (GNOME). GNOME is a suite of X11 GUI applications that provides joy to users and hackers alike. It has been designed for extensibility and automation by using CORBA and scripting languages throughout the code. GNOME is licensed under the terms of the GNU GPL and the GNU LGPL and has been developed on the Internet by a loosely-coupled team of programmers. 1 Motivation Free operating systems1 are excellent at providing server-class services, and so are often the ideal choice for a server machine. However, the lack of a consistent user interface and of consumer-targeted applications has prevented free operating systems from reaching the vast majority of users — the desktop users. As such, the benefits of free software have only been enjoyed by the technically savvy computer user community. Most users are still locked into proprietary solutions for their desktop environments. By using GNOME, free operating systems will have a complete, user-friendly desktop which will provide users with powerful and easy-to-use graphical applications. Many people have suggested that the cause for the lack of free user-oriented appli- cations is that these do not provide enough excitement to hackers, as opposed to system- level programming. Since most of the GNOME code had to be written by hackers, we kept them happy: the magic recipe here is to design GNOME around an adrenaline response by trying to use exciting models and ideas in the applications.
    [Show full text]
  • The Glib/GTK+ Development Platform
    The GLib/GTK+ Development Platform A Getting Started Guide Version 0.8 Sébastien Wilmet March 29, 2019 Contents 1 Introduction 3 1.1 License . 3 1.2 Financial Support . 3 1.3 Todo List for this Book and a Quick 2019 Update . 4 1.4 What is GLib and GTK+? . 4 1.5 The GNOME Desktop . 5 1.6 Prerequisites . 6 1.7 Why and When Using the C Language? . 7 1.7.1 Separate the Backend from the Frontend . 7 1.7.2 Other Aspects to Keep in Mind . 8 1.8 Learning Path . 9 1.9 The Development Environment . 10 1.10 Acknowledgments . 10 I GLib, the Core Library 11 2 GLib, the Core Library 12 2.1 Basics . 13 2.1.1 Type Definitions . 13 2.1.2 Frequently Used Macros . 13 2.1.3 Debugging Macros . 14 2.1.4 Memory . 16 2.1.5 String Handling . 18 2.2 Data Structures . 20 2.2.1 Lists . 20 2.2.2 Trees . 24 2.2.3 Hash Tables . 29 2.3 The Main Event Loop . 31 2.4 Other Features . 33 II Object-Oriented Programming in C 35 3 Semi-Object-Oriented Programming in C 37 3.1 Header Example . 37 3.1.1 Project Namespace . 37 3.1.2 Class Namespace . 39 3.1.3 Lowercase, Uppercase or CamelCase? . 39 3.1.4 Include Guard . 39 3.1.5 C++ Support . 39 1 3.1.6 #include . 39 3.1.7 Type Definition . 40 3.1.8 Object Constructor . 40 3.1.9 Object Destructor .
    [Show full text]
  • Autotools Tutorial
    Autotools Tutorial Mengke HU ECE Department Drexel University ASPITRG Group Meeting Outline 1 Introduction 2 GNU Coding standards 3 Autoconf 4 Automake 5 Libtools 6 Demonstration The Basics of Autotools 1 The purpose of autotools I It serves the needs of your users (checking platform and libraries; compiling and installing ). I It makes your project incredibly portablefor dierent system platforms. 2 Why should we use autotools: I A lot of free softwares target Linux operating system. I Autotools allow your project to build successfully on future versions or distributions with virtually no changes to the build scripts. The Basics of Autotools 1 The purpose of autotools I It serves the needs of your users (checking platform and libraries; compiling and installing ). I It makes your project incredibly portablefor dierent system platforms. 2 Why should we use autotools: I A lot of free softwares target Linux operating system. I Autotools allow your project to build successfully on future versions or distributions with virtually no changes to the build scripts. The Basics of Autotools 1 3 GNU packages for GNU build system I Autoconf Generate a conguration script for a project I Automake Simplify the process of creating consistent and functional makeles I Libtool Provides an abstraction for the portable creation of shared libraries 2 Basic steps (commends) to build and install software I tar -zxvf package_name-version.tar.gz I cd package_name-version I ./congure I make I sudo make install The Basics of Autotools 1 3 GNU packages for GNU build
    [Show full text]
  • Download Chapter 3: "Configuring Your Project with Autoconf"
    CONFIGURING YOUR PROJECT WITH AUTOCONF Come my friends, ’Tis not too late to seek a newer world. —Alfred, Lord Tennyson, “Ulysses” Because Automake and Libtool are essen- tially add-on components to the original Autoconf framework, it’s useful to spend some time focusing on using Autoconf without Automake and Libtool. This will provide a fair amount of insight into how Autoconf operates by exposing aspects of the tool that are often hidden by Automake. Before Automake came along, Autoconf was used alone. In fact, many legacy open source projects never made the transition from Autoconf to the full GNU Autotools suite. As a result, it’s not unusual to find a file called configure.in (the original Autoconf naming convention) as well as handwritten Makefile.in templates in older open source projects. In this chapter, I’ll show you how to add an Autoconf build system to an existing project. I’ll spend most of this chapter talking about the fundamental features of Autoconf, and in Chapter 4, I’ll go into much more detail about how some of the more complex Autoconf macros work and how to properly use them. Throughout this process, we’ll continue using the Jupiter project as our example. Autotools © 2010 by John Calcote Autoconf Configuration Scripts The input to the autoconf program is shell script sprinkled with macro calls. The input stream must also include the definitions of all referenced macros—both those that Autoconf provides and those that you write yourself. The macro language used in Autoconf is called M4. (The name means M, plus 4 more letters, or the word Macro.1) The m4 utility is a general-purpose macro language processor originally written by Brian Kernighan and Dennis Ritchie in 1977.
    [Show full text]
  • Linux for EDA Open-Source Development Tools
    Linux for EDA Open-Source Development Tools Stephen A. Edwards Columbia University Department of Computer Science [email protected] http://www.cs.columbia.edu/˜sedwards Espresso An example project: Berkeley’s Espresso two-level minimizer. 18k LOC total in 59 .c files and 17 .h files. Written in C in pre-ANSI days. Ported extensively. Supports ANSI C and K&R C on VAX, SunOS 3 & 4, Ultrix, Sequent, HPUX, and Apollo. Autoconf A modern approach to cross-platform portability. How do you compile a program on multiple platforms? • Multiple code bases • Single code base sprinkled with platform-checking #ifdefs • Single code base with platform-checking #ifdefs confined to a few files: (#include "platform.h") • Single code base with feature-specific #ifdefs computed by a script that tests each feature Autoconf Basic configure.ac: AC_INIT(espresso.c) AM_INIT_AUTOMAKE(espresso, 2.3) AC_PROG_CC AC_LANG(C) AC_CONFIG_FILES([Makefile]) AC_OUTPUT Autoconf $ autoconf $ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk ... checking dependency style of gcc... gcc3 configure: creating ./config.status config.status: creating Makefile config.status: executing depfiles commands $ ls Makefile Makefile $ Espresso’s port.h (fragment) #ifdef __STDC__ #include <stdlib.h> #else #ifdef hpux extern int abort(); extern void free(), exit(), perror(); #else extern VOID_HACK abort(), free(), exit(), perror(); #endif /* hpux */ extern char *getenv(), *malloc(), *realloc(),
    [Show full text]
  • Latexsample-Thesis
    INTEGRAL ESTIMATION IN QUANTUM PHYSICS by Jane Doe A dissertation submitted to the faculty of The University of Utah in partial fulfillment of the requirements for the degree of Doctor of Philosophy Department of Mathematics The University of Utah May 2016 Copyright c Jane Doe 2016 All Rights Reserved The University of Utah Graduate School STATEMENT OF DISSERTATION APPROVAL The dissertation of Jane Doe has been approved by the following supervisory committee members: Cornelius L´anczos , Chair(s) 17 Feb 2016 Date Approved Hans Bethe , Member 17 Feb 2016 Date Approved Niels Bohr , Member 17 Feb 2016 Date Approved Max Born , Member 17 Feb 2016 Date Approved Paul A. M. Dirac , Member 17 Feb 2016 Date Approved by Petrus Marcus Aurelius Featherstone-Hough , Chair/Dean of the Department/College/School of Mathematics and by Alice B. Toklas , Dean of The Graduate School. ABSTRACT Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah.
    [Show full text]
  • Macports Guide
    11/28/11 MacPorts Guide Single Page Chunked MacPorts Guide Mark Duling Dr. Michael A Maibaum Will Barton Copyright © 2007-2011 The MacPorts Project Copyright © 2002, 2003, 2004 The OpenDarwin Project Chapter 1. Introduction MacPorts is an easy to use system for compiling, installing, and managing open source software. MacPorts may be conceptually divided into two main parts: the infrastructure, known as MacPorts base, and the set of available ports. A MacPorts port is a set of specifications contained in a Portfile that defines an application, its characteristics, and any files or special instructions required to install it. This allows you to use a single command to tell MacPorts to automatically download, compile, and install applications and libraries. But using MacPorts to manage your open source software provides several other significant advantages. For example, MacPorts: Installs automatically any required support software, known as dependencies, for a given port. Provides for uninstalls and upgrades for installed ports. Confines ported software to a private “sandbox” that keeps it from intermingling with your operating system and its vendor-supplied software to prevent them from becoming corrupted. Allows you to create pre-compiled binary installers of ported applications to quickly install software on remote computers without compiling from source code. MacPorts is developed on Mac OS X, though it is designed to be portable so it can work on other Unix-like systems, especially those descended from the Berkeley Software Distribution (BSD). The following notational conventions are used in the MacPorts Guide to distinguish between terminal input/output, file text, and other special text types.
    [Show full text]
  • Chapter 7: Portable Makefiles
    ,ch07.5616 Page 129 Friday, March 25, 2005 2:41 PM Chapter 7 CHAPTER 7 Portable Makefiles What do we mean by a portable makefile? As an extreme example, we want a makefile that runs without change on any system that GNU make runs on. But this is virtually impossible due to the enormous variety in operating systems. A more rea- sonable interpretation is a makefile that is easy to change for each new platform it is run on. An important added constraint is that the port to the new system does not break support for the previous platforms. We can achieve this level of portability for makefiles using the same techniques as traditional programming: encapsulation and abstraction. By using variables and user- defined functions we can encapsulate applications and algorithms. By defining vari- ables for command-line arguments and parameters, we can abstract out elements that vary from platform to platform from elements that are constant. You then have to determine what tools each platform offers to get your job done, and what to use from each platform. The extreme in portability is to use only those tools and features that exist on all platforms of interest. This is typically called the “least common denominator” approach and obviously can leave you with very primi- tive functionality to work with. Another version of the least common denominator approach is to choose a powerful set of tools and make sure to bring it with you to every platform, thus guaranteeing that the commands you invoke in the makefile work exactly the same everywhere.
    [Show full text]
  • Debian Build Dependecies
    Debian build dependecies Valtteri Rahkonen valtteri.rahkonen@movial.fi Debian build dependecies by Valtteri Rahkonen Revision history Version: Author: Description: 2004-04-29 Rahkonen Changed title 2004-04-20 Rahkonen Added introduction, reorganized document 2004-04-19 Rahkonen Initial version Table of Contents 1. Introduction............................................................................................................................................1 2. Required source packages.....................................................................................................................2 2.1. Build dependencies .....................................................................................................................2 2.2. Misc packages .............................................................................................................................4 3. Optional source packages......................................................................................................................5 3.1. Build dependencies .....................................................................................................................5 3.2. Misc packages ...........................................................................................................................19 A. Required sources library dependencies ............................................................................................21 B. Optional sources library dependencies .............................................................................................22
    [Show full text]
  • GNU Coreutils Core GNU Utilities for Version 9.0, 20 September 2021
    GNU Coreutils Core GNU utilities for version 9.0, 20 September 2021 David MacKenzie et al. This manual documents version 9.0 of the GNU core utilities, including the standard pro- grams for text and file manipulation. Copyright c 1994{2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". i Short Contents 1 Introduction :::::::::::::::::::::::::::::::::::::::::: 1 2 Common options :::::::::::::::::::::::::::::::::::::: 2 3 Output of entire files :::::::::::::::::::::::::::::::::: 12 4 Formatting file contents ::::::::::::::::::::::::::::::: 22 5 Output of parts of files :::::::::::::::::::::::::::::::: 29 6 Summarizing files :::::::::::::::::::::::::::::::::::: 41 7 Operating on sorted files ::::::::::::::::::::::::::::::: 47 8 Operating on fields ::::::::::::::::::::::::::::::::::: 70 9 Operating on characters ::::::::::::::::::::::::::::::: 80 10 Directory listing:::::::::::::::::::::::::::::::::::::: 87 11 Basic operations::::::::::::::::::::::::::::::::::::: 102 12 Special file types :::::::::::::::::::::::::::::::::::: 125 13 Changing file attributes::::::::::::::::::::::::::::::: 135 14 File space usage ::::::::::::::::::::::::::::::::::::: 143 15 Printing text :::::::::::::::::::::::::::::::::::::::
    [Show full text]