Add new port: lang/gnat_util

There are a number of GNAT tools that have to be build using the same
exact sources as the compiler that it serves.  Two examples of this are
GPRbuild and ASIS.  The latter is an important component of several other
language semantic tools.

Accordingly, a separate port is being created to build a static library
that need these compiler sources.  Incidentally, diverging sources is the
reason devel/gprbuild-aux stopped building after lang/gcc-aux was upgraded.
With this new scheme, this type of failure should no longer occur.

This is a dependency of the upcoming lang/asis port, and must be specified
as a build dependency by any port that needs ASIS.

Approved by: 	bapt (mentor)
This commit is contained in:
John Marino 2013-07-21 14:12:28 +00:00
parent 19c11e107b
commit dd06b54dc6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=323388
8 changed files with 389 additions and 0 deletions

View file

@ -101,6 +101,7 @@
SUBDIR += gjs
SUBDIR += gnat
SUBDIR += gnat-aux
SUBDIR += gnat_util
SUBDIR += gnatdroid-armv5
SUBDIR += gnatdroid-armv7
SUBDIR += gnatdroid-binutils

46
lang/gnat_util/Makefile Normal file
View file

@ -0,0 +1,46 @@
# Created by: John Marino <marino@FreeBSD.org>
# $FreeBSD$
PORTNAME= gnat_util
PORTVERSION= ${SNAPSHOT}
CATEGORIES= lang
MASTER_SITES= ${MASTER_SITE_GCC}
MASTER_SITE_SUBDIR= releases/gcc-${GCC_VERSION}
DISTNAME= gcc-${GCC_VERSION}
MAINTAINER= marino@FreeBSD.org
COMMENT= Library used to build GNAT tools such as ASIS
USES= ada
USE_BZIP2= yes
DISTINFO_FILE= ${.CURDIR}/../gcc-aux/distinfo
WRKSRC= ${WRKDIR}/${PORTNAME}
DESTINY= ${WRKDIR}/destino
MAKE_ENV= DESTDIR=${DESTINY} \
MAKEOBJDIR=${WRKSRC}/obj
.include "${.CURDIR}/Makefile.sources"
.include "${.CURDIR}/../gcc-aux/Makefile.version"
.include <bsd.port.pre.mk>
post-extract:
@${MKDIR} ${WRKSRC}/obj
.for F in Makefile gnat_util.gpr sdefault_adb.gnat_util
@${CP} ${FILESDIR}/${F} ${WRKSRC}/
.endfor
.for F in ${GNAT_SRCS}
@${CP} ${WRKDIR}/${DISTNAME}/gcc/ada/${F} ${WRKSRC}/
.endfor
post-install:
${CP} -pR ${DESTINY}${PREFIX}/ ${PREFIX}/
@cd ${DESTINY}${PREFIX}; ${FIND} * \( -type f -or -type l \) | \
${SORT} > ${WRKDIR}/PLIST.all
@cd ${DESTINY}${PREFIX}; ${FIND} * -type d | ${AWK} '/\//' | \
${SORT} -r | ${SED} -e '/lib\/gnat$$/d' -e 's/^/@dirrm /g' \
>> ${WRKDIR}/PLIST.all
@echo "@unexec rmdir %D/lib/gnat 2>/dev/null || true" >> ${WRKDIR}/PLIST.all
@${CAT} ${WRKDIR}/PLIST.all >> ${TMPPLIST}
.include <bsd.port.post.mk>

View file

