Initial bsd.gnat.mk

freebsd-ports at coreland.ath.cx freebsd-ports at coreland.ath.cx
Sat Jan 2 21:00:51 UTC 2010


Hello.

This is an initial version of 'bsd.gnat.mk'.

A user may set USE_GNAT to 'gnat-gcc' or 'gnat-gpl', currently.

gnat-gcc selects lang/gnat-gcc44 and gnat-gpl selects lang/gnat
as the Ada compiler used to compile ports.

I have made gnat-gcc the default as it supports more architectures
(I've been unable to get gnat-gpl to build on AMD64 as it seems to
specifically lack support for it).

As shown, GNAT_GCC_CFLAGS may also be set. These are optional
compiler flags (like CFLAGS).

--8<---

#
# bsd.gnat.mk - GNAT Ada compiler selection.
#

#
# User settable knobs:
#
# Name               Default value      Description
# GNAT_GCC_CFLAGS    (empty)            Optional Ada compiler flags
#

GNAT_Include=            bsd.gnat.mk
GNAT_Include_MAINTAINER= freebsd-ports at coreland.ath.cx

# Default case - a current lang/gnat-gcc port.
.if ${USE_GNAT} == "yes" || ${USE_GNAT} == "gnat-gcc"

BUILD_DEPENDS+= gnat-gcc44:${PORTSDIR}/lang/gnat-gcc44
RUN_DEPENDS+= gnat-gcc44:${PORTSDIR}/lang/gnat-gcc44
GNAT_GCC:= gcc44
GNAT_BIND:= gnatbind
GNAT_LINK:= gnatlink

# GNAT GPL port.
.elif ${USE_GNAT} == "gnat-gpl"

BUILD_DEPENDS+= gnat-gpl:${PORTSDIR}/lang/gnat
RUN_DEPENDS+= gnat-gpl:${PORTSDIR}/lang/gnat
GNAT_GCC:= gnatgcc
GNAT_BIND:= gnatbind
GNAT_LINK:= gnatlink

.else
IGNORE= specifies unknown value "${USE_GNAT}" for USE_GNAT
.endif

test-gnat:
  @echo USE_GCC=${USE_GCC}
  @echo GNAT_GCC=${GNAT_GCC}
  @echo BUILD_DEPENDS=${BUILD_DEPENDS}
  @echo RUN_DEPENDS=${RUN_DEPENDS}

--8<---

An example of a port using this makefile:

--8<---

# New ports collection makefile for: sdl-ada
# Date created: 02 December 2009
# Whom: freebsd-ports at coreland.ath.cx
#
# $FreeBSD$
#

PORTNAME=       sdl-ada
PORTVERSION=    1.2.14
CATEGORIES=     devel
MASTER_SITES=   http://coreland.ath.cx/code/sdl-ada/src/

MAINTAINER=     freebsd-ports at coreland.ath.cx
COMMENT=        This is a set of Ada bindings to the SDL library.

USE_GNAT=yes

post-patch:
        @${ECHO_CMD} "${GNAT_GCC}"                            > "${WRKSRC}/conf-adacomp"
        @${ECHO_CMD} "${GNAT_GCC_CFLAGS}"                     > "${WRKSRC}/conf-adacflags"
        @${ECHO_CMD} "${GNAT_BIND}"                           > "${WRKSRC}/conf-adabind"
        @${ECHO_CMD} "${GNAT_LINK}"                           > "${WRKSRC}/conf-adalink"
        @${ECHO_CMD} "${CC}"                                  > "${WRKSRC}/conf-cc"
        @${ECHO_CMD} "${CFLAGS}"                              > "${WRKSRC}/conf-cflags"
        @${ECHO_CMD} "${LD}"                                  > "${WRKSRC}/conf-ld"
        @${ECHO_CMD} "${PREFIX}/bin"                          > "${WRKSRC}/conf-bindir"
        @${ECHO_CMD} "${PREFIX}/include/coreland/sdl-ada"     > "${WRKSRC}/conf-incdir"
        @${ECHO_CMD} "${PREFIX}/lib/coreland/sdl-ada-static"  > "${WRKSRC}/conf-slibdir"
        @${ECHO_CMD} "${PREFIX}/lib/coreland/sdl-ada"         > "${WRKSRC}/conf-dlibdir"
        @${ECHO_CMD} "${PREFIX}/share/coreland/sdl-ada-repos" > "${WRKSRC}/conf-repos"
        .if defined(DESTDIR) 
                @${ECHO_CMD} "${DESTDIR}" > "${WRKSRC}/conf-fakeroot"
        .endif

.include <bsd.port.mk>

--8<---

Comments welcome.

M


More information about the freebsd-ports mailing list