# vim: ft=make ts=4 sw=4 noet

NAME    = perl
VERSION = 5.42.2
GARTYPE = v2

DESCRIPTION = Practical Extraction and Report Language (Perl 5)
define BLURB
  Perl 5 is a highly capable, feature-rich programming language used for
  web development, system administration, text processing, and more.
endef

MASTER_SITES = http://cpan.org/src/5.0/
DISTFILES   += $(DISTNAME).tar.gz

LICENSE = Artistic

PACKAGES              += OZSWperl
SPKG_DESC_OZSWperl    = Perl 5 programming language
CATALOGNAME_OZSWperl  = perl
# Catch-all: leave PKGFILES_OZSWperl unset (GAR uses exclude-other-pkgs mechanism).

# Perl's own Configure is not autoconf; override CONFIGURE_SCRIPTS and
# CONFIGURE_ARGS completely (no DIRPATHS), then supply a pattern rule to
# invoke it as a shell script with -de (non-interactive defaults).
CONFIGURE_SCRIPTS = $(WORKSRC)/Configure

PERL_LDFLAGS = -static-libgcc -L$(BUILD_PREFIX)/lib -Wl,-R,$(BUILD_PREFIX)/lib
PERL_CCFLAGS = -include sys/vnode.h

CONFIGURE_ARGS  = -de
CONFIGURE_ARGS += -Dprefix=$(prefix)
CONFIGURE_ARGS += -Dcc=$(CC)
CONFIGURE_ARGS += -Dldflags="$(PERL_LDFLAGS)"
CONFIGURE_ARGS += -Dccflags="$(PERL_CCFLAGS)"
CONFIGURE_ARGS += -Dinstallman1dir=$(prefix)/share/man/man1
CONFIGURE_ARGS += -Dinstallman3dir=$(prefix)/share/man/man3
CONFIGURE_ARGS += -Dinstallsiteman1dir=$(prefix)/share/man/man1
CONFIGURE_ARGS += -Dinstallsiteman3dir=$(prefix)/share/man/man3
CONFIGURE_ARGS += -Uusedl
CONFIGURE_ARGS += -Duseshrplib=false

# Pattern rule to invoke Perl's non-autoconf Configure (a shell script).
# The stem $* is the source directory; we cd into it and run Configure
# with the CONFIGURE_ENV cleared to our controlled environment.
configure-%/Configure:
	@echo " ==> Running Perl Configure in $*"
	cd $* && /usr/bin/env -i $(CONFIGURE_ENV) sh Configure $(CONFIGURE_ARGS)
	@$(MAKECOOKIE)

include gar/category.mk