@ -0,0 +1,162 @@
# $FreeBSD$
GNAT_SRCS= \
ali-util.adb \
ali-util.ads \
ali.adb \
ali.ads \
alloc.ads \
aspects.adb \
aspects.ads \
atree.adb \
atree.ads \
binderr.adb \
binderr.ads \
butil.adb \
butil.ads \
casing.adb \
casing.ads \
csets.adb \
csets.ads \
debug.adb \
debug.ads \
einfo.adb \
einfo.ads \
elists.adb \
elists.ads \
err_vars.ads \
errout.adb \
errout.ads \
erroutc.adb \
erroutc.ads \
errutil.adb \
errutil.ads \
fmap.adb \
fmap.ads \
fname-uf.adb \
fname-uf.ads \
fname.adb \
fname.ads \
gnatvsn.adb \
gnatvsn.ads \
hostparm.ads \
krunch.adb \
krunch.ads \
lib-list.adb \
lib-sort.adb \
lib.adb \
lib.ads \
link.c \
makeutl.adb \
makeutl.ads \
mlib-fil.adb \
mlib-fil.ads \
mlib-tgt-specific.adb \
mlib-tgt-specific.ads \
mlib-tgt-vms_common.adb \
mlib-tgt-vms_common.ads \
mlib-tgt.adb \
mlib-tgt.ads \
mlib-utl.adb \
mlib-utl.ads \
mlib.adb \
mlib.ads \
namet.adb \
namet.ads \
nlists.adb \
nlists.ads \
opt.adb \
opt.ads \
osint.adb \
osint.ads \
output.adb \
output.ads \
prj-attr-pm.adb \
prj-attr-pm.ads \
prj-attr.adb \
prj-attr.ads \
prj-com.ads \
prj-conf.adb \
prj-conf.ads \
prj-dect.adb \
prj-dect.ads \
prj-env.adb \
prj-env.ads \
prj-err.adb \
prj-err.ads \
prj-ext.adb \
prj-ext.ads \
prj-nmsc.adb \
prj-nmsc.ads \
prj-part.adb \
prj-part.ads \
prj-pp.adb \
prj-pp.ads \
prj-proc.adb \
prj-proc.ads \
prj-strt.adb \
prj-strt.ads \
prj-tree.adb \
prj-tree.ads \
prj-util.adb \
prj-util.ads \
prj.adb \
prj.ads \
repinfo.adb \
repinfo.ads \
restrict.adb \
restrict.ads \
rident.ads \
scans.adb \
scans.ads \
scng.adb \
scng.ads \
sdefault.ads \
sem_aux.adb \
sem_aux.ads \
sinfo.adb \
sinfo.ads \
sinput-c.adb \
sinput-c.ads \
sinput-p.adb \
sinput-p.ads \
sinput.adb \
sinput.ads \
snames.adb-tmpl \
snames.ads-tmpl \
snames.h-tmpl \
stand.adb \
stand.ads \
stringt.adb \
stringt.ads \
styleg.adb \
styleg.ads \
stylesw.adb \
stylesw.ads \
switch-m.adb \
switch-m.ads \
switch.adb \
switch.ads \
table.adb \
table.ads \
targparm.adb \
targparm.ads \
tempdir.adb \
tempdir.ads \
tree_in.adb \
tree_in.ads \
tree_io.adb \
tree_io.ads \
types.adb \
types.ads \
uintp.adb \
uintp.ads \
uname.adb \
uname.ads \
urealp.adb \
urealp.ads \
widechar.adb \
widechar.ads \
xsnamest.adb \
xutil.adb \
xutil.ads

View file

