summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarino <marino@pkgsrc.org>2014-04-30 16:25:20 +0000
committermarino <marino@pkgsrc.org>2014-04-30 16:25:20 +0000
commite8b5e0b45c4e94880ca787a46a4c76339d121490 (patch)
treef195ca7b8ddee3dffc4d0488770163dd018d72be
parent6cba22adc78581f73def32077bede06e9e7a93f2 (diff)
downloadpkgsrc-e8b5e0b45c4e94880ca787a46a4c76339d121490.tar.gz
Add new source package: lang/gnat_util
Several tools are built with GNAT sources and they have to be the exact source that built the Ada compiler that builds the tool. To ensure this, a common trick to the create a library with those sources and link the library instead of using the embedded source files which never match the FSF compiler properly. The first tool this new gcc 4.9.0-based library will be used for is devel/gprbuild-aux
-rw-r--r--lang/Makefile3
-rw-r--r--lang/gnat_util/DESCR2
-rw-r--r--lang/gnat_util/Makefile33
-rw-r--r--lang/gnat_util/Makefile.sources162
-rw-r--r--lang/gnat_util/buildlink3.mk13
-rw-r--r--lang/gnat_util/distinfo6
-rw-r--r--lang/gnat_util/files/Makefile68
-rw-r--r--lang/gnat_util/files/gnat_util.gpr7
-rw-r--r--lang/gnat_util/files/sdefault_adb.gnat_util59
-rw-r--r--lang/gnat_util/patches/patch-gnatvsn.adb40
10 files changed, 392 insertions, 1 deletions
diff --git a/lang/Makefile b/lang/Makefile
index d75238cacdd..37385f1bc5a 100644
--- a/lang/Makefile
+++ b/lang/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.374 2014/04/22 20:50:49 ryoon Exp $
+# $NetBSD: Makefile,v 1.375 2014/04/30 16:25:20 marino Exp $
#
COMMENT= Programming languages
@@ -73,6 +73,7 @@ SUBDIR+= ghc
SUBDIR+= ghc-bootstrap
SUBDIR+= ghc7
SUBDIR+= gnat-aux
+SUBDIR+= gnat_util
SUBDIR+= go
SUBDIR+= gpc
SUBDIR+= gprolog
diff --git a/lang/gnat_util/DESCR b/lang/gnat_util/DESCR
new file mode 100644
index 00000000000..a03f7d745f3
--- /dev/null
+++ b/lang/gnat_util/DESCR
@@ -0,0 +1,2 @@
+Gnat_Util is a library unit consisting of GNAT sources that are used by
+different tools such as ASIS, GNATCOLL and Gprbuild.
diff --git a/lang/gnat_util/Makefile b/lang/gnat_util/Makefile
new file mode 100644
index 00000000000..07e6451318e
--- /dev/null
+++ b/lang/gnat_util/Makefile
@@ -0,0 +1,33 @@
+# $NetBSD: Makefile,v 1.1 2014/04/30 16:25:20 marino Exp $
+
+PKGNAME= gnat_util-${SNAPSHOT}
+CATEGORIES= lang
+MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/}
+DISTFILES= gcc-${GCC_VERSION}.tar.bz2
+
+MAINTAINER= draco@marino.st
+HOMEPAGE= http://www.dragonlace.net/
+COMMENT= Library used to build GNAT source-based tools
+LICENSE= gnu-gpl-v3 AND gnu-lgpl-v3
+
+.include "../../mk/bsd.prefs.mk"
+.include "../../lang/gcc-aux/Makefile.version"
+.include "Makefile.sources"
+
+MAKE_ENV= MAKEOBJDIR=${WRKSRC}/obj
+USE_LANGUAGES= c ada
+
+# Automatic package list generation
+GENERATE_PLIST= cd ${DESTDIR}${PREFIX};
+GENERATE_PLIST+= ${FIND} * \( -type f -or -type l \) | ${SORT} -dr;
+
+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}/gcc-${GCC_VERSION}/gcc/ada/${f} ${WRKSRC}/
+.endfor
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/lang/gnat_util/Makefile.sources b/lang/gnat_util/Makefile.sources
new file mode 100644
index 00000000000..4a77f18e9b5
--- /dev/null
+++ b/lang/gnat_util/Makefile.sources
@@ -0,0 +1,162 @@
+# $NetBSD: Makefile.sources,v 1.1 2014/04/30 16:25:20 marino Exp $
+
+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
diff --git a/lang/gnat_util/buildlink3.mk b/lang/gnat_util/buildlink3.mk
new file mode 100644
index 00000000000..d7493766f5f
--- /dev/null
+++ b/lang/gnat_util/buildlink3.mk
@@ -0,0 +1,13 @@
+# $NetBSD: buildlink3.mk,v 1.1 2014/04/30 16:25:20 marino Exp $
+
+BUILDLINK_TREE+= gnat_util
+
+.if !defined(GNAT_UTIL_BUILDLINK3_MK)
+GNAT_UTIL_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.gnat_util+= gnat_util>=20140422
+BUILDLINK_PKGSRCDIR.gnat_util?= ../../lang/gnat_util
+
+.endif
+
+BUILDLINK_TREE+= -gnat_util
diff --git a/lang/gnat_util/distinfo b/lang/gnat_util/distinfo
new file mode 100644
index 00000000000..a457300a026
--- /dev/null
+++ b/lang/gnat_util/distinfo
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.1 2014/04/30 16:25:20 marino Exp $
+
+SHA1 (gcc-4.9.0.tar.bz2) = fbde8eb49f2b9e6961a870887cf7337d31cd4917
+RMD160 (gcc-4.9.0.tar.bz2) = ac561660744127fa009ae75202d1ac81ac8d7668
+Size (gcc-4.9.0.tar.bz2) = 89677407 bytes
+SHA1 (patch-gnatvsn.adb) = 1e16dba2500abf090b05484567cc0f1a2327c350
diff --git a/lang/gnat_util/files/Makefile b/lang/gnat_util/files/Makefile
new file mode 100644
index 00000000000..57f09ff46d9
--- /dev/null
+++ b/lang/gnat_util/files/Makefile
@@ -0,0 +1,68 @@
+# To avoid a cirular dependency with GPRBuild, this custom BSD Makefile is
+# used instead of the provided asis.gpr file.
+
+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
diff --git a/lang/gnat_util/files/gnat_util.gpr b/lang/gnat_util/files/gnat_util.gpr
new file mode 100644
index 00000000000..bb3ee72b30a
--- /dev/null
+++ b/lang/gnat_util/files/gnat_util.gpr
@@ -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;
diff --git a/lang/gnat_util/files/sdefault_adb.gnat_util b/lang/gnat_util/files/sdefault_adb.gnat_util
new file mode 100644
index 00000000000..e05606903be
--- /dev/null
+++ b/lang/gnat_util/files/sdefault_adb.gnat_util
@@ -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;
diff --git a/lang/gnat_util/patches/patch-gnatvsn.adb b/lang/gnat_util/patches/patch-gnatvsn.adb
new file mode 100644
index 00000000000..54547ed9643
--- /dev/null
+++ b/lang/gnat_util/patches/patch-gnatvsn.adb
@@ -0,0 +1,40 @@
+$NetBSD: patch-gnatvsn.adb,v 1.1 2014/04/30 16:25:21 marino Exp $
+
+version_string symbol won't exist, just use the static version
+
+--- 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;