From 2bf0dfd6a04f5dfb9798cabbd56fc49863b64172 Mon Sep 17 00:00:00 2001 From: Björn Persson Date: Sat, 13 Jul 2013 23:56:04 +0200 Subject: Redesigned the handling of relative pathnames. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit · Directory variables for embedding and for installation were separated. · Directory variables for embedding are now available in project Comfignat. · Relative pathnames are now relative to gprdir or bindir in different places. · Options are conveyed to build project files as external variables. · Gnatprep_definitions is now Gnatprep_arguments. · preprocess_file and builder_arguments were added. --- comfignat.gpr.gp | 248 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 201 insertions(+), 47 deletions(-) (limited to 'comfignat.gpr.gp') diff --git a/comfignat.gpr.gp b/comfignat.gpr.gp index fdbdcba..d5bcd78 100644 --- a/comfignat.gpr.gp +++ b/comfignat.gpr.gp @@ -26,85 +26,239 @@ abstract project Comfignat is - #if Objdir'Defined then - Objdir := $Objdir; - #else - Objdir := "build"; + #if not Invoked_By_Makefile'Defined then + + -- These variables are used in constructing the default values of the + -- directory variables below. They're only needed when this file is + -- preprocessed manually. + + #if Prefix'Defined then + Prefix := $Prefix; + #else + Prefix := "/usr/local"; + #end if; + -- Prefix is used in the default locations for almost all files. + + #if Exec_Prefix'Defined then + Exec_Prefix := $Exec_Prefix; + #else + Exec_Prefix := Prefix; + #end if; + -- Exec_Prefix is used in the default locations for programs, binary + -- libraries and other architecture-specific files. + + #if Datarootdir'Defined then + Datarootdir := $Datarootdir; + #else + Datarootdir := Prefix & "/share"; + #end if; + -- Datarootdir is the root of the directory tree for read-only + -- architecture-independent data files. + + #if Localstatedir'Defined then + Localstatedir := $Localstatedir; + #else + Localstatedir := Prefix & "/var"; + #end if; + -- Localstatedir is the root of the directory tree for data files that + -- programs modify while they run. + #end if; - -- Intermediate files produced during the build shall be kept in Objdir. - #if Directories_Project'Defined then - -- Put intermediate files for different architectures in subdirectories - -- where they won't conflict with each other. (This is useful especially - -- with binder files when they are packaged in debug information packages - -- for multiarch systems.) - Objdir := Objdir & "/" & $Directories_Project.Hardware_Platform; + + -- + -- The following variables may be compiled into programs or libraries to + -- tell them where to find or write different kinds of files at run time. + -- Most of the directory names are relative to Bindir if the software was + -- configured as a relocatable package. Otherwise they are absolute + -- pathnames. + + -- Programs that can be run from a command prompt are in Bindir. This is + -- normally the same directory that the program itself is in, so this + -- variable is probably of little use at run time. + #if Bindir'Defined then + Bindir := $Bindir; + #else + Bindir := Exec_Prefix & "/bin"; #end if; - #if Stagedir'Defined then - Stagedir := $Stagedir; + -- Programs that are intended to be run by other programs rather than by + -- users are under Libexecdir. + #if Libexecdir'Defined then + Libexecdir := $Libexecdir; #else - Stagedir := external("DESTDIR", ""); + Libexecdir := Exec_Prefix & "/libexec"; #end if; - -- Files to be installed shall be placed under Stagedir instead of the root - -- directory. - #if Base'Defined then - Prepath := Stagedir & $Base & "/"; + -- Idiosyncratic read-only architecture-independent data files are under an + -- application-specific subdirectory of Datadir. + #if Datadir'Defined then + Datadir := $Datadir; #else - Prepath := Stagedir; + Datadir := Datarootdir; #end if; - -- If Prefix, Exec_Prefix, Bindir, Libexecdir, Includedir and Libdir are - -- relative pathnames, then Base shall be the absolute pathname of the - -- directory that they are relative to. If those variables are absolute - -- pathnames, then Base shall be undefined. - #if Prefix'Defined then - Prefix := $Prefix; + -- Host-specific configuration files are under Sysconfdir. + #if Sysconfdir'Defined then + Sysconfdir := $Sysconfdir; #else - Prefix := "/usr/local"; + Sysconfdir := Prefix & "/etc"; #end if; - #if Exec_Prefix'Defined then - Exec_Prefix := $Exec_Prefix; + -- Idiosyncratic variable data files shall be kept under an application- + -- specific subdirectory of Statedir. + #if Statedir'Defined then + Statedir := $Statedir; #else - Exec_Prefix := Prefix; + Statedir := Localstatedir & "/lib"; #end if; - #if Bindir'Defined then - Bindir := $Bindir; + -- Cached data files that the application can regenerate if they are deleted + -- shall be kept under an application-specific subdirectory of Cachedir. + #if Cachedir'Defined then + Cachedir := $Cachedir; #else - Bindir := Exec_Prefix & "/bin"; + Cachedir := Localstatedir & "/cache"; #end if; - Stage_Bindir := Prepath & Bindir; - -- Programs that can be run from a command prompt shall be installed in - -- Stage_Bindir. - #if Libexecdir'Defined then - Libexecdir := $Libexecdir; + -- Log files shall be written under Logdir. + #if Logdir'Defined then + Logdir := $Logdir; #else - Libexecdir := Exec_Prefix & "/libexec"; + Logdir := Localstatedir & "/log"; #end if; - Stage_Libexecdir := Prepath & Libexecdir; - -- Programs that are only to be run by other programs, not by users, shall - -- be installed under Stage_Libexecdir. + -- Source files to be used in the compilation of software using libraries + -- are under Includedir. #if Includedir'Defined then Includedir := $Includedir; #else Includedir := Prefix & "/include"; #end if; - Stage_Includedir := Prepath & Includedir; - -- Source files needed for compiling code that uses a library shall be - -- installed under Stage_Includedir. + -- Binary libraries and other architecture-specific files are under Libdir. #if Libdir'Defined then Libdir := $Libdir; #else - Libdir := Prefix & "/lib"; + Libdir := Exec_Prefix & "/lib"; #end if; - Stage_Libdir := Prepath & Libdir; + + -- GNAT project files are under GPRdir. + #if GPRdir'Defined then + GPRdir := $GPRdir; + #else + GPRdir := Datarootdir & "/gpr"; + #end if; + + -- Locale-specific message catalogs are under Localedir. + #if Localedir'Defined then + Localedir := $Localedir; + #else + Localedir := Datarootdir & "/locale"; + #end if; + + -- Documentation in the Man format is under Mandir. + #if Mandir'Defined then + Mandir := $Mandir; + #else + Mandir := Datarootdir & "/man"; + #end if; + + -- Documentation in the Info format is in Infodir. + #if Infodir'Defined then + Infodir := $Infodir; + #else + Infodir := Datarootdir & "/info"; + #end if; + + -- Other documentation files are under an application-specific subdirectory + -- of Miscdocdir. + #if Miscdocdir'Defined then + Miscdocdir := $Miscdocdir; + #else + Miscdocdir := Datarootdir & "/doc"; + #end if; + + -- Small files that take part in describing the state of the system, and + -- that exist only while the program is running, such as process identifier + -- files and transient Unix-domain sockets, shall be created under + -- Runtimedir. (This is NOT the place for temporary files in general.) + #if Runtimedir'Defined then + Runtimedir := $Runtimedir; + #else + Runtimedir := "/run"; + #end if; + + -- Lock files that are used to prevent multiple programs from trying to + -- access a device or other resource at the same time shall be created under + -- Lockdir. + #if Lockdir'Defined then + Lockdir := $Lockdir; + #else + Lockdir := Runtimedir & "/lock"; + #end if; + + + -- + -- The following variables are for use in attributes to control where + -- generated files are placed. + -- + + -- Intermediate files produced during the build shall be kept in Objdir. + #if Objdir'Defined then + Objdir := $Objdir; + #else + Objdir := "build"; + #end if; + + #if Directories_Project'Defined then + -- Put intermediate files for different architectures in subdirectories + -- where they won't conflict with each other. (This is useful especially + -- with binder files when they are packaged in debug information packages + -- for multiarch systems.) + Objdir := Objdir & "/" & $Directories_Project.Hardware_Platform; + #end if; + + -- Files to be installed shall be placed under Stagedir instead of the root + -- directory. (This variable is unused by Comfignat when Make is used and no + -- directories project is provided.) + #if Stagedir'Defined then + Stagedir := $Stagedir; + #else + Stagedir := external("DESTDIR", ""); + #end if; + + -- Programs that can be run from a command prompt shall be installed in + -- Stage_Bindir. + #if Stage_Bindir'Defined then + Stage_Bindir := $Stage_Bindir; + #else + Stage_Bindir := Stagedir & Bindir; + #end if; + + -- Programs that are only to be run by other programs, not by users, shall + -- be installed under Stage_Libexecdir. + #if Stage_Libexecdir'Defined then + Stage_Libexecdir := $Stage_Libexecdir; + #else + Stage_Libexecdir := Stagedir & Libexecdir; + #end if; + + -- Source files needed for compiling code that uses a library shall be + -- installed under Stage_Includedir. + #if Stage_Includedir'Defined then + Stage_Includedir := $Stage_Includedir; + #else + Stage_Includedir := Stagedir & Includedir; + #end if; + -- Binary libraries shall be installed in Stage_Libdir. - -- ALI files shall be installed in a subdirectory of Stage_Libdir. + -- ALI files shall be installed in a library-specific subdirectory of + -- Stage_Libdir. + #if Stage_Libdir'Defined then + Stage_Libdir := $Stage_Libdir; + #else + Stage_Libdir := Stagedir & Libdir; + #end if; end Comfignat; -- cgit v1.2.3