@ -0,0 +1,69 @@
# To avoid a cirular dependency with GPRBuild, this custom BSD Makefile is
# used instead of the provided asis.gpr file.
# $FreeBSD$
CP=cp -p
MKDIR=mkdir -p
SRC=gen_src
ADA_FLAGS= -O2 -gnatn -gnatws -gnat05
C_FLAGS= -O2
ADB_SRCS!= cd ${.CURDIR} && ls *.adb | sort -r
GEN_SRCS= sdefault.adb snames.adb xsnamest.adb
ADS_SRCS= rident.ads hostparm.ads err_vars.ads alloc.ads prj-com.ads
LIB_SRCS+= link.c ${GEN_SRCS} ${ADS_SRCS} ${ADB_SRCS:Nlib-*.adb}
LIB_OBJS= ${LIB_SRCS:R:S/$/.o/}
.PHONY: all
.PHONY: generate_sources
.PHONY: libgnat_util.a
.PHONY: install
.PHONY: clean
all: libgnat_util.a
generate_sources:
(cd ${.CURDIR} && ${MKDIR} ${SRC} lib)
${CP} ${.CURDIR}/sdefault_adb.gnat_util ${.CURDIR}/${SRC}/sdefault.adb
(cd ${.CURDIR} && ${CP} \
xsnamest.adb xutil.* snames.adb-tmpl snames.ads-tmpl \
snames.h-tmpl ${SRC})
(cd ${.CURDIR}/${SRC} && \
gnatmake -gnatf -gnatwae -gnatyg -gnatyS xsnamest && \
./xsnamest && mv snames.ns snames.ads && mv snames.nb snames.adb)
${LIB_OBJS}: generate_sources
install:
${MKDIR} ${DESTDIR}${PREFIX}/lib/gnat
${MKDIR} ${DESTDIR}${PREFIX}/lib/gnat_util
${MKDIR} ${DESTDIR}${PREFIX}/include/gnat_util
${BSD_INSTALL_DATA} ../gnat_util.gpr ${DESTDIR}${PREFIX}/lib/gnat
find ../lib -type f -exec $(BSD_INSTALL_DATA) {} \
${DESTDIR}${PREFIX}/lib/gnat_util \;
find ../* -name \*\.ad\[bs\] -exec $(BSD_INSTALL_DATA) {} \
${DESTDIR}${PREFIX}/include/gnat_util \;
clean:
rm -f ${.OBJDIR}/*
rm -f ${.CURDIR}/lib/*
rm -rf ${.CURDIR}/${SRC}
.SUFFIXES: .adb .ads .c .o
.adb.o:
ada ${ADA_FLAGS} -I../ -I../${SRC} -c ../${.TARGET:R}.adb
.c.o:
${CC} ${C_FLAGS} -c ../${.TARGET:R}.c
${ADS_SRCS:R:S/$/.o/}:
ada ${ADA_FLAGS} -I../${SRC} -c ../${.TARGET:R}.ads
${GEN_SRCS:R:S/$/.o/}:
ada ${ADA_FLAGS} -I../ -c ../${SRC}/${.TARGET:R}.adb
libgnat_util.a: ${LIB_OBJS}
ar cq ${.TARGET} `lorder ${LIB_OBJS} | tsort -q`
ranlib ${.TARGET}
mv ${.TARGET} *.ali ../lib

View file

@ -0,0 +1,7 @@
project Gnat_Util is
for Languages use ("ada", "C");
for Library_Name use "gnat_util";
for Library_Dir use "../gnat_util";
for Source_Dirs use ("../../include/gnat_util");
for Externally_Built use "true";
end Gnat_Util;

View file

@ -0,0 +1,36 @@
--- gnatvsn.adb.orig 2013-07-16 03:35:21.000000000 +0000
+++ gnatvsn.adb
@@ -53,32 +53,13 @@ package body Gnatvsn is
" FOR A PARTICULAR PURPOSE.";
end Gnat_Free_Software;
- type char_array is array (Natural range <>) of aliased Character;
- Version_String : char_array (0 .. Ver_Len_Max - 1);
- -- Import the C string defined in the (language-independent) source file
- -- version.c using the zero-based convention of the C language.
- -- The size is not the real one, which does not matter since we will
- -- check for the nul character in Gnat_Version_String.
- pragma Import (C, Version_String, "version_string");
-
-------------------------
-- Gnat_Version_String --
-------------------------
function Gnat_Version_String return String is
- S : String (1 .. Ver_Len_Max);
- Pos : Natural := 0;
begin
- loop
- exit when Version_String (Pos) = ASCII.NUL;
-
- S (Pos + 1) := Version_String (Pos);
- Pos := Pos + 1;
-
- exit when Pos = Ver_Len_Max;
- end loop;
-
- return S (1 .. Pos);
+ Return Gnat_Static_Version_String;
end Gnat_Version_String;
end Gnatvsn;

View file

@ -0,0 +1,59 @@
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S D E F A U L T --
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This is a dummy version of the body of Sdefault, used by gnat_util. It gets
-- copied to sdefault.adb by Makefile.gnat_util.
package body Sdefault is
Target : constant String_Ptr := new String'("no target");
function Include_Dir_Default_Name return String_Ptr is
begin
return null;
end Include_Dir_Default_Name;
function Object_Dir_Default_Name return String_Ptr is
begin
return null;
end Object_Dir_Default_Name;
function Target_Name return String_Ptr is
begin
return Target;
end Target_Name;
function Search_Dir_Prefix return String_Ptr is
begin
return null;
end Search_Dir_Prefix;
end Sdefault;

9
lang/gnat_util/pkg-descr Normal file
View file

@ -0,0 +1,9 @@
Gnat_Util is a library uniting a number of GNAT sources that are used by
different tools. At the moment Gnat_Util provides GNAT sources needed by ASIS,
GNATCOLL and Gprbuild. Its main purpose is allowing to simultaneously use
tools like ASIS and GNATCOLL (and other ones based on GNAT sources, if they
are to come), which would normally cause name conflicts between the same GNAT
sources that they use. Building both of them using same set of sources that
is Gnat_Util solves this problem.
WWW: http://libre.adacore.com