- Sync portmk with next exp-build patchset.

- Remove temporarily all eik's work. We'll try to find a decent way to deal
  with major changes. Of course we'll reuse his good ideas

List of changes (PR - synopsis)
85695 - Add bsd.database.mk.
85669 - bsd.ports.subdir.mk: Ports not escape plus signal in make search
85488 - [PATCH] New "makepatch: " target to help ports authors
86106 - ${CC} should be added to ${MAKE_ENV} when ${USE_GMAKE} is set
84489 - Depreciated MACHINE_ARCH being used in bsd.port.mk
83835 - Remove OpenLDAP ver. 21
83718 - Add bsd.tcl.mk for convinience for tcl/tk ports
83716 - Fix cosmetic bug in security-check target
83710 - Add INDEX-7
82753 - patch to add functionality to ports macro bsd.port.subdir.mk
82138 - [patch] timewaster: remove old versions from bsd.port.mk
81206 - new category proposal: net-im
79509 - add .desktop file facilities to bsd.port.mk
79123 - [patch] bsd.port.mk - add SHA256 support to "make checksum"
74866 - Update Mk/bsd.port.mk to support python packages with OPTIONS
73797 - Be causious compiling with -O2 (use -fno-strict-aliasing)
85490 - [PATCH] If WANT_LINT is set, port building can break
XXXXX - Add bsd.apache.mk
This commit is contained in:
Clement Laforet 2005-09-18 20:34:12 +00:00
parent 527e44de90
commit e7b1560f4f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=143098
26 changed files with 13124 additions and 13330 deletions

View file

@ -0,0 +1,347 @@
#-*- mode: makefile; tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
# bsd.apache.mk - Apache related macros.
# Author: Clement Laforet <clement@FreeBSD.org>
#
# Please view me with 4 column tabs!
##########################################################################
#
# Variables definition
# USE_APACHE: Call this script. Values can be:
# <version>: 1.3/13/2.0/20/2.1/1.3+/2.0+/2.1+
# common*: common13, common20 and common21
# apr: deal with apr stuff ;-)
#
# Print warnings
_ERROR_MSG= : Error from bsd.apache.mk.
APACHE_SUPPORTED_VERSION= 13 20 21
.if ${USE_APACHE:Mcommon*} != ""
AP_PORT_IS_SERVER= YES
.elif ${USE_APACHE:L} == apr
APR_DEPS= YES
.elif ${USE_APACHE:C/\.//:C/\+//:M[12][310]} != ""
AP_PORT_IS_MODULE= YES
#### for backward compatibility
.elif ${USE_APACHE:L} == yes
APXS= ${LOCALBASE}/sbin/apxs
. if defined(WITH_APACHE2)
APACHE_PORT?= www/apache20
. else
APACHE_PORT?= www/apache13
. endif
APXS?= ${LOCALBASE}/sbin/apxs
BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
RUN_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
#### End of backward compatibility
.else
IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE
.endif
.if defined(AP_PORT_IS_SERVER)
# For slave ports:
.if defined(SLAVE_DESIGNED_FOR) && ${PORTVERSION} != ${SLAVE_DESIGNED_FOR}
IGNORE= "Sorry, ${SLAVENAME} and ${PORTNAME} versions are out of sync"
.endif
.if defined(SLAVE_PORT_MODULES)
DEFAULT_MODULES_CATEGORIES+= SLAVE_PORT
ALL_MODULES_CATEGORIES+= SLAVE_PORT
.endif
# Module selection
.for category in ${DEFAULT_MODULES_CATEGORIES}
DEFAULT_MODULES+= ${${category}_MODULES}
WITH_${category}_MODULES= YES
.endfor
.for category in ${ALL_MODULES_CATEGORIES}
AVAILABLE_MODULES+= ${${category}_MODULES}
.endfor
# Setting "@comment " as default.
.for module in ${AVAILABLE_MODULES}
${module}_PLIST_SUB= "@comment "
.endfor
# Configure
# dirty hacks to make sure all modules are disabled before we select them
.if ${USE_APACHE} == common13
CONFIGURE_ARGS+= --disable-module="all"
.elif ${USE_APACHE} == common20
CONFIGURE_ARGS+= --disable-access --disable-auth \
--disable-charset-lite --disable-include \
--disable-log-config --disable-env --disable-setenvif \
--disable-mime --disable-status --disable-autoindex \
--disable-asis --disable-cgid --disable-cgi \
--disable-negotiation --disable-dir --disable-imap \
--disable-actions --disable-userdir --disable-alias
.elif ${USE_APACHE} == common21
CONFIGURE_ARGS+= --disable-authn-file --disable-authn-default \
--disable-authz-host --disable-authz-groupfile \
--disable-authz-user --disable-authz-default \
--disable-auth-basic --disable-charset-lite \
--disable-include --disable-log-config --disable-env \
--disable-setenvif --disable-mime --disable-status \
--disable-autoindex --disable-asis --disable-cgid \
--disable-cgi --disable-negotiation --disable-dir \
--disable-imap --disable-actions --disable-userdir \
--disable-alias
.endif
.if defined(WITH_MODULES)
_APACHE_MODULES+= ${WITH_MODULES}
.else
.for category in ${ALL_MODULES_CATEGORIES}
.if defined (WITHOUT_${category}_MODULES) || defined (WITH_CUSTOM_${category})
. if defined(WITH_${category}_MODULES})
. undef WITH_${category}_MODULES
. endif
. if defined (WITH_CUSTOM_${category})
_APACHE_MODULES+= ${WITH_CUSTOM_${category}}
. endif
.elif defined(WITH_${category}_MODULES)
_APACHE_MODULES+= ${${category}_MODULES}
.endif
.endfor
. if defined(WITH_EXTRA_MODULES)
_APACHE_MODULES+= ${WITH_EXTRA_MODULES}
. endif
.endif
.if !defined(WITH_STATIC_APACHE)
. if ${USE_APACHE:Mcommon2*} != ""
# FYI
#DYNAMIC_MODULES= so
CONFIGURE_ARGS+= --enable-so
. endif
.else
. if ${USE_APACHE:Mcommon2*} != ""
CONFIGURE_ARGS+= --disable-so
. endif
WITH_ALL_STATIC_MODULES= YES
.endif
.if defined(WITH_SUEXEC) || defined(WITH_SUEXEC_MODULES)
.if ${USE_APACHE} == common13
SUEXEC_CONFARGS= suexec
CONFIGURE_ARGS+= --enable-suexec
.elif ${USE_APACHE:Mcommon2*} != ""
SUEXEC_CONFARGS= with-suexec
.endif
# From now we're defaulting to apache 2.*
SUEXEC_DOCROOT?= ${PREFIX}/www/data
SUEXEC_USERDIR?= public_html
SUEXEC_SAFEPATH?= ${PREFIX}/bin:${LOCALBASE}/bin:/usr/bin:/bin
SUEXEC_LOGFILE?= /var/log/httpd-suexec.log
SUEXEC_UIDMIN?= 1000
SUEXEC_GIDMIN?= 1000
SUEXEC_CALLER?= ${WWWOWN}
_APACHE_MODULES+= ${SUEXEC_MODULES}
CONFIGURE_ARGS+= --${SUEXEC_CONFARGS}-caller=${SUEXEC_CALLER} \
--${SUEXEC_CONFARGS}-uidmin=${SUEXEC_UIDMIN} \
--${SUEXEC_CONFARGS}-gidmin=${SUEXEC_GIDMIN} \
--${SUEXEC_CONFARGS}-userdir="${SUEXEC_USERDIR}" \
--${SUEXEC_CONFARGS}-docroot="${SUEXEC_DOCROOT}" \
--${SUEXEC_CONFARGS}-safepath="${SUEXEC_SAFEPATH}" \
--${SUEXEC_CONFARGS}-logfile="${SUEXEC_LOGFILE}" \
--${SUEXEC_CONFARGS}-bin="${PREFIX}/sbin/suexec"
. if defined(WITH_SUEXEC_UMASK)
CONFIGURE_ARGS+= --${SUEXEC_CONFARGS}-umask=${WITH_SUEXEC_UMASK}
. endif
.endif
.if !defined(WITHOUT_MODULES)
APACHE_MODULES= ${_APACHE_MODULES}
.else
APACHE_MODULES!= \
for module in ${_APACHE_MODULES}; do \
${ECHO_CMD} ${WITHOUT_MODULES} | ${GREP} -wq $${module} 2> /dev/null || \
${ECHO_CMD} $${module}; \
done
.endif
.if defined(WITH_STATIC_MODULES)
. if ${USE_APACHE} == common13
STATIC_MODULE_CONFARG= --enable-module=$${module}
DSO_MODULE_CONFARG= --enable-module=$${module} --enable-shared=$${module}
. else
STATIC_MODULE_CONFARG= --enable-$${module}
DSO_MODULE_CONFARG= --enable-$${module}=shared
.endif
_CONFIGURE_ARGS!= \
for module in ${APACHE_MODULES} ; do \
${ECHO_CMD} ${WITH_STATIC_MODULES} | \
${GREP} -wq $${module} 2> /dev/null ; \
if [ "$${?}" = "0" ] ; then \
${ECHO_CMD} "${STATIC_MODULE_CONFARG}"; \
else \
${ECHO_CMD} "${DSO_MODULE_CONFARG}"; \
fi; done
CONFIGURE_ARGS+= ${_CONFIGURE_ARGS}
.elif defined(WITH_STATIC_APACHE) || defined(WITH_ALL_STATIC_MODULES)
WITH_STATIC_MODULES= ${APACHE_MODULES}
. if ${USE_APACHE} == common13
. for module in ${APACHE_MODULES}
CONFIGURE_ARGS+= --enable-module=${module}
. endfor
. else
CONFIGURE_ARGS+= --enable-modules="${APACHE_MODULES}"
. endif
.else
. if ${USE_APACHE} == common13
. for module in ${APACHE_MODULES}
CONFIGURE_ARGS+= --enable-module=${module} --enable-shared=${module}
. endfor
. else
CONFIGURE_ARGS+= --enable-mods-shared="${APACHE_MODULES}"
. endif
.endif
.if defined(WITH_STATIC_MODULES)
_SHARED_MODULES!= \
for module in ${APACHE_MODULES} ; do \
${ECHO_CMD} ${WITH_STATIC_MODULES} | ${GREP} -wq $${module} 2> /dev/null || \
${ECHO_CMD} $${module}; \
done
SHARED_MODULES= ${_SHARED_MODULES}
.elif !defined(WITH_ALL_STATIC_MODULES)
SHARED_MODULES= ${APACHE_MODULES}
.endif
. for module in ${SHARED_MODULES}
${module}_PLIST_SUB= ""
. endfor
.for module in ${AVAILABLE_MODULES}
PLIST_SUB+= MOD_${module:U}=${${module}_PLIST_SUB}
.endfor
####End of PORT_IS_SERVER ####
.elif defined(APR_DEPS)
IGNORE= ${_ERROR_MSG} apr support is not yet implemented
.elif defined(AP_PORT_IS_MODULE)
AP_VERSION= ${USE_APACHE:C/\.//}
APXS?= ${LOCALBASE}/sbin/apxs
HTTPD?= ${LOCALBASE}/sbin/httpd
MODULENAME?= ${PORTNAME}
SHORTMODNAME?= ${MODULENAME:S/mod_//}
SRC_FILE?= ${MODULENAME}.c
OVERRIDABLE_VARS= SRC_FILE MODULENAME SHORTMODNAME WRKSRC \
PKGNAMESUFFIX
.if exists(${HTTPD})
AP_CUR_VERSION!= ${HTTPD} -V | ${SED} -ne 's/^Server version: Apache\/\([0-9]\)\.\([0-9]*\).*/\1\2/p'
. if ${AP_CUR_VERSION} > 13
APACHE_MPM!= ${APXS} -q MPM_NAME
. endif
.elif defined(APACHE_PORT)
AP_CUR_VERSION!= ${ECHO_CMD} ${APACHE_PORT} | ${SED} -ne 's,.*/apache\([0-9]*\).*,\1,p'
.endif
.if defined(AP_CUR_VERSION)
VERSION_CHECK!= eval `${ECHO_CMD} "[ ${AP_VERSION} -eq ${AP_CUR_VERSION} ]" | ${SED} -e 's/- -eq/ -ge/ ; s/+ -eq/ -le/' ` ; ${ECHO_CMD} $${?}
. if ${VERSION_CHECK} == 1
IGNORE= ${_ERROR_MSG} apache${AP_CUR_VERSION} is installed (or APACHE_PORT is defined) and port requires ${USE_APACHE}
. endif
APACHE_VERSION= ${AP_CUR_VERSION}
.else
AP_CUR_VERSION= none
. if !defined(${APACHE_PORT})
#Fallback to smallest version...
APACHE_VERSION= ${AP_VERSION:C/\+//}
. endif
.endif
.if exists(${APXS})
APXS_PREFIX!= ${APXS} -q prefix 2> /dev/null || echo NULL
. if ${APXS_PREFIX} == NULL
IGNORE= : Your apache does not support DSO modules
. endif
. if defined(AP_GENPLIST) && ${APXS_PREFIX} != ${PREFIX}
IGNORE?= PREFIX must be egal to APXS_PREFIX.
. endif
.endif
.if ${APACHE_VERSION} == "20"
AP_BUILDEXT= la
PLIST_SUB+= APACHEMODDIR="libexec/apache2" \
APACHEINCLUDEDIR="include/apache2"
APACHE_PORT= www/apache${APACHE_VERSION}
.elif ${APACHE_VERSION} == "21"
AP_BUILDEXT= la
PLIST_SUB+= APACHEMODDIR="libexec/apache${APACHE_VERSION}" \
APACHEINCLUDEDIR="include/apache${APACHE_VERSION}"
APACHE_PORT= www/apache${APACHE_VERSION}
.else
AP_BUILDEXT= so
PLIST_SUB+= APACHEMODDIR="libexec/apache" \
APACHEINCLUDEDIR="include/apache"
APACHE_PORT?= www/apache13
.endif
.for VAR in ${OVERRIDABLE_VARS}
. if defined(AP${APACHE_VERSION}_${VAR})
${VAR} =${AP${APACHE_VERSION}_${VAR}}
. endif
.endfor
BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
RUN_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
PLIST_SUB+= AP_NAME="${SHORTMODNAME}"
PLIST_SUB+= AP_MODULE="${MODULENAME}.so"
.if defined(AP_GENPLIST)
PLIST?= ${WRKDIR}/ap-plist
.endif
.if defined(AP_INC)
AP_EXTRAS+= -I ${AP_INC}
.endif
.if defined(AP_LIB)
AP_EXTRAS+= -L ${AP_LIB}
.endif
.endif
.if defined(AP_PORT_IS_SERVER)
.elif defined(AP_PORT_IS_MODULE)
.if defined(AP_FAST_BUILD)
.if !target(ap-gen-plist)
ap-gen-plist:
.if defined(AP_GENPLIST)
. if !exists(${PLIST})
@${ECHO} "===> Generating apache plist"
@${ECHO} "@unexec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%%APACHEMODDIR%%/%%AP_MODULE%%" > ${PLIST}
@${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" >> ${PLIST}
@${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST}
@${ECHO} "@unexec echo \"Don't forget to remove all ${MODULENAME}-related directives in your httpd.conf\"">> ${PLIST}
. endif
.else
@${DO_NADA}
.endif
.endif
.if !target(do-build)
do-build: ap-gen-plist
@cd ${WRKSRC} && ${APXS} -c ${AP_EXTRAS} -o ${MODULENAME}.${AP_BUILDEXT} ${SRC_FILE}
.endif
.if !target(do-install)
do-install:
@${APXS} -i -A -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT}
.endif
.endif
.endif

View file

@ -0,0 +1,230 @@
# -*- mode: Makefile; tab-width: 4; -*-
# ex: ts=4
#
# $FreeBSD$
#
.if defined(_POSTMKINCLUDED) && !defined(Database_Post_Include)
Database_Post_Include= bsd.database.mk
Database_Include_MAINTAINER= vsevolod@FreeBSD.org
# This file contains some routines to interact with different databases, such
# as mysql, postgresql and berkley DB. For including this file define macro
# USE_[DATABASE], for example USE_MYSQL. Defining macro like USE_[DATABASE]_VER
# or WANT_[DATABSE]_VER will include this file too.
#
##
# USE_MYSQL - Add MySQL client dependency.
# If no version is given (by the maintainer via the port or
# by the user via defined variable), try to find the
# currently installed version. Fall back to default if
# necessary (MySQL4.1 = 41).
# DEFAULT_MYSQL_VER
# - MySQL default version. Can be overriden within a port.
# Default: 41.
# WANT_MYSQL_VER
# - Maintainer can set an arbitrary version of MySQL by using it.
# BROKEN_WITH_MYSQL
# - This variable can be defined if the ports doesn't support
# one or more version of MySQL.
# MYSQL_VER - Internal variable for MySQL version.
# WITH_MYSQL_VER
# - User defined variable to set MySQL version.
##
# USE_PGSQL - Add PostgreSQL client dependency.
# If no version is given (by the maintainer via the port or
# by the user via defined variable), try to find the
# currently installed version. Fall back to default if
# necessary (PostgreSQL-7.4 = 74).
# DEFAULT_PGSQL_VER
# - PostgreSQL default version. Can be overridden within a port.
# Default: 74.
# WANT_PGSQL_VER
# - Maintainer can set an arbitrary version of PostgreSQL by
# using it.
# BROKEN_WITH_PGSQL
# - This variable can be defined if the ports doesn't support
# one or more versions of PostgreSQL.
##
# USE_BDB - Add Berkley DB library dependency.
# If no version is given (by the maintainer via the port or
# by the user via defined variable), try to find the
# currently installed version. Fall back to default if
# necessary (db41+).
##
# USE_SQLITE - Add dependency on sqlite library. Valid values are:
# 3 and 2. If version is not specified directly then
# sqlite3 is used (if USE_SQLITE= yes).
.if defined(USE_MYSQL)
DEFAULT_MYSQL_VER?= 41
# MySQL client version currently supported.
MYSQL323_LIBVER= 10
MYSQL40_LIBVER= 12
MYSQL41_LIBVER= 14
MYSQL50_LIBVER= 14
# Setting/finding MySQL version we want.
.if exists(${LOCALBASE}/bin/mysql)
_MYSQL_VER!= ${LOCALBASE}/bin/mysql --version | ${SED} -e 's/.*Distrib \([0-9]\)\.\([0-9]*\).*/\1\2/'
.endif
.if defined(WANT_MYSQL_VER)
.if defined(WITH_MYSQL_VER) && ${WITH_MYSQL_VER} != ${WANT_MYSQL_VER}
BROKEN= The port wants mysql${WANT_MYSQL_VER}-client and you try to install mysql${WITH_MYSQL_VER}-client.
.endif
MYSQL_VER= ${WANT_MYSQL_VER}
.elif defined(WITH_MYSQL_VER)
MYSQL_VER= ${WITH_MYSQL_VER}
.else
.if defined(_MYSQL_VER)
MYSQL_VER= ${_MYSQL_VER}
.else
MYSQL_VER= ${DEFAULT_MYSQL_VER}
.endif
.endif # WANT_MYSQL_VER
.if defined(_MYSQL_VER)
.if ${_MYSQL_VER} != ${MYSQL_VER}
BROKEN= MySQL versions mismatch: mysql${_MYSQL_VER}-client is installed and wanted version is mysql${MYSQL_VER}-client
.endif
.endif
# And now we are checking if we can use it
.if defined(MYSQL${MYSQL_VER}_LIBVER)
.if defined(BROKEN_WITH_MYSQL)
. for VER in ${BROKEN_WITH_MYSQL}
. if (${MYSQL_VER} == "${VER}")
IGNORE= "Doesn't work with MySQL version : ${MYSQL_VER} (Doesn't support MySQL ${BROKEN_WITH_MYSQL})"
. endif
. endfor
.endif # BROKEN_WITH_MYSQL
LIB_DEPENDS+= mysqlclient.${MYSQL${MYSQL_VER}_LIBVER}:${PORTSDIR}/databases/mysql${MYSQL_VER}-client
.else
IGNORE= "Unknown MySQL version: ${MYSQL_VER}"
.endif # Check for correct libs
.endif # USE_MYSQL
.if defined(USE_PGSQL)
DEFAULT_PGSQL_VER?= 74
PGSQL73_LIBVER= 3
PGSQL74_LIBVER= 3
PGSQL80_LIBVER= 4
# Setting/finding PostgreSQL version we want.
.if exists(${LOCALBASE}/bin/pg_config)
_PGSQL_VER!= ${LOCALBASE}/bin/pg_config --version | ${SED} -n 's/PostgreSQL[^0-9]*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*/\1\2/p'
.endif
.if defined(WANT_PGSQL_VER) && defined(_PGSQL_VER) && ${WANT_PGSQL_VER} != ${_PGSQL_VER}
BROKEN= the port wants postgresql${WANT_PGSQL_VER}-client but you have postgresql${_PGSQL_VER}-client installed
.endif
.if defined(_PGSQL_VER)
PGSQL_VER= ${_PGSQL_VER}
.elif defined(WANT_PGSQL_VER)
PGSQL_VER= ${WANT_PGSQL_VER}
.else
PGSQL_VER= ${DEFAULT_PGSQL_VER}
.endif
# And now we are checking if we can use it
.if defined(PGSQL${PGSQL_VER}_LIBVER)
.if defined(BROKEN_WITH_PGSQL)
. for VER in ${BROKEN_WITH_PGSQL}
. if (${PGSQL_VER} == "${VER}")
IGNORE= "Does not work with postgresql${PGSQL_VER}-client PostgresSQL \(${BROKEN_WITH_PGSQL} not supported\)"
. endif
. endfor
.endif # BROKEN_WITH_PGSQL
LIB_DEPENDS+= pq.${PGSQL${PGSQL_VER}_LIBVER}:${PORTSDIR}/databases/postgresql${PGSQL_VER}-client
.else
IGNORE= "Unknown PostgreSQL version: ${PGSQL_VER}"
.endif # Check for correct version
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
.endif # USE_PGSQL
.if defined(USE_BDB)
_DB_PORTS= 2 3 40 41 42 43 40+ 41+ 42+ 43+
# Dependence lines for different db versions
db2_DEPENDS= db2.0:${PORTSDIR}/databases/db2
db3_DEPENDS= db3.3:${PORTSDIR}/databases/db3
db40_DEPENDS= db4.0:${PORTSDIR}/databases/db4
db41_DEPENDS= db41.1:${PORTSDIR}/databases/db41
db42_DEPENDS= db-4.2.2:${PORTSDIR}/databases/db42
db43_DEPENDS= db-4.3.0:${PORTSDIR}/databases/db43
# Detect db4 versions by finding some files
db40_FIND= ${PREFIX}/include/db4/db.h
db41_FIND= ${PREFIX}/include/db41/db.h
db42_FIND= ${PREFIX}/include/db42/db.h
db43_FIND= ${PREFIX}/include/db43/db.h
# For specifying 40+ 41+ 42+
_DB_40P= 40 41 42 43
_DB_41P= 41 42 43
_DB_42P= 42 43
_WANT_BDB_VER= ${USE_BDB}
# Assume the default bdb version as 41
.if ${USE_BDB} == "yes"
_WANT_BDB_VER= 41+
.endif
# Detect bdb version
_FOUND= no
.for bdb in ${_DB_PORTS}
.if ${_WANT_BDB_VER} == "${bdb}" && ${_FOUND} == "no"
_MATCHED_DB_VER:= ${bdb:S/+//}
. if ${_MATCHED_DB_VER} == "${bdb}"
# USE_BDB is exactly specified
LIB_DEPENDS+= ${db${bdb}_DEPENDS}
_FOUND= yes
.else
# USE_BDB is specified as VER+
. for db4 in ${_DB_${_MATCHED_DB_VER}P}
. if exists(${db${db4}_FIND}) && ${_FOUND} == "no"
LIB_DEPENDS+= ${db${db4}_DEPENDS}
_FOUND= yes
. endif
. endfor
. if ${_FOUND} == "no"
# No existing db4 version is detected in system
LIB_DEPENDS+= ${db${_MATCHED_DB_VER}_DEPENDS}
_FOUND= yes
. endif
. endif
.endif
.endfor
# USE_BDB is specified incorrectly, so mark this as BROKEN
.if ${_FOUND} == "no"
IGNORE= "Unknown bdb version: ${USE_BDB}"
.endif
.endif # USE_BDB
# Handling sqlite dependency
.if defined(USE_SQLITE)
.if ${USE_SQLITE} == "yes"
_SQLITE_VER= 3
.else
_SQLITE_VER= ${USE_SQLITE}
.endif
.if ${_SQLITE_VER} != "3" && ${_SQLITE_VER} != "2"
IGNORE= "Unknown sqlite version: ${_SQLITE_VER}"
.endif
LIB_DEPENDS+= sqlite${_SQLITE_VER}:${PORTSDIR}/databases/sqlite${_SQLITE_VER}
.endif # defined(USE_SQLITE)
.endif # defined(_POSTMKINCLUDED) && !defined(Database_Post_Include)

582
devel/portmk/Mk/bsd.java.mk Normal file
View file

@ -0,0 +1,582 @@
#-*- mode: Fundamental; tab-width: 4; -*-
# ex:ts=4
#
# bsd.java.mk - Support for Java-based ports.
#
# Created by: Ernst de Haan <znerd@FreeBSD.org>
#
# For FreeBSD committers:
# Please send all suggested changes to the maintainer instead of committing
# them to CVS yourself.
#
# $FreeBSD$
#
.if !defined(Java_Include)
Java_Include= bsd.java.mk
Java_Include_MAINTAINER= glewis@FreeBSD.org hq@FreeBSD.org
#-------------------------------------------------------------------------------
# Variables that each port can define:
#
# USE_JAVA Should be defined to the remaining variables to have any
# effect
#
# JAVA_VERSION List of space-separated suitable java versions for the
# port. An optional "+" allows you to specify a range of
# versions. (allowed values: 1.1[+] 1.2[+] 1.3[+] 1.4[+])
#
# JAVA_OS List of space-separated suitable JDK port operating systems
# for the port. (allowed values: native linux)
#
# JAVA_VENDOR List of space-separated suitable JDK port vendors for the
# port. (allowed values: freebsd bsdjava sun ibm blackdown)
#
# JAVA_BUILD When set, it means that the selected JDK port should be
# added to build dependencies for the port.
#
# JAVA_RUN This variable works exactly the same as JAVA_BUILD but
# regarding run dependencies.
#
# USE_JIKES Whether the port should or should not use jikes(1) to build.
# See Stage 6 header for further detail.
#
# USE_ANT Should be defined when the port uses Apache Ant. Ant is thus
# considered to be the sub-make command. When no 'do-build'
# target is defined by the port, a default one will be set
# that simply runs Ant according to MAKE_ENV, MAKE_ARGS and
# ALL_TARGET. Read the documentation in bsd.port.mk for more
# information.
#
#-------------------------------------------------------------------------------
# Variables defined for the port:
#
# JAVA_PORT The name of the JDK port. (e.g. 'java/jdk14')
#
# JAVA_PORT_VERSION The version of the JDK port. (e.g. '1.4')
#
# JAVA_PORT_OS The operating system used by the JDK port. (e.g. 'linux')
#
# JAVA_PORT_VENDOR The vendor of the JDK port. (e.g. 'sun')
#
# JAVA_PORT_OS_DESCRIPTION Description of the operating system used by the
# JDK port. (e.g. 'Linux')
#
# JAVA_PORT_VENDOR_DESCRIPTION Description of the vendor of the JDK port.
# (e.g. 'FreeBSD Foundation')
#
# JAVA_HOME Path to the installation directory of the JDK. (e.g.
# '/usr/local/jdk1.3.1')
#
# JAVAC Path to the Java compiler to use. (e.g.
# '/usr/local/jdk1.1.8/bin/javac' or '/usr/local/bin/jikes')
#
# JAR Path to the JAR tool to use. (e.g.
# '/usr/local/jdk1.2.2/bin/jar' or '/usr/local/bin/fastjar')
#
# APPLETVIEWER Path to the appletviewer utility. (e.g.
# '/usr/local/linux-jdk1.2.2/bin/appletviewer')
#
# JAVA Path to the java executable. Use this for executing Java
# programs. (e.g. '/usr/local/jdk1.3.1/bin/java')
#
# JAVADOC Path to the javadoc utility program.
#
# JAVAH Path to the javah program.
#
# JAVAP Path to the javap program.
#
# JAVA_KEYTOOL Path to the keytool utility program. This settings is
# availble only if the JDK is Java 1.2 or higher.
#
# JAVA_N2A Path to the native2ascii tool.
#
# JAVA_POLICYTOOL Path to the policytool program. This variable is available
# only if the JDK is Java 1.2 or higher.
#
# JAVA_SERIALVER Path to the serialver utility program.
#
# RMIC Path to the RMI stub/skeleton generator, rmic.
#
# RMIREGISTRY Path to the RMI registry program, rmiregistry.
#
# RMID Path to the RMI daemon program. This settings is only
# available if the JDK is Java 1.2 or higher.
#
# JAVA_CLASSES Path to the archive that contains the JDK class files. On
# JDK 1.2 or later, this is ${JAVA_HOME}/jre/lib/rt.jar.
# Earlier JDK's use ${JAVA_HOME}/lib/classes.zip.
#
# JAVASHAREDIR The base directory for all shared Java resources.
#
# JAVAJARDIR The directory where a port should install JAR files.
#
# JAVALIBDIR The directory where JAR files installed by other ports
# are located.
#
# HAVE_JIKES Defined and set to "yes" whenever the port will effectively
# use Jikes. See stage 6 header for further detail.
#
#-------------------------------------------------------------------------------
# Porter's hints
#
# To retrieve the Major version number from JAVA_PORT_VERSION (e.g. "1.3"):
# -> ${JAVA_PORT_VERSION:C/^([0-9])\.([0-9])(.*)$/\1.\2/}
#
#-------------------------------------------------------------------------------
# There are the following stages:
#
# Stage 1: Define constants
# Stage 2: bsd.java.mk 1.0 backward compatibility
# Stage 3: Determine which JDK ports are installed and which JDK ports are
# suitable
# Stage 4: <REMOVED> (merged in stage 3)
# Stage 5: Decide the exact JDK to use (or install)
# Stage 6: Add any dependencies if necessary
# Stage 7: Define all settings for the port to use
#
. if defined(USE_JAVA)
#-------------------------------------------------------------------------------
# Stage 1: Define constants
#
# System-global directories
# NB: If the value of JAVALIBDIR is altered here it must also be altered
# in java/javavmwrapper/Makefile.
JAVASHAREDIR?= ${PREFIX}/share/java
JAVAJARDIR?= ${JAVASHAREDIR}/classes
JAVALIBDIR?= ${LOCALBASE}/share/java/classes
# Add appropriate substitutions to PLIST_SUB and LIST_SUB
PLIST_SUB+= JAVASHAREDIR="${JAVASHAREDIR:S,^${PREFIX}/,,}" \
JAVAJARDIR="${JAVAJARDIR:S,^${PREFIX}/,,}"
SUB_LIST+= JAVASHAREDIR="${JAVASHAREDIR}" \
JAVAJARDIR="${JAVAJARDIR}" \
JAVALIBDIR="${JAVALIBDIR}"
. if defined(JAVA_VERSION)
SUB_LIST+= JAVA_VERSION="${JAVA_VERSION}"
. endif
. if defined(JAVA_VENDOR)
SUB_LIST+= JAVA_VENDOR="${JAVA_VENDOR}"
. endif
. if defined(JAVA_OS)
SUB_LIST+= JAVA_OS="${JAVA_OS}"
. endif
# The complete list of Java versions, os and vendors supported.
__JAVA_VERSION_LIST= 1.1 1.2 1.3 1.4 1.5
_JAVA_VERSION_LIST= ${__JAVA_VERSION_LIST} ${__JAVA_VERSION_LIST:S/$/+/}
_JAVA_OS_LIST= native linux
_JAVA_VENDOR_LIST= freebsd bsdjava sun blackdown ibm
# Set all meta-information about JDK ports:
# port location, corresponding JAVA_HOME, JDK version, OS, vendor
_JAVA_PORT_NATIVE_FREEBSD_JDK_1_3_INFO= PORT=java/diablo-jdk13 HOME=${LOCALBASE}/diablo-jdk1.3.1 \
VERSION=1.3.1 OS=native VENDOR=freebsd
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1_INFO= PORT=java/jdk11 HOME=${LOCALBASE}/jdk1.1.8 \
VERSION=1.1.8 OS=native VENDOR=bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2_INFO= PORT=java/jdk12 HOME=${LOCALBASE}/jdk1.2.2 \
VERSION=1.2.2 OS=native VENDOR=bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3_INFO= PORT=java/jdk13 HOME=${LOCALBASE}/jdk1.3.1 \
VERSION=1.3.1 OS=native VENDOR=bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4_INFO= PORT=java/jdk14 HOME=${LOCALBASE}/jdk1.4.2 \
VERSION=1.4.2 OS=native VENDOR=bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_5_INFO= PORT=java/jdk15 HOME=${LOCALBASE}/jdk1.5.0 \
VERSION=1.5.0 OS=native VENDOR=bsdjava
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2_INFO= PORT=java/linux-blackdown-jdk12 HOME=${LOCALBASE}/linux-blackdown-jdk1.2.2 \
VERSION=1.2.2 OS=linux VENDOR=blackdown
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3_INFO= PORT=java/linux-blackdown-jdk13 HOME=${LOCALBASE}/linux-blackdown-jdk1.3.1 \
VERSION=1.3.1 OS=linux VENDOR=blackdown
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4_INFO= PORT=java/linux-blackdown-jdk14 HOME=${LOCALBASE}/linux-blackdown-jdk1.4.2 \
VERSION=1.4.2 OS=linux VENDOR=blackdown
_JAVA_PORT_LINUX_IBM_JDK_1_3_INFO= PORT=java/linux-ibm-jdk13 HOME=${LOCALBASE}/linux-ibm-jdk1.3.1 \
VERSION=1.3.1 OS=linux VENDOR=ibm
_JAVA_PORT_LINUX_IBM_JDK_1_4_INFO= PORT=java/linux-ibm-jdk14 HOME=${LOCALBASE}/linux-ibm-jdk1.4.2 \
VERSION=1.4.1 OS=linux VENDOR=ibm
_JAVA_PORT_LINUX_SUN_JDK_1_2_INFO= PORT=java/linux-sun-jdk12 HOME=${LOCALBASE}/linux-sun-jdk1.2.2 \
VERSION=1.2.2 OS=linux VENDOR=sun
_JAVA_PORT_LINUX_SUN_JDK_1_3_INFO= PORT=java/linux-sun-jdk13 HOME=${LOCALBASE}/linux-sun-jdk1.3.1 \
VERSION=1.3.1 OS=linux VENDOR=sun
_JAVA_PORT_LINUX_SUN_JDK_1_4_INFO= PORT=java/linux-sun-jdk14 HOME=${LOCALBASE}/linux-sun-jdk1.4.2 \
VERSION=1.4.2 OS=linux VENDOR=sun
# Verbose description for each VENDOR
_JAVA_VENDOR_freebsd= "FreeBSD Foundation"
_JAVA_VENDOR_bsdjava= "BSD Java Porting Team"
_JAVA_VENDOR_blackdown= Blackdown
_JAVA_VENDOR_ibm= IBM
_JAVA_VENDOR_sun= Sun
# Verbose description for each OS
_JAVA_OS_native= Native
_JAVA_OS_linux= Linux
# Enforce preferred Java ports according to OS
_JAVA_PREFERRED_PORTS+= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4
# List all JDK ports
__JAVA_PORTS_ALL= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_5 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3 \
JAVA_PORT_NATIVE_FREEBSD_JDK_1_3 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1 \
JAVA_PORT_LINUX_SUN_JDK_1_4 \
JAVA_PORT_LINUX_SUN_JDK_1_3 \
JAVA_PORT_LINUX_SUN_JDK_1_2 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2 \
JAVA_PORT_LINUX_IBM_JDK_1_4 \
JAVA_PORT_LINUX_IBM_JDK_1_3
_JAVA_PORTS_ALL= ${JAVA_PREFERRED_PORTS} \
${_JAVA_PREFERRED_PORTS} \
${__JAVA_PORTS_ALL}
# Set the name of the file that indicates that a JDK is indeed installed, as a
# relative path within the JAVA_HOME directory.
_JDK_FILE=bin/javac
# Set the path to Jikes and define the Jikes dependency
_JIKES_PATH= ${LOCALBASE}/bin/jikes
DEPEND_JIKES= ${_JIKES_PATH}:${PORTSDIR}/java/jikes
#-------------------------------------------------------------------------------
# Stage 2: bsd.java.mk 1.0 backward compatibility
#
# First detect if we are using bsd.java.mk v1.0
_USE_BSD_JAVA_MK_1_0!= ${ECHO_CMD} "${_JAVA_VERSION_LIST}" \
| ${TR} " " "\n" \
| ${GREP} -q "^${USE_JAVA}$$" && ${ECHO_CMD} "yes" || ${ECHO_CMD} "no"
. if (${_USE_BSD_JAVA_MK_1_0} == "yes")
# Then affect the variables so that we may use v2.0
# USE_JAVA --> JAVA_VERSION
. if !defined(JAVA_VERSION)
JAVA_VERSION= ${USE_JAVA}
. else
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: The port is using bsd.java.mk 1.0 but sets a value for JAVA_VERSION. This may cause problems."
@${FALSE}
. endif
# NO_{BUILD|RUN}_DEPENDS_JAVA --> JAVA_{BUILD|RUN}
. if defined(NO_BUILD_DEPENDS_JAVA) && defined(NO_RUN_DEPENDS_JAVA)
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: NO_BUILD_DEPENDS_JAVA and NO_RUN_DEPENDS_JAVA cannot be set at the same time.";
@${FALSE}
. else
. if !defined(NO_BUILD_DEPENDS_JAVA) && !defined(NO_BUILD)
JAVA_BUILD= jdk
. endif
. if !defined(NO_RUN_DEPENDS_JAVA)
JAVA_RUN= jdk
. endif
. endif
# NEED_JAVAC --> JAVA_{BUILD|RUN}={jdk|jre}
. if defined(NEED_JAVAC)
. if (${NEED_JAVAC:U} == "YES")
JAVA_BUILD= jdk
. elif (${NEED_JAVAC:U} == "NO")
JAVA_BUILD= jre
. else
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: \"${NEED_JAVAC}\" is not a valid value for NEED_JAVAC. It should be YES or NO, or it should be undefined.";
@${FALSE}
. endif
. endif
. endif
#-------------------------------------------------------------------------------
# Stage 3: Determine which JDK ports are suitable and which JDK ports are
# suitable
#
# From here, the port is using bsd.java.mk v2.0
# Error checking: defined JAVA_{HOME,PORT,PORT_VERSION,PORT_VENDOR,PORT_OS}
. for variable in JAVA_HOME JAVA_PORT JAVA_PORT_VERSION JAVA_PORT_VENDOR JAVA_PORT_OS
. if defined(${variable})
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Environment error: \"${variable}\" should not be defined."
@${FALSE}
. endif
. endfor
# Error checking: JAVA_VERSION
_JAVA_VERSION_LIST_REGEXP!= ${ECHO_CMD} "${_JAVA_VERSION_LIST}" | ${SED} "s/ /\\\|/g"
_ERROR_CHECKING_JAVA_VERSION!= ${ECHO_CMD} "${JAVA_VERSION}" | ${TR} " " "\n" \
| ${GREP} -v "${_JAVA_VERSION_LIST_REGEXP}" || true
. if (${_ERROR_CHECKING_JAVA_VERSION} != "")
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: \"${JAVA_VERSION}\" is not a valid value for JAVA_VERSION. It should be one or more of: ${__JAVA_VERSION_LIST} (with an optional \"+\" suffix.)";
@${FALSE}
. endif
# Error checking: JAVA_VENDOR
_JAVA_VENDOR_LIST_REGEXP!= ${ECHO_CMD} "${_JAVA_VENDOR_LIST}" | ${SED} "s/ /\\\|/g"
_ERROR_CHECKING_JAVA_VENDOR!= ${ECHO_CMD} "${JAVA_VENDOR}" | ${TR} " " "\n" \
| ${GREP} -v "${_JAVA_VENDOR_LIST_REGEXP}" || true
. if (${_ERROR_CHECKING_JAVA_VENDOR} != "")
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: \"${JAVA_VENDOR}\" is not a valid value for JAVA_VENDOR. It should be one or more of: ${_JAVA_VENDOR_LIST}";
@${FALSE}
. endif
# Error checking: JAVA_OS
_JAVA_OS_LIST_REGEXP!= ${ECHO_CMD} "${_JAVA_OS_LIST}" | ${SED} "s/ /\\\|/g"
_ERROR_CHECKING_JAVA_OS!= ${ECHO_CMD} "${JAVA_OS}" | ${TR} " " "\n" \
| ${GREP} -v "${_JAVA_OS_LIST_REGEXP}" || true
. if (${_ERROR_CHECKING_JAVA_OS} != "")
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: \"${JAVA_OS}\" is not a valid value for JAVA_OS. It should be one or more of: ${_JAVA_OS_LIST}";
@${FALSE}
. endif
# Set default values for JAVA_BUILD and JAVA_RUN
# When nothing is set, assume JAVA_BUILD=jdk and JAVA_RUN=jre
# (unless NO_BUILD is set)
. if !defined(JAVA_EXTRACT) && !defined(JAVA_BUILD) && !defined(JAVA_RUN)
. if !defined(NO_BUILD)
JAVA_BUILD= jdk
. endif
JAVA_RUN= jre
. endif
# JDK dependency setting
. undef _JAVA_PORTS_INSTALLED
. undef _JAVA_PORTS_POSSIBLE
. if defined(JAVA_VERSION)
_JAVA_VERSION= ${JAVA_VERSION:S/1.1+/1.1 1.2 1.3 1.4 1.5/:S/1.2+/1.2 1.3 1.4 1.5/:S/1.3+/1.3 1.4 1.5/:S/1.4+/1.4 1.5/:S/1.5+/1.5/}
. else
_JAVA_VERSION= ${__JAVA_VERSION_LIST}
. endif
. if defined(JAVA_OS)
_JAVA_OS= ${JAVA_OS}
. else
_JAVA_OS= ${_JAVA_OS_LIST}
. endif
. if defined(JAVA_VENDOR)
_JAVA_VENDOR= ${JAVA_VENDOR}
. else
_JAVA_VENDOR= ${_JAVA_VENDOR_LIST}
. endif
. for A_JAVA_PORT in ${_JAVA_PORTS_ALL}
A_JAVA_PORT_INFO:= ${A_JAVA_PORT:S/^/\${_/:S/$/_INFO}/}
A_JAVA_PORT_HOME= ${A_JAVA_PORT_INFO:MHOME=*:S,HOME=,,}
A_JAVA_PORT_VERSION= ${A_JAVA_PORT_INFO:MVERSION=*:C/VERSION=([0-9])\.([0-9])(.*)/\1.\2/}
A_JAVA_PORT_OS= ${A_JAVA_PORT_INFO:MOS=*:S,OS=,,}
A_JAVA_PORT_VENDOR= ${A_JAVA_PORT_INFO:MVENDOR=*:S,VENDOR=,,}
A_JAVA_PORT_INSTALLED!= ${TEST} -x "${A_JAVA_PORT_HOME}/${_JDK_FILE}" \
&& ${ECHO_CMD} "${A_JAVA_PORT}" \
|| ${TRUE}
__JAVA_PORTS_INSTALLED!= ${ECHO_CMD} "${__JAVA_PORTS_INSTALLED} ${A_JAVA_PORT_INSTALLED}"
A_JAVA_PORT_POSSIBLE!= ${ECHO_CMD} "${_JAVA_VERSION}" | ${GREP} -q "${A_JAVA_PORT_VERSION}" \
&& ${ECHO_CMD} "${_JAVA_OS}" | ${GREP} -q "${A_JAVA_PORT_OS}" \
&& ${ECHO_CMD} "${_JAVA_VENDOR}" | ${GREP} -q "${A_JAVA_PORT_VENDOR}" \
&& ${ECHO_CMD} "${A_JAVA_PORT}" \
|| ${TRUE}
__JAVA_PORTS_POSSIBLE!= ${ECHO_CMD} "${__JAVA_PORTS_POSSIBLE} ${A_JAVA_PORT_POSSIBLE}"
. endfor
_JAVA_PORTS_INSTALLED= ${__JAVA_PORTS_INSTALLED:C/ [ ]+/ /g}
_JAVA_PORTS_POSSIBLE= ${__JAVA_PORTS_POSSIBLE:C/ [ ]+/ /g}
#-------------------------------------------------------------------------------
# Stage 5: Decide the exact JDK to use (or install)
#
# Find an installed JDK port that matches the requirements of the port
. undef _JAVA_PORTS_INSTALLED_POSSIBLE
. for A_JAVA_PORT in ${_JAVA_PORTS_POSSIBLE}
A_JAVA_PORT_INSTALLED_POSSIBLE!= ${ECHO_CMD} "${_JAVA_PORTS_INSTALLED}" | ${GREP} -q "${A_JAVA_PORT}" \
&& ${ECHO_CMD} "${A_JAVA_PORT}" || ${TRUE}
__JAVA_PORTS_INSTALLED_POSSIBLE!= ${ECHO_CMD} "${__JAVA_PORTS_INSTALLED_POSSIBLE} ${A_JAVA_PORT_INSTALLED_POSSIBLE}"
. endfor
_JAVA_PORTS_INSTALLED_POSSIBLE= ${__JAVA_PORTS_INSTALLED_POSSIBLE:C/ [ ]+/ /g}
. if ${_JAVA_PORTS_INSTALLED_POSSIBLE} != ""
_JAVA_PORT!= ${ECHO_CMD} "${_JAVA_PORTS_INSTALLED_POSSIBLE}" \
| ${AWK} '{ print $$1 }'
# If no installed JDK port fits, then pick one from the list of possible ones
. else
_JAVA_PORT!= ${ECHO_CMD} "${_JAVA_PORTS_POSSIBLE}" \
| ${AWK} '{ print $$1 }'
. endif
_JAVA_PORT_INFO:= ${_JAVA_PORT:S/^/\${_/:S/$/_INFO}/}
JAVA_PORT= ${_JAVA_PORT_INFO:MPORT=*:S,PORT=,,}
JAVA_HOME= ${_JAVA_PORT_INFO:MHOME=*:S,HOME=,,}
JAVA_PORT_VERSION= ${_JAVA_PORT_INFO:MVERSION=*:S,VERSION=,,}
JAVA_PORT_OS= ${_JAVA_PORT_INFO:MOS=*:S,OS=,,}
JAVA_PORT_VENDOR= ${_JAVA_PORT_INFO:MVENDOR=*:S,VENDOR=,,}
JAVA_PORT_VENDOR_DESCRIPTION:= ${JAVA_PORT_VENDOR:S/^/\${_JAVA_VENDOR_/:S/$/}/}
JAVA_PORT_OS_DESCRIPTION:= ${JAVA_PORT_OS:S/^/\${_JAVA_OS_/:S/$/}/}
#-------------------------------------------------------------------------------
# Stage 6: Add any dependencies if necessary
#
# Jikes support: If USE_JIKES is set to YES, then use Jikes. If USE_JIKES is
# set to NO, then don't use it. If it is set to a different value, then fail
# with an error message. Otherwise USE_JIKES is not set, in which case it is
# checked if Jikes is already installed. If it is, then it will be used,
# otherwise it will not be used.
#
# As a result, HAVE_JIKES is defined and set to "yes" when Jikes is used by the
# port according to the above policy.
. undef HAVE_JIKES
# First test if USE_JIKES has a valid value
. if defined(USE_JIKES) && !(${USE_JIKES:U} == "YES") && !(${USE_JIKES:U} == "NO")
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: \"${USE_JIKES}\" is not a valid value for USE_JIKES. It should be YES or NO, or it should be undefined.";
@${FALSE}
. endif
# Then test if jikes is needed or available: -> HAVE_JIKES=yes
. if (exists(${_JIKES_PATH}) && (!defined(USE_JIKES) || (${USE_JIKES:U} == "YES"))) \
|| (defined(USE_JIKES) && (${USE_JIKES:U} == "YES"))
HAVE_JIKES= yes
. endif
# Add jikes port to the dependencies if needed
. if !defined(NO_BUILD) && defined(HAVE_JIKES)
BUILD_DEPENDS+= ${DEPEND_JIKES}
. endif
# Ant Support: USE_ANT --> JAVA_BUILD=jdk
. if defined(USE_ANT)
JAVA_BUILD= jdk
. endif
# Add the JDK port to the dependencies
DEPEND_JAVA= ${JAVA}:${PORTSDIR}/${JAVA_PORT}
. if defined(JAVA_EXTRACT)
EXTRACT_DEPENDS+= ${DEPEND_JAVA}
. endif
. if defined(JAVA_BUILD)
. if defined(NO_BUILD)
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: JAVA_BUILD and NO_BUILD cannot be set at the same time.";
@${FALSE}
. endif
BUILD_DEPENDS+= ${DEPEND_JAVA}
. endif
. if defined(JAVA_RUN)
RUN_DEPENDS+= ${DEPEND_JAVA}
. endif
# Ant support: default do-build target
. if defined(USE_ANT)
ANT?= ${LOCALBASE}/bin/ant
MAKE_ENV+= JAVA_HOME=${JAVA_HOME}
. if defined(HAVE_JIKES)
MAKE_ARGS+= -Dbuild.compiler=jikes
. endif
BUILD_DEPENDS+= ${ANT}:${PORTSDIR}/devel/apache-ant
ALL_TARGET?=
. if !target(do-build)
do-build:
@(cd ${BUILD_WRKSRC}; \
${SETENV} ${MAKE_ENV} ${ANT} ${MAKE_ARGS} ${ALL_TARGET})
. endif
. endif
#-----------------------------------------------------------------------------
# Stage 7: Define all settings for the port to use
#
# At this stage both JAVA_HOME and JAVA_PORT are definitely given a value.
#
# Define the location of the Java compiler. If HAVE_JIKES is defined, then
# use Jikes.
# Only define JAVAC if a JDK is needed or USE_JIKES=yes
. undef JAVAC
# Then test if a JAVAC has to be set (JAVA_BUILD==jdk)
. if defined(JAVA_BUILD)
. if (${JAVA_BUILD:U} == "JDK") && !defined(JAVAC)
# Use jikes if available and not explicitly forbidden (see Stage 6)
. if defined(HAVE_JIKES)
JAVAC?= ${_JIKES_PATH} -bootclasspath ${JAVA_CLASSES}
# Otherwise use 'javac'
. else
JAVAC?= ${JAVA_HOME}/bin/javac
. endif
. endif
. endif
# Define the location of some more executables.
APPLETVIEWER?= ${JAVA_HOME}/bin/appletviewer
JAR?= ${JAVA_HOME}/bin/jar
JAVA?= ${JAVA_HOME}/bin/java
JAVADOC?= ${JAVA_HOME}/bin/javadoc
JAVAH?= ${JAVA_HOME}/bin/javah
JAVAP?= ${JAVA_HOME}/bin/javap
JAVA_N2A?= ${JAVA_HOME}/bin/native2ascii
JAVA_SERIALVER?=${JAVA_HOME}/bin/serialver
RMIC?= ${JAVA_HOME}/bin/rmic
RMIREGISTRY?= ${JAVA_HOME}/bin/rmiregistry
# Some executables only exists in JDK 1.2 and up
. if ${_JAVA_PORT} != "JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1"
JAVA_KEYTOOL?= ${JAVA_HOME}/bin/keytool
JAVA_POLICYTOOL?= ${JAVA_HOME}/bin/policytool
RMID?= ${JAVA_HOME}/bin/rmid
. endif
# Set the location of the ZIP or JAR file with all standard Java classes.
. if ${_JAVA_PORT} == "JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1"
JAVA_CLASSES= ${JAVA_HOME}/lib/classes.zip
. else
JAVA_CLASSES= ${JAVA_HOME}/jre/lib/rt.jar
. endif
#-------------------------------------------------------------------------------
# Additional Java support
# Debug target
# Use it to check Java dependency while porting
java-debug:
@${ECHO_CMD} "_USE_BSD_JAVA_MK_1_0= ${_USE_BSD_JAVA_MK_1_0}"
@${ECHO_CMD}
@${ECHO_CMD} "# User specified parameters:"
@${ECHO_CMD} "JAVA_VERSION= ${JAVA_VERSION} (${_JAVA_VERSION})"
@${ECHO_CMD} "JAVA_OS= ${JAVA_OS} (${_JAVA_OS})"
@${ECHO_CMD} "JAVA_VENDOR= ${JAVA_VENDOR} (${_JAVA_VENDOR})"
@${ECHO_CMD} "JAVA_BUILD= ${JAVA_BUILD}"
@${ECHO_CMD} "JAVA_RUN= ${JAVA_RUN}"
@${ECHO_CMD} "JAVA_EXTRACT= ${JAVA_EXTRACT}"
@${ECHO_CMD}
@${ECHO_CMD} "# JDK port dependency selection process:"
@${ECHO_CMD} "_JAVA_PORTS_POSSIBLE= ${_JAVA_PORTS_POSSIBLE}"
@${ECHO_CMD} "_JAVA_PORTS_INSTALLED= ${_JAVA_PORTS_INSTALLED}"
@${ECHO_CMD} "_JAVA_PORTS_INSTALLED_POSSIBLE= ${_JAVA_PORTS_INSTALLED_POSSIBLE}"
@${ECHO_CMD} "_JAVA_PORT= ${_JAVA_PORT}"
@${ECHO_CMD} "_JAVA_PORT_INFO= ${_JAVA_PORT_INFO:S/\t/ /}"
@${ECHO_CMD}
@${ECHO_CMD} "# Selected JDK port:"
@${ECHO_CMD} "JAVA_PORT= ${JAVA_PORT}"
@${ECHO_CMD} "JAVA_HOME= ${JAVA_HOME}"
@${ECHO_CMD} "JAVA_PORT_VERSION= ${JAVA_PORT_VERSION}"
@${ECHO_CMD} "JAVA_PORT_OS= ${JAVA_PORT_OS} (${JAVA_PORT_OS_DESCRIPTION})"
@${ECHO_CMD} "JAVA_PORT_VENDOR= ${JAVA_PORT_VENDOR} (${JAVA_PORT_VENDOR_DESCRIPTION})"
@${ECHO_CMD}
@${ECHO_CMD} "# Additional variables:"
@${ECHO_CMD} "JAVAC= ${JAVAC}"
@${ECHO_CMD} "JAVA_CLASSES= ${JAVA_CLASSES}"
. endif
.endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,419 +0,0 @@
#-*- mode: makefile; tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
PORTMK_VERSION= 20050202
.if defined(_PREMKINCLUDED)
check-makefile::
@${ECHO_CMD} "${PKGNAME}: Makefile error: you cannot include bsd.port[.pre].mk twice"
@${FALSE}
.endif
_PREMKINCLUDED= yes
.if defined(MAKE_VERSION)
.if ${MAKE_VERSION} >= 5200408030 || ${MAKE_VERSION} >= 4200408030 && ${MAKE_VERSION} < 5000000000
NOPRECIOUSSOFTMAKEVARS= yes
.endif
.endif
AWK?= /usr/bin/awk
BASENAME?= /usr/bin/basename
BRANDELF?= /usr/bin/brandelf
.if exists(/usr/bin/bzip2)
BZCAT?= /usr/bin/bzcat
BZIP2_CMD?= /usr/bin/bzip2
.else
BZCAT?= ${LOCALBASE}/bin/bzcat
BZIP2_CMD?= ${LOCALBASE}/bin/bzip2
BZIP2DEPENDS= yes
.endif
CAT?= /bin/cat
CHGRP?= /usr/bin/chgrp
CHMOD?= /bin/chmod
CHOWN?= /usr/sbin/chown
CHROOT?= /usr/sbin/chroot
COMM?= /usr/bin/comm
CP?= /bin/cp
CPIO?= /usr/bin/cpio
CUT?= /usr/bin/cut
DATE?= /bin/date
DC?= /usr/bin/dc
DIALOG?= /usr/bin/dialog
DIRNAME?= /usr/bin/dirname
EGREP?= /usr/bin/egrep
EXPR?= /bin/expr
FALSE?= false # Shell builtin
FILE?= /usr/bin/file
FIND?= /usr/bin/find
FMT?= /usr/bin/fmt
GREP?= /usr/bin/grep
GUNZIP_CMD?= /usr/bin/gunzip -f
GZCAT?= /usr/bin/gzcat
GZIP?= -9
GZIP_CMD?= /usr/bin/gzip -nf ${GZIP}
HEAD?= /usr/bin/head
ID?= /usr/bin/id
IDENT?= /usr/bin/ident
LDCONFIG?= /sbin/ldconfig
LN?= /bin/ln
LS?= /bin/ls
MKDIR?= /bin/mkdir -p
MKTEMP?= /usr/bin/mktemp
MV?= /bin/mv
OBJCOPY?= /usr/bin/objcopy
OBJDUMP?= /usr/bin/objdump
PASTE?= /usr/bin/paste
PAX?= /bin/pax
PRINTF?= /usr/bin/printf
REALPATH?= /bin/realpath
RM?= /bin/rm
RMDIR?= /bin/rmdir
SED?= /usr/bin/sed
SETENV?= /usr/bin/env
SH?= /bin/sh
SORT?= /usr/bin/sort
STRIP_CMD?= /usr/bin/strip
SU_CMD?= /usr/bin/su root -c
TAIL?= /usr/bin/tail
TEST?= test # Shell builtin
TR?= /usr/bin/tr
TRUE?= true # Shell builtin
UNAME?= /usr/bin/uname
.if exists(/usr/bin/unzip)
UNZIP_CMD?= /usr/bin/unzip
.else
UNZIP_CMD?= ${LOCALBASE}/bin/unzip
ZIPDEPENDS= yes
.endif
WHICH?= /usr/bin/which
XARGS?= /usr/bin/xargs
YACC?= /usr/bin/yacc
# ECHO is defined in /usr/share/mk/sys.mk, which can either be "echo",
# or "true" if the make flag -s is given. Use ECHO_CMD where you mean
# the echo command.
ECHO_CMD?= echo # Shell builtin
# Used to print all the '===>' style prompts - override this to turn them off.
ECHO_MSG?= ${ECHO_CMD}
# Get the default maintainer
MAINTAINER?= ports@FreeBSD.org
# Get the architecture
.if !defined(ARCH)
ARCH!= ${UNAME} -p
.endif
# Kludge for pre-3.0 systems
MACHINE_ARCH?= i386
# Get the operating system type
.if !defined(OPSYS)
OPSYS!= ${UNAME} -s
.endif
# Get the operating system revision
.if !defined(OSREL)
OSREL!= ${UNAME} -r | ${SED} -e 's/[-(].*//'
.endif
# Get __FreeBSD_version
.if !defined(OSVERSION)
.if exists(/sbin/sysctl)
OSVERSION!= /sbin/sysctl -n kern.osreldate
.else
OSVERSION!= /usr/sbin/sysctl -n kern.osreldate
.endif
.endif
# Get the object format.
.if !defined(PORTOBJFORMAT)
PORTOBJFORMAT!= ${TEST} -x /usr/bin/objformat && /usr/bin/objformat || ${ECHO_CMD} aout
.endif
MASTERDIR?= ${.CURDIR}
PORTMK_CONF?= /etc/portmk.conf
.if exists(${PORTMK_CONF})
.include "${PORTMK_CONF}"
.endif
# If they exist, include Makefile.inc, then architecture/operating
# system specific Makefiles, then local Makefile.local.
.if ${MASTERDIR} != ${.CURDIR} && exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
USE_SUBMAKE= yes
.endif
.if exists(${MASTERDIR}/../Makefile.inc)
.include "${MASTERDIR}/../Makefile.inc"
USE_SUBMAKE= yes
.endif
.if exists(${MASTERDIR}/Makefile.${ARCH}-${OPSYS})
.include "${MASTERDIR}/Makefile.${ARCH}-${OPSYS}"
USE_SUBMAKE= yes
.elif exists(${MASTERDIR}/Makefile.${OPSYS})
.include "${MASTERDIR}/Makefile.${OPSYS}"
USE_SUBMAKE= yes
.elif exists(${MASTERDIR}/Makefile.${ARCH})
.include "${MASTERDIR}/Makefile.${ARCH}"
USE_SUBMAKE= yes
.endif
.if exists(${MASTERDIR}/Makefile.local)
.include "${MASTERDIR}/Makefile.local"
USE_SUBMAKE= yes
.endif
# where 'make config' records user configuration options
PORT_DBDIR?= /var/db/ports
.if defined(LATEST_LINK)
UNIQUENAME?= ${LATEST_LINK}
.else
UNIQUENAME?= ${PKGNAMEPREFIX}${PORTNAME}
.endif
OPTIONSFILE?= ${PORT_DBDIR}/${UNIQUENAME}/options
_OPTIONSFILE!= ${ECHO_CMD} "${OPTIONSFILE}"
.if defined(OPTIONS) && !defined(_OPTIONSNG_READ)
.if exists(${_OPTIONSFILE}) && !make(rmconfig)
.include "${_OPTIONSFILE}"
.endif
.if exists(${_OPTIONSFILE}.local)
.include "${_OPTIONSFILE}.local"
.endif
.endif
# check for old, crufty, makefile types, part 1:
.if !defined(PORTNAME) || !( defined(PORTVERSION) || defined (DISTVERSION) ) || defined(PKGNAME)
check-makefile::
@${ECHO_CMD} "Makefile error: you need to define PORTNAME and PORTVERSION instead of PKGNAME."
@${ECHO_CMD} "(This port is too old for your bsd.port.mk, please update it to match"
@${ECHO_CMD} " your bsd.port.mk.)"
@${FALSE}
.endif
.if defined(PORTVERSION)
.if ${PORTVERSION:M*[-_,]*}x != x
BROKEN= "PORTVERSION ${PORTVERSION} may not contain '-' '_' or ','"
.endif
DISTVERSION?= ${PORTVERSION:S/:/::/g}
.elif defined(DISTVERSION)
PORTVERSION= ${DISTVERSION:L:C/([a-z])[a-z]+/\1/g:C/([0-9])([a-z])/\1.\2/g:C/:(.)/\1/g:C/[^a-z0-9+]+/./g}
.endif
PORTREVISION?= 0
.if ${PORTREVISION} != 0
_SUF1= _${PORTREVISION}
.endif
PORTEPOCH?= 0
.if ${PORTEPOCH} != 0
_SUF2= ,${PORTEPOCH}
.endif
# check for old, crufty, makefile types, part 2. The "else" case
# should have been handled in part 1, above.
.if !defined(PKGNAME)
PKGNAME= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION:C/[-_,]/./g}${_SUF1}${_SUF2}
.endif
DISTNAME?= ${PORTNAME}-${DISTVERSIONPREFIX}${DISTVERSION:C/:(.)/\1/g}${DISTVERSIONSUFFIX}
# These need to be absolute since we don't know how deep in the ports
# tree we are and thus can't go relative. They can, of course, be overridden
# by individual Makefiles or local system make configuration.
PORTSDIR?= /usr/ports
LOCALBASE?= /usr/local
X11BASE?= /usr/X11R6
LINUXBASE?= /compat/linux
DISTDIR?= ${PORTSDIR}/distfiles
_DISTDIR?= ${DISTDIR}/${DIST_SUBDIR}
.if ${OSVERSION} >= 600000
INDEXFILE?= INDEX-6
.elif ${OSVERSION} >= 500036
INDEXFILE?= INDEX-5
.else
INDEXFILE?= INDEX
.endif
.if defined(USE_BZIP2)
EXTRACT_SUFX?= .tar.bz2
.elif defined(USE_ZIP)
EXTRACT_SUFX?= .zip
.else
EXTRACT_SUFX?= .tar.gz
.endif
PACKAGES?= ${PORTSDIR}/packages
TEMPLATES?= ${PORTSDIR}/Templates
.if (!defined(PKGDIR) && exists(${MASTERDIR}/pkg/DESCR)) || \
(!defined(MD5_FILE) && exists(${MASTERDIR}/files/md5))
check-makefile::
@${ECHO_CMD} "Makefile error: your port uses an old layout. Please update it to match this bsd.port.mk. If you have updated your ports collection via cvsup and are still getting this error, see Q12 and Q13 in the cvsup FAQ on http://www.polstra.com for further information."
@${FALSE}
.endif
PATCHDIR?= ${MASTERDIR}/files
FILESDIR?= ${MASTERDIR}/files
SCRIPTDIR?= ${MASTERDIR}/scripts
PKGDIR?= ${MASTERDIR}
.if defined(USE_IMAKE) && !defined(USE_X_PREFIX)
USE_X_PREFIX= yes
.endif
.if defined(USE_X_PREFIX) && ${USE_X_PREFIX} == "no"
.undef USE_X_PREFIX
.endif
.if defined(USE_X_PREFIX)
USE_XLIB= yes
.endif
.if defined(USE_X_PREFIX)
PREFIX?= ${X11BASE}
.elif defined(USE_LINUX_PREFIX)
PREFIX?= ${LINUXBASE}
NO_MTREE= yes
.else
PREFIX?= ${LOCALBASE}
.endif
PKGCOMPATDIR?= ${LOCALBASE}/lib/compat/pkg
.if defined(WITH_APACHE2)
APACHE_PORT?= www/apache2
.else
APACHE_PORT?= www/apache13
.endif
APXS?= ${LOCALBASE}/sbin/apxs
.if defined(USE_APACHE)
BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
RUN_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
.endif
.if ${OSVERSION} >= 500036
PERL_VERSION?= 5.8.6
PERL_VER?= 5.8.6
.else
.if ${OSVERSION} >= 500032
PERL_VERSION?= 5.6.1
PERL_VER?= 5.6.1
.else
.if ${OSVERSION} >= 500007
PERL_VERSION?= 5.6.0
PERL_VER?= 5.6.0
.else
.if ${OSVERSION} >= 300000
PERL_VERSION?= 5.00503
.else
PERL_VERSION?= 5.00502
.endif
PERL_VER?= 5.005
.endif
.endif
.endif
.if !defined(PERL_LEVEL) && defined(PERL_VERSION)
perl_major= ${PERL_VERSION:C|^([1-9]+).*|\1|}
_perl_minor= 00${PERL_VERSION:C|^([1-9]+)\.([0-9]+).*|\2|}
perl_minor= ${_perl_minor:C|^.*(...)|\1|}
.if ${perl_minor} >= 100
perl_minor= ${PERL_VERSION:C|^([1-9]+)\.([0-9][0-9][0-9]).*|\2|}
perl_patch= ${PERL_VERSION:C|^.*(..)|\1|}
.else # ${perl_minor} < 100
_perl_patch= 0${PERL_VERSION:C|^([1-9]+)\.([0-9]+)\.*|0|}
perl_patch= ${_perl_patch:C|^.*(..)|\1|}
.endif # ${perl_minor} < 100
PERL_LEVEL= ${perl_major}${perl_minor}${perl_patch}
.else
PERL_LEVEL=0
.endif # !defined(PERL_LEVEL) && defined(PERL_VERSION)
.if ${PERL_LEVEL} >= 500600
PERL_ARCH?= mach
.else
PERL_ARCH?= ${ARCH}-freebsd
.endif
.if ${PERL_LEVEL} >= 500800
PERL_PORT?= perl5.8
.else
PERL_PORT?= perl5
.endif
SITE_PERL_REL?= lib/perl5/site_perl/${PERL_VER}
SITE_PERL?= ${LOCALBASE}/${SITE_PERL_REL}
.if ${PERL_LEVEL} < 500600
PERL5= /usr/bin/perl${PERL_VERSION}
PERL= /usr/bin/perl
.else
PERL5= ${LOCALBASE}/bin/perl${PERL_VERSION}
PERL= ${LOCALBASE}/bin/perl
.endif
# XXX: (not yet): .if defined(USE_AUTOTOOLS)
# .include "${PORTSDIR}/Mk/bsd.autotools.mk"
# XXX: (not yet): .endif
.if defined(USE_OPENSSL)
.include "${PORTSDIR}/Mk/bsd.openssl.mk"
.endif
.if defined(EMACS_PORT_NAME)
.include "${PORTSDIR}/Mk/bsd.emacs.mk"
.endif
.if defined(USE_GNUSTEP)
.include "${PORTSDIR}/Mk/bsd.gnustep.mk"
.endif
.if defined(USE_PHP)
.include "${PORTSDIR}/Mk/bsd.php.mk"
.endif
.if defined(USE_PYTHON)
.include "${PORTSDIR}/Mk/bsd.python.mk"
.endif
.if defined(USE_JAVA)
.include "${PORTSDIR}/Mk/bsd.java.mk"
.endif
.if defined(USE_RUBY) || defined(USE_LIBRUBY)
.include "${PORTSDIR}/Mk/bsd.ruby.mk"
.endif
.if defined(USE_QT_VER) || defined(USE_KDELIBS_VER) || defined(USE_KDEBASE_VER)
.include "${PORTSDIR}/Mk/bsd.kde.mk"
.endif
.if defined(WANT_GNOME) || defined(USE_GNOME) || defined(USE_GTK)
.include "${PORTSDIR}/Mk/bsd.gnome.mk"
.endif
.if defined(USE_SDL) || defined(WANT_SDL)
.include "${PORTSDIR}/Mk/bsd.sdl.mk"
.endif
.if ${OSVERSION} >= 502123
X_WINDOW_SYSTEM ?= xorg
.elif (${OSVERSION} >= 450005 && !defined(XFREE86_VERSION)) || \
(defined(XFREE86_VERSION) && ${XFREE86_VERSION} == 4)
X_WINDOW_SYSTEM ?= xfree86-4
.else
X_WINDOW_SYSTEM ?= xfree86-3
.endif
# Location of mounted CDROM(s) to search for files
CD_MOUNTPTS?= /cdrom ${CD_MOUNTPT}
WANT_OPENLDAP_VER?= 22
# Owner and group of the WWW user
WWWOWN?= www
WWWGRP?= www

View file

@ -1,3 +1,434 @@
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
# $FreeBSD$
#
# The include file <bsd.port.subdir.mk> contains the default targets
# for building ports subdirectories.
#
#
# +++ variables +++
#
# STRIP The flag passed to the install program to cause the binary
# to be stripped. This is to be used when building your
# own install script so that the entire system can be made
# stripped/not-stripped using a single knob. [-s]
#
# ECHO_MSG Used to print all the '===>' style prompts - override this
# to turn them off [echo].
#
# OPSYS Get the operating system type [`uname -s`]
#
# SUBDIR A list of subdirectories that should be built as well.
# Each of the targets will execute the same target in the
# subdirectories.
#
#
# +++ targets +++
#
# README.html:
# Creating README.html for package.
#
# afterinstall, all, beforeinstall, build, checksum, clean,
# clean-for-cdrom, clean-restricted,
# clean-for-cdrom-list, clean-restricted-list,
# configure, deinstall,
# depend, depends, describe, extract, fetch, fetch-list, ignorelist,
# install, maintainer, makesum, package, readmes, realinstall, reinstall,
# tags
#
# search:
# Search for ports using either 'make search key=<keyword>'
# or 'make search name=<keyword>'.
.include "${PORTSDIR}/Mk/bsd.port.subdir.mk"
.MAIN: all
.if !defined(DEBUG_FLAGS)
STRIP?= -s
.endif
.if !defined(NOPRECIOUSMAKEVARS)
.if !defined(ARCH)
ARCH!= /usr/bin/uname -p
.endif
.if !defined(OSREL)
OSREL!= /usr/bin/uname -r | sed -e 's/[-(].*//'
.endif
.if !defined(OSVERSION)
.if exists(/sbin/sysctl)
OSVERSION!= /sbin/sysctl -n kern.osreldate
.else
OSVERSION!= /usr/sbin/sysctl -n kern.osreldate
.endif
.endif
.if !defined(PORTOBJFORMAT)
PORTOBJFORMAT!= test -x /usr/bin/objformat && /usr/bin/objformat || echo aout
.endif
.endif
ID?= /usr/bin/id
UID!= ${ID} -u
LOCALBASE?= ${DESTDIR}/usr/local
.if exists(${LOCALBASE}/sbin/pkg_info)
PKG_INFO?= ${LOCALBASE}/sbin/pkg_info
.else
PKG_INFO?= /usr/sbin/pkg_info
.endif
SED?= /usr/bin/sed
PKGINSTALLVER!= ${PKG_INFO} -P 2>/dev/null | ${SED} -e 's/.*: //'
.if !defined(OPSYS)
OPSYS!= /usr/bin/uname -s
.endif
ECHO_MSG?= echo
# local customization of the ports tree
.if exists(${.CURDIR}/Makefile.local)
.include "${.CURDIR}/Makefile.local"
.endif
TARGETS+= all
TARGETS+= build
TARGETS+= checksum
TARGETS+= clean
TARGETS+= clean-for-cdrom
TARGETS+= clean-for-cdrom-list
TARGETS+= clean-restricted
TARGETS+= clean-restricted-list
TARGETS+= configure
TARGETS+= deinstall
TARGETS+= depend
TARGETS+= depends
TARGETS+= distclean
TARGETS+= extract
TARGETS+= fetch
TARGETS+= fetch-list
TARGETS+= ignorelist
TARGETS+= makesum
TARGETS+= maintainer
TARGETS+= package
TARGETS+= package-recursive
TARGETS+= realinstall
TARGETS+= reinstall
TARGETS+= tags
.for __target in ${TARGETS}
.if !target(${__target})
.if defined(SUBDIR) && !empty(SUBDIR)
${__target}: ${SUBDIR:S/^/_/:S/$/.${__target}/}
.else
${__target}:
.endif
.endif
.endfor
.if defined(SUBDIR) && !empty(SUBDIR)
.for __target in ${TARGETS} checksubdirs describe readmes
${SUBDIR:S/^/_/:S/$/.${__target}/}: _SUBDIRUSE
.endfor
_SUBDIRUSE: .USE
@OK=""; sub=${.TARGET:S/^_//:R}; \
for dud in $$DUDS; do \
if [ $${dud} = $$sub ]; then \
OK="false"; \
${ECHO_MSG} "===> ${DIRPRFX}$$sub skipped"; \
fi; \
done; \
if test -d ${.CURDIR}/$${sub}.${MACHINE_ARCH}; then \
edir=$${sub}.${MACHINE_ARCH}; \
elif test -d ${.CURDIR}/$${sub}; then \
edir=$${sub}; \
else \
OK="false"; \
${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
fi; \
if [ "$$OK" = "" ]; then \
${ECHO_MSG} "===> ${DIRPRFX}$${edir}"; \
cd ${.CURDIR}/$${edir}; \
${MAKE} -B ${.TARGET:E:realinstall=install} \
DIRPRFX=${DIRPRFX}$$edir/; \
fi
.for _subdir in ${SUBDIR:S/^/_/}
${_subdir}:: ${_subdir:S/$/.all/}
.endfor
.endif
.if !target(install)
.if !target(beforeinstall)
beforeinstall:
.endif
.if !target(afterinstall)
afterinstall:
.endif
install: afterinstall
afterinstall: realinstall
realinstall: beforeinstall ${SUBDIR:S/^/_/:S/$/.realinstall/}
.endif
IGNOREDIR= CVS Mk Templates Tools distfiles packages pkg
.if !target(checksubdirs)
.if defined(PORTSTOP)
checksubdirs: checksubdir ${SUBDIR:S/^/_/:S/$/.checksubdirs/}
.else
checksubdirs: checksubdir
.endif
.endif
.if !target(checksubdir)
checksubdir:
@for d in *; do \
if [ -d "$$d" ]; then \
found=0; \
for s in ${SUBDIR} ${IGNOREDIR}; do \
if [ "x$$s" = "x$$d" ]; then \
found=1; \
break; \
fi; \
done; \
if [ $$found = 0 ]; then \
${ECHO} "Warning: directory $$d not in SUBDIR"; \
fi; \
fi; \
done
@for s in ${SUBDIR}; do \
if ! [ -d ${.CURDIR}/$$s ]; then \
${ECHO} "Warning: directory $$s in SUBDIR does not exist"; \
fi \
done
.endif
.if !target(describe)
.if defined(PORTSTOP)
# This is a bit convoluted to deal with the fact that make will overlap I/O from child make processes
# if they write more than 2k: this will corrupt the INDEX file. make -P does not do this, but it adds
# extraneous output and redirects stderr, so we lose error reporting from child makes. Instead we have
# to roll our own implementation of make -P and make sure that each child make writes to their own file,
# which we will combine at the end. This gives substantial performance benefits over doing a make -j1
.if defined(BUILDING_INDEX)
describe: ${SUBDIR:S/^/describe./}
.for i in ${SUBDIR}
describe.$i:
@cd ${.CURDIR}; ${MAKE} -B ${i:S/^/_/:S/$/.describe/} > ${INDEX_TMPDIR}/${INDEXFILE}.desc.${i}
.endfor
.else
describe: ${SUBDIR:S/^/_/:S/$/.describe/}
.endif
.else
describe:
@for sub in ${SUBDIR}; do \
if test -d ${.CURDIR}/$${sub}; then \
${ECHO_MSG} "===> ${DIRPRFX}$${sub}"; \
cd ${.CURDIR}/$${sub}; \
${MAKE} -B describe || \
(echo "===> ${DIRPRFX}$${sub} failed" >&2; \
exit 1) ;\
else \
${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
fi; \
done
.endif
.endif
.if !target(readmes)
.if defined(PORTSTOP)
readmes: readme ${SUBDIR:S/^/_/:S/$/.readmes/}
@${ECHO_MSG} "===> Creating README.html for all ports"
@perl ${PORTSDIR}/Tools/make_readmes < ${PORTSDIR}/${INDEXFILE}
.else
readmes: readme
.endif
.endif
.if !target(readme)
readme:
@rm -f README.html
@make README.html
.endif
.if (${OPSYS} == "NetBSD")
PORTSDIR ?= /usr/opt
.else
PORTSDIR ?= /usr/ports
.endif
TEMPLATES ?= ${PORTSDIR}/Templates
.if defined(PORTSTOP)
README= ${TEMPLATES}/README.top
.else
README= ${TEMPLATES}/README.category
.endif
COMMENTFILE?= ${.CURDIR}/pkg/COMMENT
DESCR?= ${.CURDIR}/pkg/DESCR
.if ${OSVERSION} >= 600000
INDEXFILE?= INDEX-6
.elif ${OSVERSION} >= 500036
INDEXFILE?= INDEX-5
.else
INDEXFILE?= INDEX
.endif
HTMLIFY= sed -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
package-name:
@echo ${.CURDIR} | sed -e 's^.*/^^'
README.html:
@echo "===> Creating README.html"
@> $@.tmp
.for entry in ${SUBDIR}
.if exists(${entry})
.if defined(PORTSTOP)
@echo -n '<a href="'${entry}/README.html'">'"`echo ${entry} | ${HTMLIFY}`"'</a>: ' >> $@.tmp
.else
@echo -n '<a href="'${entry}/README.html'">'"`cd ${entry}; make package-name | ${HTMLIFY}`</a>: " >> $@.tmp
.endif
@echo `cd ${entry}; make -V COMMENT` | ${HTMLIFY} >> $@.tmp
.endif
.endfor
@sort -t '>' +1 -2 $@.tmp > $@.tmp2
.if exists(${DESCR})
@${HTMLIFY} ${DESCR} > $@.tmp3
.else
@> $@.tmp3
.endif
.if defined(COMMENT)
@echo "${COMMENT}" | ${HTMLIFY} > $@.tmp4
.else
.if exists(${COMMENTFILE})
@${HTMLIFY} ${COMMENTFILE} > $@.tmp4
.else
@> $@.tmp4
.endif
.endif
@cat ${README} | \
sed -e 's/%%CATEGORY%%/'"`basename ${.CURDIR}`"'/g' \
-e '/%%COMMENT%%/r$@.tmp4' \
-e '/%%COMMENT%%/d' \
-e '/%%DESCR%%/r$@.tmp3' \
-e '/%%DESCR%%/d' \
-e '/%%SUBDIR%%/r$@.tmp2' \
-e '/%%SUBDIR%%/d' \
> $@
@rm -f $@.tmp $@.tmp2 $@.tmp3 $@.tmp4
.if !defined(NOPRECIOUSMAKEVARS)
.MAKEFLAGS: \
ARCH="${ARCH:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
OPSYS="${OPSYS:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
OSREL="${OSREL:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
OSVERSION="${OSVERSION:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
PORTOBJFORMAT="${PORTOBJFORMAT:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
UID="${UID:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
PKGINSTALLVER="${PKGINSTALLVER:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}"
.endif
PORTSEARCH_DISPLAY_FIELDS?=name,path,info,maint,index,bdeps,rdeps,www
PORTSEARCH_KEYLIM?=0
PORTSEARCH_XKEYLIM?=0
PORTSEARCH_IGNORECASE?=1
search: ${PORTSDIR}/${INDEXFILE}
@here=${.CURDIR}; \
cd ${PORTSDIR}; \
if [ -z "$$key" -a -z "$$xkey" -a \
-z "$$name" -a -z "$$xname" -a \
-z "$$path" -a -z "$$xpath" -a \
-z "$$info" -a -z "$$xinfo" -a \
-z "$$maint" -a -z "$$xmaint" -a \
-z "$$cat" -a -z "$$xcat" -a \
-z "$$bdeps" -a -z "$$xbdeps" -a \
-z "$$rdeps" -a -z "$$xrdeps" -a \
-z "$$www" -a -z "$$xwww" ]; \
then \
echo "The search target requires a keyword parameter or name parameter,"; \
echo "e.g.: \"make search key=somekeyword\""; \
echo "or \"make search name=somekeyword\""; \
exit; \
fi; \
awk -F\| -v there="$$here/" -v top="$$(pwd -P)" \
-v key="$$key" -v xkey="$$xkey" \
-v name="$$name" -v xname="$$xname" \
-v path="$$path" -v xpath="$$xpath" \
-v info="$$info" -v xinfo="$$xinfo" \
-v maint="$$maint" -v xmaint="$$xmaint" \
-v cat="$$cat" -v xcat="$$xcat" \
-v bdeps="$$bdeps" -v xbdeps="$$xbdeps" \
-v rdeps="$$rdeps" -v xrdeps="$$xrdeps" \
-v www="$$www" -v xwww="$$xwww" \
-v icase="$${icase:-${PORTSEARCH_IGNORECASE}}" \
-v keylim="$${keylim:-${PORTSEARCH_KEYLIM}}" \
-v xkeylim="$${xkeylim:-${PORTSEARCH_XKEYLIM}}" \
-v display="$${display:-${PORTSEARCH_DISPLAY_FIELDS}}" \
'BEGIN { \
gsub(/\+/,"\\+",name); \
if (substr(there, 1, length(top)) == top) \
there = "${PORTSDIR}" substr(there, 1 + length(top)); \
therelen = length(there); \
keylen = length(key); keylim = keylim && keylen; \
if (!keylim && keylen) \
parms[0] = (icase ? tolower(key) : key); \
xkeylen = length(xkey); xkeylim = xkeylim && xkeylen; \
if (!xkeylim && xkeylen) \
xparms[0] = (icase ? tolower(xkey) : xkey); \
if (icase) { \
if (length(name)) parms[1] = tolower(name); if (length(xname)) xparms[1] = tolower(xname); \
if (length(path)) parms[2] = tolower(path); if (length(xpath)) xparms[2] = tolower(xpath); \
if (length(info)) parms[4] = tolower(info); if (length(xinfo)) xparms[4] = tolower(xinfo); \
if (length(maint)) parms[6] = tolower(maint); if (length(xmaint)) xparms[6] = tolower(xmaint); \
if (length(cat)) parms[7] = tolower(cat); if (length(xcat)) xparms[7] = tolower(xcat); \
if (length(bdeps)) parms[8] = tolower(bdeps); if (length(xbdeps)) xparms[8] = tolower(xbdeps); \
if (length(rdeps)) parms[9] = tolower(rdeps); if (length(xrdeps)) xparms[9] = tolower(xrdeps); \
if (length(www)) parms[10] = tolower(www); if (length(xwww)) xparms[10] = tolower(xwww); \
} else { \
if (length(name)) parms[1] = name; if (length(xname)) xparms[1] = xname; \
if (length(path)) parms[2] = path; if (length(xpath)) xparms[2] = xpath; \
if (length(info)) parms[4] = info; if (length(xinfo)) xparms[4] = xinfo; \
if (length(maint)) parms[6] = maint; if (length(xmaint)) xparms[6] = xmaint; \
if (length(cat)) parms[7] = cat; if (length(xcat)) xparms[7] = xcat; \
if (length(bdeps)) parms[8] = bdeps; if (length(xbdeps)) xparms[8] = xbdeps; \
if (length(rdeps)) parms[9] = rdeps; if (length(xrdeps)) xparms[9] = xrdeps; \
if (length(www)) parms[10] = www; if (length(xwww)) xparms[10] = xwww; \
} \
fields["name"] = 1; names[1] = "Port"; \
fields["path"] = 2; names[2] = "Path"; \
fields["info"] = 4; names[4] = "Info"; \
fields["maint"] = 6; names[6] = "Maint"; \
fields["cat"] = 7; names[7] = "Index"; \
fields["bdeps"] = 8; names[8] = "B-deps"; \
fields["rdeps"] = 9; names[9] = "R-deps"; \
fields["www"] = 10; names[10] = "WWW"; \
split(display, d, /,[ \t]*/); \
for (i in d) { \
disp[fields[d[i]]] = 1; \
} \
} \
{ \
if (substr($$2, 1, therelen) != there) \
next; \
for (i in parms) \
if ((icase ? tolower($$i) : $$i) !~ parms[i]) \
next; \
for (i in xparms) \
if ((icase ? tolower($$i) : $$i) ~ xparms[i]) \
next; \
found = 0; \
for (i = 1; i < 11; i++) \
if (i in disp) { \
if (xkeylim && (icase ? tolower($$i) : $$i) ~ xkey) \
next; \
if (!found && keylim && (icase ? tolower($$i) : $$i) ~ key) \
found = 1; \
} \
if (keylim && !found) \
next; \
for (i = 1; i < 11; i++) \
if (i in disp) \
printf("%s:\t%s\n", names[i], $$i); \
print(""); \
}' ${PORTSDIR}/${INDEXFILE}

145
devel/portmk/Mk/bsd.tcl.mk Normal file
View file

@ -0,0 +1,145 @@
# -*- mode: Makefile; tab-width: 4; -*-
# ex: ts=4
#
# $FreeBSD$
#
.if !defined(_POSTMKINCLUDED) && !defined(Tcl_Pre_Include)
Tcl_Pre_Include= bsd.tcl.mk
Tcl_Include_MAINTAINER= vsevolod@FreeBSD.org
# USE_TCL: Depend on tcl to run. In case of incompatible APIs of different
# TCL versions the version can be specified directly. If version
# is not specified (USE_TCL=yes) then the latest version is
# used (8.4 currently).
# Available values are: 84, 83, 82, 81 and 80.
#
# USE_TK: Depend on tk to run. In case of incompatible APIs of different
# TK versions the version can be specified directly. If version
# is not specified (USE_TK=yes) then the latest version is
# used (8.4 currently).
# Available values are: 84, 83, 82, 81 and 80.
##
# TCL_LIBDIR: Path where tcl libraries can be found
#
# TCL_INCLUDEDIR: Path where tcl C headers can be found
##
# TK_LIBDIR: Path where tk libraries can be found
#
# TK_INCLUDEDIR: Path where tk C headers can be found
##
# TCLSH: Path to tclsh executable respecting tcl version
#
# WISH: Path to wish executable respecting tk version
##
# PATCH_TCL_SCRIPTS: List of tcl scripts that need to be patched to replace tclsh
# calls to tclsh${TK_VER} calls. Note that this implies USE_REINPLACE
# as REINPLACE_CMD is used for patching. Also note that post-patch
# target is used.
#
# PATCH_TK_SCRIPTS: List of tcl scripts that need to be patched to replace wish
# calls to wish${TK_VER} calls. Note that this implies USE_REINPLACE
# as REINPLACE_CMD is used for patching. Also note that post-patch
# target is used.
.if defined(USE_TCL) || defined(USE_TCL_BUILD)
_TCL_VERSIONS= 84 83 82 81 80
.if defined(USE_TCL_BUILD)
USE_TCL= ${USE_TCL_BUILD}
_BUILD= yes
.endif
.if ${USE_TCL} == "yes"
USE_TCL= 84
.endif
TCL_VER:= ${USE_TCL:S/8/8./}
# Special case
.if ${USE_TCL} == "81"
USE_TCL= tcl81-thread
.endif
_FOUND= no
.for ver in ${_TCL_VERSIONS}
. if ${USE_TCL} == ${ver}
_FOUND= yes
. if defined(_BUILD)
BUILD_DEPENDS+= tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${USE_TCL}
. else
RUN_DEPENDS+= tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${USE_TCL}
. endif
TCL_INCLUDEDIR= ${LOCALBASE}/include/tcl${TCL_VER}
TCL_LIBDIR= ${LOCALBASE}/lib/tcl${TCL_VER}
TCLSH= ${LOCALBASE}/bin/tclsh${TCL_VER}
. endif
.endfor
.if ${_FOUND} == "no"
IGNORE= "Unknown TCL version specified: ${USE_TCL}"
.endif
.endif # defined(USE_TCL)
.if defined(USE_TK)
_TK_VERSIONS= 84 83 82 81 80
.if ${USE_TK} == "yes"
USE_TK= 84
.endif
TK_VER:= ${USE_TK:S/8/8./}
.if defined(USE_TCL) && ${TCL_VER} != ${TK_VER}
IGNORE= "TCL and TK versions must be equal (${TCL_VER} vs ${TK_VER})"
.endif
_FOUND= no
.for ver in ${_TK_VERSIONS}
. if ${USE_TK} == ${ver}
_FOUND= yes
RUN_DEPENDS+= wish${TK_VER}:${PORTSDIR}/x11-toolkits/tk${USE_TK}
TCL_INCLUDEDIR= ${LOCALBASE}/include/tcl${TK_VER}
TCL_LIBDIR= ${LOCALBASE}/lib/tcl${TK_VER}
TK_INCLUDEDIR= ${LOCALBASE}/include/tk${TK_VER}
TK_LIBDIR= ${LOCALBASE}/lib/tk${TK_VER}
TCLSH= ${LOCALBASE}/bin/tclsh${TK_VER}
WISH= ${LOCALBASE}/bin/wish${TK_VER}
. endif
.endfor
.if ${_FOUND} == "no"
IGNORE= "Unknown TK version specified: ${USE_TK}"
.endif
.endif # defined(USE_TK)
.if defined(PATCH_TCL_SCRIPTS) || defined (PATCH_TK_SCRIPTS)
USE_REINPLACE= yes
.endif
.endif # !defined(_POSTMKINCLUDED) && !defined(Tcl_Pre_Include)
.if defined(_POSTMKINCLUDED) && !defined(Tcl_Post_Include)
Tcl_Post_Include= bsd.tcl.mk
.if defined(PATCH_TCL_SCRIPTS) || defined (PATCH_TK_SCRIPTS)
.if !target(post-patch)
post-patch:
.if defined(PATCH_TCL_SCRIPTS) && defined(TCLSH)
. for tcl_script in ${PATCH_TCL_SCRIPTS}
@${REINPLACE_CMD} -e 's,tclsh,${TCLSH},' ${WRKSRC}/${tcl_script}
. endfor
.endif
.if defined(PATCH_TK_SCRIPTS) && defined(WISH)
. for tk_script in ${PATCH_TK_SCRIPTS}
@${REINPLACE_CMD} -e 's,wish,${WISH},' ${WRKSRC}/${tk_script}
. endfor
.endif
.endif # !target(post-patch)
.endif # defined(PATCH_TCL_SCRIPTS) || defined (PATCH_TK_SCRIPTS)
.endif # defined(_POSTMKINCLUDED) && !defined(Tcl_Post_Include)

File diff suppressed because it is too large Load diff

View file

@ -1,373 +0,0 @@
#!/usr/bin/perl -w
#
# Copyright (c) 2004 Oliver Eikemeier. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
#
# MAINTAINER= eik@FreeBSD.org
#
require 5.005;
use strict;
use Getopt::Std;
my $pkgname;
my %description;
my %values;
my @order;
my @section;
my %haswithout;
my %hasoverride;
my %default;
my %value;
my $isoverride;
my $isedit;
sub parsemaster {
my $currdesc;
my ($master) = @_;
-r $master
or return 1;
open MASTER, "<$master"
or die "Can't read $master: $!\n";
push @section, "Configurable options for $pkgname";
push @order, $#section;
$description{0} = [];
while(<MASTER>) {
chomp;
last if /^##/;
next if /^#?\s*$/;
if (/^#!\s*(.*)$/) {
if ($1 =~ /MAIN/i) {
$currdesc = \@{$description{0}};
}
else {
push @section, $1;
$currdesc = \@{$description{$#section}};
push @order, $#section;
}
}
elsif(/^#WITH(OUT)?_([A-Z][A-Z0-9_]*)(?:=\s*(.*))?$/) {
my ($without, $name, $val) = ($1, $2, $3);
if (defined $values{$name}) {
print STDERR ">> $pkgname: Duplicate parameter $name at $master line $.: $_.\n";
next;
}
if (defined $val) {
my @v;
foreach my $r (split /,\s*/, $val) {
$r =~ s/\s+$//;
if (length $r > 0) {
push @v, $r;
$haswithout{$name} = 1
if $r =~ /^(?:no|none|off|false)$/i;
}
}
if ($#v == -1 || $#v == 0 && $v[0] =~ /^auto$/i) {
push @v, qw(yes no);
$haswithout{$name} = 1;
}
$values{$name} = \@v;
$default{$name} = defined $without && $haswithout{$name} ? 'no' : $values{$name}->[0];
}
else {
@{$values{$name}} = qw(yes no);
$haswithout{$name} = 1;
$default{$name} = defined $without ? 'no' : 'yes';
}
$currdesc = \@{$description{$name}};
push @order, $name;
}
elsif (/^# (.*)$/) {
push @{$currdesc}, $1
if defined $currdesc;
}
elsif (/^##$/) {
last;
}
else {
print STDERR ">> $pkgname: Parse error at $master line $.: $_.\n"
}
}
close MASTER;
}
sub parseoverride {
my $currdesc;
my ($override) = @_;
-r $override
or return 1;
open OVERRIDE, "<$override"
or die "Can't read $override: $!\n";
while(<OVERRIDE>) {
chomp;
last if /^##/;
next if /^#?\s*$/;
next if /^#\s*\$FreeBSD/;
if (/^#!/) {
undef $currdesc;
}
elsif(/^#WITH(OUT)?_([A-Z][A-Z0-9_]*)(?:=\s*(.*))?$/) {
my ($without, $name, $val) = ($1, $2, $3);
if (!defined $values{$name}) {
print STDERR ">> $pkgname: Override parameter $name not in master file.\n";
next;
}
if (defined $val) {
my @v;
foreach my $r (split /,\s*/, $val) {
$r =~ s/\s+$//;
if (length $r > 0) {
push @v, $r;
$haswithout{$name} = 1
if $r =~ /^(?:no|none|off|false)$/i;
}
}
if ($#v == -1 || $#v == 0 && $v[0] =~ /^auto$/i) {
push @v, qw(yes no);
$haswithout{$name} = 1;
}
$values{$name} = \@v;
$default{$name} = defined $without && $haswithout{$name} ? 'no' : $values{$name}->[0];
}
else {
@{$values{$name}} = qw(yes no);
$haswithout{$name} = 1;
$default{$name} = defined $without ? 'no' : 'yes';
}
delete $description{$name};
$currdesc = \@{$description{$name}};
$hasoverride{$name} = 1;
}
elsif (/^# (.*)$/) {
push @{$currdesc}, $1
if defined $currdesc;
}
elsif (/^##$/) {
last;
}
else {
print STDERR ">> $pkgname: Parse error at $override line $.: $_.\n"
}
}
close OVERRIDE;
$isoverride = 1;
}
sub parseoptions {
my ($options) = @_;
-r $options
or return 1;
open OPTIONS, "<$options"
or die "Can't open $options: $!\n";
while (<OPTIONS>) {
chomp;
next if /^(:?#|\s*$)/;
next if /^_OPTIONS/;
next if /^\./;
if (/^WITH(OUT)?_([A-Z][A-Z0-9_]*)\??=(.*)$/) {
my ($without, $name, $val) = ($1, $2, $3);
next if !defined $values{$name};
next if defined $value{$name};
if (defined $without) {
$value{$name} = 'no';
}
else {
$value{$name} = $val;
}
}
else {
print STDERR ">> $pkgname: Parse error at $options line $.: $_\n";
}
}
}
sub parseeditoptions {
my ($options) = @_;
-r $options
or return 1;
open OPTIONS, "<$options"
or die "Can't open $options: $!\n";
while (<OPTIONS>) {
chomp;
s/\s*#.*$//;
next if /^$/;
if (/^([A-Z][A-Z0-9_]*)\s*=\s*(.*)$/) {
my ($name, $val) = ($1, $2);
next if !defined $values{$name};
next if $#{$values{$name}} == 0 && $values{$name}->[0] =~ /^ignore$/i;
next if $isoverride && $#{$values{$name}} == 0;
my $candidate;
foreach my $c (@{$values{$name}}) {
if ($c eq '*' || $c eq $val) {
$candidate = $val;
last;
}
elsif (lc $c eq lc $val) {
$candidate = $c;
}
elsif ($c eq 'yes' && $val =~ /^(?:y|yes|on|t|true)$/i) {
$candidate = $c;
}
elsif ($c eq 'no' && $val =~ /^(?:n|no|off|f|false)$/i) {
$candidate = $c;
}
}
$value{$name} = $candidate
if defined $candidate;
}
else {
print STDERR ">> $pkgname: Parse error at $options line $.: $_\n";
}
}
$isedit = 1;
}
sub print_editoptions {
foreach my $name (@order) {
if ($name =~ /^\d/) {
my $headline;
foreach (1..length $section[$name]) {
$headline .= "#";
}
print "##$headline##\n";
print "# $section[$name] #\n";
print "##$headline##\n";
print @{$description{$name}} ? "#\n" : "\n";
}
else {
my $val = $default{$name};
next if $#{$values{$name}} == 0 && $values{$name}->[0] =~ /^ignore$/i;
if (defined $value{$name} && !($isoverride && $#{$values{$name}} == 0)) {
$val = $value{$name};
}
print "$name=", $val,
" # valid values: ", join(", ", @{$values{$name}}), "\n";
}
if (@{$description{$name}}) {
foreach (@{$description{$name}}) {
if ($_ eq '.') {
print "#\n";
}
elsif ($_ =~ /^#/) {
print "#$_\n";
}
else {
print "# $_\n";
}
}
print "\n";
}
}
}
sub print_dialogoptions {
foreach my $name (@order) {
next if $name =~ /^\d/;
next if !$isedit && $isoverride && !$hasoverride{$name};
next if !$isedit && $#{$values{$name}} == 0 && $values{$name}->[0] =~ /^ignore$/i;
my $val = defined $value{$name} ? $value{$name} : $default{$name};
next if $val ne 'yes' && $val ne 'no';
$val = $val eq 'yes' ? 'On' : 'Off';
my $desc = join ' ', @{$description{$name}};
$desc = "$name support"
if !$desc;
$desc =~ s/\. .*//;
$desc = substr($desc, 0, 38) . '...'
if length $desc > 41;
$desc =~ s/["\$]/\\&/g;
print ' ', $name, ' "', $desc, '" ', $val;
}
print "\n";
}
sub print_options {
print "_OPTIONSNG_READ?=$pkgname\n";
foreach my $name (@order) {
next if $name =~ /^\d/;
next if !$isedit && $isoverride && !$hasoverride{$name};
next if !$isedit && $#{$values{$name}} == 0 && $values{$name}->[0] =~ /^ignore$/i;
my $val = defined $value{$name} ? $value{$name} : $default{$name};
if ($haswithout{$name}) {
if ($val =~ /^(no|none|off|false)$/i) {
print ".undef WITH_$name\n"
if (!$isedit && $isoverride && $#{$values{$name}} == 0);
print ".ifndef WITH_$name\n";
print "WITHOUT_$name?=yes\n";
print ".endif\n";
}
else {
print ".undef WITHOUT_$name\n"
if (!$isedit && $isoverride && $#{$values{$name}} == 0);
print ".ifndef WITHOUT_$name\n";
print "WITH_$name?=$val\n";
print ".endif\n";
}
}
else {
print "WITH_$name?=$val\n";
}
}
}
my %opts;
getopts('p:M:O:g:t:edo', \%opts);
$pkgname = defined $opts{p} ? $opts{p} : "anonyous";
parsemaster $opts{M}
if defined $opts{M};
parseoverride $opts{O}
if defined $opts{O};
parseoptions $opts{g}
if defined $opts{g};
parseeditoptions $opts{t}
if defined $opts{t};
print_editoptions
if $opts{e};
print_dialogoptions
if $opts{d};
print_options
if $opts{o};

View file

@ -1,299 +0,0 @@
#!/bin/sh -e
#
# Copyright (c) 2004 Oliver Eikemeier. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
#
# MAINTAINER= eik@FreeBSD.org
#
# These variables are referenced and must be exported from the Makefile:
#
# CURDIR
# OBJDIR
# MASTERDIR
# OPTIONS_MASTER
# OPTIONS_OVERRIDE
# OPTIONS_FILE
# OPTIONS_CMD
# PKGNAME
#
# utilities
LOCALBASE="${LOCALBASE:-/usr/local}"
AWK=/usr/bin/awk
CAT=/bin/cat
CHMOD=/bin/chmod
CP=/bin/cp
CUT=/usr/bin/cut
DIALOG=/usr/bin/dialog
EXPR=/bin/expr
FETCH=/usr/bin/fetch
GREP=/usr/bin/grep
LS=/bin/ls
MKDIR='/bin/mkdir -p'
MKTEMP=/usr/bin/mktemp
MV=/bin/mv
REALPATH=/bin/realpath
RM=/bin/rm
SED=/usr/bin/sed
SETENV=/usr/bin/env
SORT=/usr/bin/sort
TR=/usr/bin/tr
WC=/usr/bin/wc
# global constants
### utility functions ###
###
# do_create generates default options for a master (or override) options files
###
do_create()
{
local rc
if [ -n "$OPTIONS_OVERRIDE" ]; then
OVERRIDEFILE="$OPTIONS_DEFAULT"
elif [ "$CURDIR" != `$REALPATH "$MASTERDIR"` ]; then
if [ -f "$CURDIR/options" ]; then
OVERRIDEFILE="$CURDIR/options"
elif [ -n "$PKGNAMESUFFIX" -a -f "$MASTERDIR/options.${PKGNAMESUFFIX#-}" ]; then
OVERRIDEFILE="$MASTERDIR/options.${PKGNAMESUFFIX#-}"
else
OVERRIDEFILE=
fi
else
OVERRIDEFILE=
fi
if [ -n "$OPTIONS_MASTER" ]; then
MASTERFILE="$OPTIONS_MASTER"
elif [ -f "$MASTERDIR/options" ]; then
MASTERFILE="$MASTERDIR/options"
else
echo ">> makeconfig: Can't find $MASTERDIR/options" >&2
return 1
fi
if [ -n "$OVERRIDEFILE" ]; then
SRCFILE="$OVERRIDEFILE"
else
SRCFILE="$MASTERFILE"
fi
if ! TMP_OPTIONS=`$MKTEMP -q "$SRCFILE.XXXXXX"`; then
echo ">> makeconfig: Can't create temporary options file"
return 1
fi
$SED -e '/^##/,$d' "$SRCFILE" > "$TMP_OPTIONS"
echo "## AUTOMATICALLY GENERATED FILE - DO NOT CHANGE ANYTHING BELOW THIS LINE ##" >> "$TMP_OPTIONS"
echo "# use \`make config' to edit the local configuration" >> "$TMP_OPTIONS"
echo "# use \`make makeconfig' to edit the defaults (MAINTAINER only)" >> "$TMP_OPTIONS"
echo >> "$TMP_OPTIONS"
if $OPTIONS_CMD -p "default" -M "$MASTERFILE" -O "$OVERRIDEFILE" -o >> "$TMP_OPTIONS"; then
$MV -f "$TMP_OPTIONS" "$SRCFILE"
$CHMOD a+r "$SRCFILE"
else
$RM -f "$TMP_OPTIONS"
fi
return $rc
}
###
# do_delete removes a saved configuration
###
do_delete()
{
local rc
$RM -f "$OPTIONS_FILE"
return $rc
}
###
# do_edit edits a custom configuration
###
do_edit()
{
local rc
OPTIONS_DIR="${OPTIONS_FILE%/*}"
if [ ! -d "$OPTIONS_DIR" ] && ! $MKDIR "$OPTIONS_DIR"; then
echo ">> config: Can't create $OPTIONS_DIR." 2>&1
return 1
fi
if [ -n "$OPTIONS_OVERRIDE" ]; then
OVERRIDE="$OPTIONS_DEFAULT"
elif [ "$CURDIR" != `$REALPATH "$MASTERDIR"` ]; then
if [ -f "$CURDIR/options" ]; then
OVERRIDE="$CURDIR/options"
elif [ -n "$PKGNAMESUFFIX" -a -f "$MASTERDIR/options.${PKGNAMESUFFIX#-}" ]; then
OVERRIDE="$MASTERDIR/options.${PKGNAMESUFFIX#-}"
else
OVERRIDE=
fi
else
OVERRIDE=
fi
if [ -n "$OPTIONS_MASTER" ]; then
MASTER="$OPTIONS_MASTER"
elif [ -f "$MASTERDIR/options" ]; then
MASTER="$MASTERDIR/options"
else
echo ">> makeconfig: Can't find $MASTERDIR/options" >&2
return 1
fi
TMP_OPTIONS=`$MKTEMP -t options`
$OPTIONS_CMD -p "$PKGNAME" -M "$MASTER" -O "$OVERRIDE" -g "$OPTIONS_FILE" -e > "$TMP_OPTIONS"
${EDITOR:-/usr/bin/vi} "$TMP_OPTIONS"
TMP_OPTIONS_FILE=`$MKTEMP -q "$OPTIONS_FILE.XXXXXX"`
echo "## AUTOMATICALLY GENERATED FILE - DO NOT EDIT ##" > "$TMP_OPTIONS_FILE"
$OPTIONS_CMD -p "$PKGNAME" -M "$MASTER" -O "$OVERRIDE" -g "$OPTIONS_FILE" -t "$TMP_OPTIONS" -o >> "$TMP_OPTIONS_FILE"
$RM -f "$TMP_OPTIONS"
$MV -f "$TMP_OPTIONS_FILE" "$OPTIONS_FILE"
$CHMOD a+r "$OPTIONS_FILE"
return $rc
}
###
# do_graphical displays a menu to generate a custom configuration
###
do_graphical()
{
local rc
if [ -n "$OPTIONS_OVERRIDE" ]; then
OVERRIDE="$OPTIONS_DEFAULT"
elif [ "$CURDIR" != `$REALPATH "$MASTERDIR"` ]; then
if [ -f "$CURDIR/options" ]; then
OVERRIDE="$CURDIR/options"
elif [ -n "$PKGNAMESUFFIX" -a -f "$MASTERDIR/options.${PKGNAMESUFFIX#-}" ]; then
OVERRIDE="$MASTERDIR/options.${PKGNAMESUFFIX#-}"
else
OVERRIDE=
fi
else
OVERRIDE=
fi
if [ -n "$OPTIONS_MASTER" ]; then
MASTER="$OPTIONS_MASTER"
elif [ -f "$MASTERDIR/options" ]; then
MASTER="$MASTERDIR/options"
else
echo ">> makeconfig: Can't find $MASTERDIR/options" >&2
return 1
fi
TMP_OPTIONS=`$MKTEMP -t options`
DIALOGRC=`$OPTIONS_CMD -p "$PKGNAME" -M "$MASTER" -O "$OVERRIDE" -g "$OPTIONS_FILE" -d`
/bin/sh -c "$DIALOG --checklist \"Options for $PKGNAME\" 21 70 15 $DIALOGRC 2>\"$TMP_OPTIONS\""
#TMP_OPTIONS_FILE=`$MKTEMP -q "$OPTIONS_FILE.XXXXXX"`
#echo "## AUTOMATICALLY GENERATED FILE - DO NOT EDIT ##" > "$TMP_OPTIONS_FILE"
#$OPTIONS_CMD -p "$PKGNAME" -M "$MASTER" -O "$OVERRIDE" -g "$OPTIONS_FILE" -t "$TMP_OPTIONS" -o >> "$TMP_OPTIONS_FILE"
$CAT "$TMP_OPTIONS"
$RM -f "$TMP_OPTIONS"
#$MV -f "$TMP_OPTIONS_FILE" "$OPTIONS_FILE"
return $rc
}
###
# do_list lists the current configuration
###
do_list()
{
local rc
return $rc
}
###
# main
###
opt_create=false
opt_delete=false
opt_edit=false
opt_graphical=false
opt_list=false
while getopts "cdegl" opt; do
case "$opt" in
c) opt_create=true;;
d) opt_delete=true;;
e) opt_edit=true;;
g) opt_graphical=true;;
l) opt_list=true;;
?) echo "Usage: $0 -cdegl"; exit 1;;
esac
done
shift $(($OPTIND-1))
$opt_create &&
{ do_create || exit 1; }
$opt_delete &&
{ do_delete || exit 1; }
$opt_edit &&
{ do_edit || exit 1; }
$opt_graphical &&
{ do_graphical || exit 1; }
$opt_list &&
{ do_list || exit 1; }
exit 0

View file

@ -1,139 +0,0 @@
#!/usr/bin/perl -w
#
# Copyright (c) 2004 Oliver Eikemeier. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
#
# MAINTAINER= eik@FreeBSD.org
#
require 5.005;
use strict;
my $dbdir = $ENV{RANKDIR} ? $ENV{RANKDIR} : '/var/db/distrank';
my $fping = $ENV{FPING} ? $ENV{FPING} : '/usr/local/sbin/fping';
-x $fping
or die "fping required\n";
-d $dbdir || mkdir $dbdir, 0777
or die "Can't create $dbdir\n";
my $rankfile = "$dbdir/ranks-fping";
my $now = time;
my %distance;
if (-r $rankfile) {
open RANKS, "<$rankfile";
while (<RANKS>) {
chomp;
my ($host, $d, $e) = split;
$distance{$host} = [$d, $e]
if defined $e && $e >= $now;
}
close RANKS;
}
my %mastersites;
my %newdistance;
my $distgood = 0;
my $distdefault = 5000;
my $distbad = 10000;
my $expgood = $now + 14 * 86400;
my $expdefault = $now + 7 * 86400;
my $hostcount = 0;
while (<>) {
chomp;
next
if exists $mastersites{$_};
if (m'^(?:ftp|https?)://(?:[^/]*@)?([^/:]+\.[^/:]+)(?::\d+)?(?:/|$)'i) {
my $host = lc $1;
$mastersites{$_} = $host;
if (!defined $distance{$host}) {
$distance{$host} = [$distdefault, $expdefault];
$newdistance{$host} = undef
}
$hostcount++;
} elsif (m'^file:'i) {
$mastersites{$_} = 'FILE';
} else {
$mastersites{$_} = 'UNKNOWN';
}
}
if (%newdistance && $hostcount > 1) {
if (!open FPING, '-|') {
if (!open FPINGIN, '|-') {
open STDERR, '>&STDOUT';
exec $fping, '-q', '-C', '3';
die
}
foreach (keys %newdistance) {
print FPINGIN $_, "\n";
}
close FPINGIN;
exit;
}
while(<FPING>) {
/([^\s:]+)\s*:\s*([\s\d.-]*)/ or next;
my $sum = 0.0;
my $num = 0;
foreach my $val (split ' ', $2) {
$val ne '-' || next;
$sum += $val;
$num++;
}
if ($num > 0) {
$distance{$1} = [$sum/$num, $expgood];
}
}
close FPING;
open RANKS, ">$rankfile";
while (my ($host, $val) = each %distance) {
printf RANKS "%s\t%.2f\t%d\n", $host, $val->[0], $val->[1]
if defined $val;
}
close RANKS;
}
$distance{FILE} = [$distgood, 0];
$distance{UNKNOWN} = [$distbad, 0];
foreach (sort {$distance{$mastersites{$a}}->[0] <=> $distance{$mastersites{$b}}->[0]} keys %mastersites) {
print $_, "\n";
}

View file

@ -1,393 +0,0 @@
#!/usr/bin/perl -w
#
# Copyright (c) 2004 Oliver Eikemeier. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
#
# MAINTAINER= eik@FreeBSD.org
#
require 5.005;
use strict;
use Geo::IP;
use constant PI => 3.14159265358979323846;
my $home = $ENV{CC_HOME} ? lc $ENV{CC_HOME} : 'eu';
my $dbdir = $ENV{RANKDIR} ? $ENV{RANKDIR} : '/var/db/distrank';
-d $dbdir || mkdir $dbdir, 0777 or die "Can't create $dbdir\n";
my $rankfile = "$dbdir/ranks-geoip";
my $now = time;
my %distance;
if (-r $rankfile) {
open RANKS, "<$rankfile";
while (<RANKS>) {
chomp;
my ($host, $d, $e) = split;
$distance{$host} = [$d, $e]
if defined $e && $e >= $now;
}
close RANKS;
}
my %mastersites;
my %newdistance;
my $distgood = -1;
my $distdefault = PI/2;
my $distbad = 2;
my $expgood = $now + 14 * 86400;
my $expdefault = $now + 7 * 86400;
my $hostcount = 0;
while (<>) {
chomp;
next
if exists $mastersites{$_};
if (m'^(?:ftp|https?)://(?:[^/]*@)?([^/:]+\.[^/:]+)(?::\d+)?(?:/|$)'i) {
my $host = lc $1;
$mastersites{$_} = $host;
if (!defined $distance{$host}) {
$distance{$host} = [$distdefault, $expdefault];
$newdistance{$host} = undef
}
$hostcount++;
} elsif (m'^file:'i) {
$mastersites{$_} = 'FILE';
} else {
$mastersites{$_} = 'UNKNOWN';
}
}
# calculate_distance and the associated table is from Geo::Mirror, and therefore
# Copyright (c) 2002, T.J. Mather, tjmather@tjmather.com, New York, NY, USA
my (%lat, %lon);
sub getlatlon {
my ($cc) = @_;
my ($lat_cc, $lon_cc) = ($lat{$cc}, $lon{$cc});
# Convert all the degrees to radians
$lat_cc *= PI/180
if defined $lat_cc;
$lon_cc *= PI/180
if defined $lon_cc;
return ($lat_cc, $lon_cc);
}
if (%newdistance && $hostcount > 1) {
while (<main::DATA>) {
my ($country, $lat, $lon) = split(':');
$lat{$country} = $lat;
$lon{$country} = $lon;
}
close main::DATA;
my $gi = Geo::IP->new(GEOIP_MEMORY_CACHE);
my ($lat_home, $lon_home) = getlatlon($home);
foreach (keys %newdistance) {
my $dist;
my $cc = lc $gi->country_code_by_name($_);
if ($cc) {
my ($lat_cc, $lon_cc) = getlatlon($cc)
if defined $cc;
# Find the deltas
my $delta_lat = $lat_cc - $lat_home;
my $delta_lon = $lon_cc - $lon_home;
# Find the Great Circle distance
my $temp = sin($delta_lat/2.0)**2 + cos($lat_home) * cos($lat_cc) * sin($delta_lon/2.0)**2;
$dist = atan2(sqrt($temp),sqrt(1-$temp));
$distance{$_} = [$dist, $expgood]
if defined $dist;
}
}
open RANKS, ">$rankfile";
while (my ($host, $val) = each %distance) {
printf RANKS "%s\t%.4f\t%d\n", $host, $val->[0], $val->[1]
if defined $val;
}
close RANKS;
}
$distance{FILE} = [$distgood, 0];
$distance{UNKNOWN} = [$distbad, 0];
foreach (sort {$distance{$mastersites{$a}}->[0] <=> $distance{$mastersites{$b}}->[0]} keys %mastersites) {
print $_, "\n";
}
__END__
af:33:65
al:41:20
dz:28:3
as:-14:-170
ad:42:1
ao:-12:18
ai:18:-63
aq:-90:0
ag:17:-61
ar:-34:-64
am:40:45
aw:12:-69
au:-27:133
at:47:13
az:40:47
bs:24:-76
bh:26:50
bd:24:90
bb:13:-59
by:53:28
be:50:4
bz:17:-88
bj:9:2
bm:32:-64
bt:27:90
bo:-17:-65
ba:44:18
bw:-22:24
bv:-54:3
br:-10:-55
io:-6:71
vg:18:-64
bg:43:25
bf:13:-2
bi:-3:30
kh:13:105
cm:6:12
ca:60:-95
cv:16:-24
ky:19:-80
cf:7:21
td:15:19
cl:-30:-71
cn:35:105
cx:-10:105
cc:-12:96
co:4:-72
km:-12:44
cd:0:25
cg:-1:15
ck:-21:-159
cr:10:-84
ci:8:-5
hr:45:15
cu:21:-80
cy:35:33
cz:49:15
dk:56:10
dj:11:43
dm:15:-61
do:19:-70
ec:-2:-77
eg:27:30
sv:13:-88
gq:2:10
er:15:39
ee:59:26
et:8:38
fk:-51:-59
fo:62:-7
fj:-18:175
fi:64:26
fr:46:2
gf:4:-53
pf:-15:-140
ga:-1:11
gm:13:-16
ge:42:43
de:51:9
eu:48:10
gh:8:-2
gi:36:-5
gr:39:22
gl:72:-40
gd:12:-61
gp:16:-61
gu:13:144
gt:15:-90
gn:11:-10
gw:12:-15
gy:5:-59
ht:19:-72
hm:-53:72
va:41:12
hn:15:-86
hk:22:114
hu:47:20
is:65:-18
in:20:77
id:-5:120
ir:32:53
iq:33:44
ie:53:-8
il:31:34
it:42:12
jm:18:-77
sj:71:-8
jp:36:138
jo:31:36
ke:1:38
ki:1:173
kp:40:127
kr:37:127
kw:29:45
kg:41:75
lv:57:25
lb:33:35
ls:-29:28
lr:6:-9
ly:25:17
li:47:9
lt:56:24
lu:49:6
mo:22:113
mk:41:22
mg:-20:47
mw:-13:34
my:2:112
mv:3:73
ml:17:-4
mt:35:14
mh:9:168
mq:14:-61
mr:20:-12
mu:-20:57
yt:-12:45
mx:23:-102
fm:6:158
mc:43:7
mn:46:105
ms:16:-62
ma:32:-5
mz:-18:35
na:-22:17
nr:-0:166
np:28:84
nl:52:5
an:12:-68
nc:-21:165
nz:-41:174
ni:13:-85
ne:16:8
ng:10:8
nu:-19:-169
nf:-29:167
mp:15:145
no:62:10
om:21:57
pk:30:70
pw:7:134
pa:9:-80
pg:-6:147
py:-23:-58
pe:-10:-76
ph:13:122
pn:-25:-130
pl:52:20
pt:39:-8
pr:18:-66
qa:25:51
re:-21:55
ro:46:25
ru:60:100
rw:-2:30
sh:-15:-5
kn:17:-62
lc:13:-60
pm:46:-56
vc:13:-61
ws:-13:-172
sm:43:12
st:1:7
sa:25:45
sn:14:-14
sc:-4:55
sl:8:-11
sg:1:103
sk:48:19
si:46:15
sb:-8:159
so:10:49
za:-29:24
gs:-54:-37
es:40:-4
lk:7:81
sd:15:30
sr:4:-56
sj:78:20
sz:-26:31
se:62:15
ch:47:8
sy:35:38
tj:39:71
tz:-6:35
th:15:100
tg:8:1
tk:-9:-172
to:-20:-175
tt:11:-61
tn:34:9
tr:39:35
tm:40:60
tc:21:-71
tv:-8:178
ug:1:32
ua:49:32
ae:24:54
gb:54:-2
us:38:-97
uy:-33:-56
uz:41:64
vu:-16:167
ve:8:-66
vn:16:106
vi:18:-64
wf:-13:-176
eh:24:-13
ye:15:48
yu:44:21
zm:-15:30
zw:-20:30
tw:23:121

View file

@ -0,0 +1,347 @@
#-*- mode: makefile; tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
# bsd.apache.mk - Apache related macros.
# Author: Clement Laforet <clement@FreeBSD.org>
#
# Please view me with 4 column tabs!
##########################################################################
#
# Variables definition
# USE_APACHE: Call this script. Values can be:
# <version>: 1.3/13/2.0/20/2.1/1.3+/2.0+/2.1+
# common*: common13, common20 and common21
# apr: deal with apr stuff ;-)
#
# Print warnings
_ERROR_MSG= : Error from bsd.apache.mk.
APACHE_SUPPORTED_VERSION= 13 20 21
.if ${USE_APACHE:Mcommon*} != ""
AP_PORT_IS_SERVER= YES
.elif ${USE_APACHE:L} == apr
APR_DEPS= YES
.elif ${USE_APACHE:C/\.//:C/\+//:M[12][310]} != ""
AP_PORT_IS_MODULE= YES
#### for backward compatibility
.elif ${USE_APACHE:L} == yes
APXS= ${LOCALBASE}/sbin/apxs
. if defined(WITH_APACHE2)
APACHE_PORT?= www/apache20
. else
APACHE_PORT?= www/apache13
. endif
APXS?= ${LOCALBASE}/sbin/apxs
BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
RUN_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
#### End of backward compatibility
.else
IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE
.endif
.if defined(AP_PORT_IS_SERVER)
# For slave ports:
.if defined(SLAVE_DESIGNED_FOR) && ${PORTVERSION} != ${SLAVE_DESIGNED_FOR}
IGNORE= "Sorry, ${SLAVENAME} and ${PORTNAME} versions are out of sync"
.endif
.if defined(SLAVE_PORT_MODULES)
DEFAULT_MODULES_CATEGORIES+= SLAVE_PORT
ALL_MODULES_CATEGORIES+= SLAVE_PORT
.endif
# Module selection
.for category in ${DEFAULT_MODULES_CATEGORIES}
DEFAULT_MODULES+= ${${category}_MODULES}
WITH_${category}_MODULES= YES
.endfor
.for category in ${ALL_MODULES_CATEGORIES}
AVAILABLE_MODULES+= ${${category}_MODULES}
.endfor
# Setting "@comment " as default.
.for module in ${AVAILABLE_MODULES}
${module}_PLIST_SUB= "@comment "
.endfor
# Configure
# dirty hacks to make sure all modules are disabled before we select them
.if ${USE_APACHE} == common13
CONFIGURE_ARGS+= --disable-module="all"
.elif ${USE_APACHE} == common20
CONFIGURE_ARGS+= --disable-access --disable-auth \
--disable-charset-lite --disable-include \
--disable-log-config --disable-env --disable-setenvif \
--disable-mime --disable-status --disable-autoindex \
--disable-asis --disable-cgid --disable-cgi \
--disable-negotiation --disable-dir --disable-imap \
--disable-actions --disable-userdir --disable-alias
.elif ${USE_APACHE} == common21
CONFIGURE_ARGS+= --disable-authn-file --disable-authn-default \
--disable-authz-host --disable-authz-groupfile \
--disable-authz-user --disable-authz-default \
--disable-auth-basic --disable-charset-lite \
--disable-include --disable-log-config --disable-env \
--disable-setenvif --disable-mime --disable-status \
--disable-autoindex --disable-asis --disable-cgid \
--disable-cgi --disable-negotiation --disable-dir \
--disable-imap --disable-actions --disable-userdir \
--disable-alias
.endif
.if defined(WITH_MODULES)
_APACHE_MODULES+= ${WITH_MODULES}
.else
.for category in ${ALL_MODULES_CATEGORIES}
.if defined (WITHOUT_${category}_MODULES) || defined (WITH_CUSTOM_${category})
. if defined(WITH_${category}_MODULES})
. undef WITH_${category}_MODULES
. endif
. if defined (WITH_CUSTOM_${category})
_APACHE_MODULES+= ${WITH_CUSTOM_${category}}
. endif
.elif defined(WITH_${category}_MODULES)
_APACHE_MODULES+= ${${category}_MODULES}
.endif
.endfor
. if defined(WITH_EXTRA_MODULES)
_APACHE_MODULES+= ${WITH_EXTRA_MODULES}
. endif
.endif
.if !defined(WITH_STATIC_APACHE)
. if ${USE_APACHE:Mcommon2*} != ""
# FYI
#DYNAMIC_MODULES= so
CONFIGURE_ARGS+= --enable-so
. endif
.else
. if ${USE_APACHE:Mcommon2*} != ""
CONFIGURE_ARGS+= --disable-so
. endif
WITH_ALL_STATIC_MODULES= YES
.endif
.if defined(WITH_SUEXEC) || defined(WITH_SUEXEC_MODULES)
.if ${USE_APACHE} == common13
SUEXEC_CONFARGS= suexec
CONFIGURE_ARGS+= --enable-suexec
.elif ${USE_APACHE:Mcommon2*} != ""
SUEXEC_CONFARGS= with-suexec
.endif
# From now we're defaulting to apache 2.*
SUEXEC_DOCROOT?= ${PREFIX}/www/data
SUEXEC_USERDIR?= public_html
SUEXEC_SAFEPATH?= ${PREFIX}/bin:${LOCALBASE}/bin:/usr/bin:/bin
SUEXEC_LOGFILE?= /var/log/httpd-suexec.log
SUEXEC_UIDMIN?= 1000
SUEXEC_GIDMIN?= 1000
SUEXEC_CALLER?= ${WWWOWN}
_APACHE_MODULES+= ${SUEXEC_MODULES}
CONFIGURE_ARGS+= --${SUEXEC_CONFARGS}-caller=${SUEXEC_CALLER} \
--${SUEXEC_CONFARGS}-uidmin=${SUEXEC_UIDMIN} \
--${SUEXEC_CONFARGS}-gidmin=${SUEXEC_GIDMIN} \
--${SUEXEC_CONFARGS}-userdir="${SUEXEC_USERDIR}" \
--${SUEXEC_CONFARGS}-docroot="${SUEXEC_DOCROOT}" \
--${SUEXEC_CONFARGS}-safepath="${SUEXEC_SAFEPATH}" \
--${SUEXEC_CONFARGS}-logfile="${SUEXEC_LOGFILE}" \
--${SUEXEC_CONFARGS}-bin="${PREFIX}/sbin/suexec"
. if defined(WITH_SUEXEC_UMASK)
CONFIGURE_ARGS+= --${SUEXEC_CONFARGS}-umask=${WITH_SUEXEC_UMASK}
. endif
.endif
.if !defined(WITHOUT_MODULES)
APACHE_MODULES= ${_APACHE_MODULES}
.else
APACHE_MODULES!= \
for module in ${_APACHE_MODULES}; do \
${ECHO_CMD} ${WITHOUT_MODULES} | ${GREP} -wq $${module} 2> /dev/null || \
${ECHO_CMD} $${module}; \
done
.endif
.if defined(WITH_STATIC_MODULES)
. if ${USE_APACHE} == common13
STATIC_MODULE_CONFARG= --enable-module=$${module}
DSO_MODULE_CONFARG= --enable-module=$${module} --enable-shared=$${module}
. else
STATIC_MODULE_CONFARG= --enable-$${module}
DSO_MODULE_CONFARG= --enable-$${module}=shared
.endif
_CONFIGURE_ARGS!= \
for module in ${APACHE_MODULES} ; do \
${ECHO_CMD} ${WITH_STATIC_MODULES} | \
${GREP} -wq $${module} 2> /dev/null ; \
if [ "$${?}" = "0" ] ; then \
${ECHO_CMD} "${STATIC_MODULE_CONFARG}"; \
else \
${ECHO_CMD} "${DSO_MODULE_CONFARG}"; \
fi; done
CONFIGURE_ARGS+= ${_CONFIGURE_ARGS}
.elif defined(WITH_STATIC_APACHE) || defined(WITH_ALL_STATIC_MODULES)
WITH_STATIC_MODULES= ${APACHE_MODULES}
. if ${USE_APACHE} == common13
. for module in ${APACHE_MODULES}
CONFIGURE_ARGS+= --enable-module=${module}
. endfor
. else
CONFIGURE_ARGS+= --enable-modules="${APACHE_MODULES}"
. endif
.else
. if ${USE_APACHE} == common13
. for module in ${APACHE_MODULES}
CONFIGURE_ARGS+= --enable-module=${module} --enable-shared=${module}
. endfor
. else
CONFIGURE_ARGS+= --enable-mods-shared="${APACHE_MODULES}"
. endif
.endif
.if defined(WITH_STATIC_MODULES)
_SHARED_MODULES!= \
for module in ${APACHE_MODULES} ; do \
${ECHO_CMD} ${WITH_STATIC_MODULES} | ${GREP} -wq $${module} 2> /dev/null || \
${ECHO_CMD} $${module}; \
done
SHARED_MODULES= ${_SHARED_MODULES}
.elif !defined(WITH_ALL_STATIC_MODULES)
SHARED_MODULES= ${APACHE_MODULES}
.endif
. for module in ${SHARED_MODULES}
${module}_PLIST_SUB= ""
. endfor
.for module in ${AVAILABLE_MODULES}
PLIST_SUB+= MOD_${module:U}=${${module}_PLIST_SUB}
.endfor
####End of PORT_IS_SERVER ####
.elif defined(APR_DEPS)
IGNORE= ${_ERROR_MSG} apr support is not yet implemented
.elif defined(AP_PORT_IS_MODULE)
AP_VERSION= ${USE_APACHE:C/\.//}
APXS?= ${LOCALBASE}/sbin/apxs
HTTPD?= ${LOCALBASE}/sbin/httpd
MODULENAME?= ${PORTNAME}
SHORTMODNAME?= ${MODULENAME:S/mod_//}
SRC_FILE?= ${MODULENAME}.c
OVERRIDABLE_VARS= SRC_FILE MODULENAME SHORTMODNAME WRKSRC \
PKGNAMESUFFIX
.if exists(${HTTPD})
AP_CUR_VERSION!= ${HTTPD} -V | ${SED} -ne 's/^Server version: Apache\/\([0-9]\)\.\([0-9]*\).*/\1\2/p'
. if ${AP_CUR_VERSION} > 13
APACHE_MPM!= ${APXS} -q MPM_NAME
. endif
.elif defined(APACHE_PORT)
AP_CUR_VERSION!= ${ECHO_CMD} ${APACHE_PORT} | ${SED} -ne 's,.*/apache\([0-9]*\).*,\1,p'
.endif
.if defined(AP_CUR_VERSION)
VERSION_CHECK!= eval `${ECHO_CMD} "[ ${AP_VERSION} -eq ${AP_CUR_VERSION} ]" | ${SED} -e 's/- -eq/ -ge/ ; s/+ -eq/ -le/' ` ; ${ECHO_CMD} $${?}
. if ${VERSION_CHECK} == 1
IGNORE= ${_ERROR_MSG} apache${AP_CUR_VERSION} is installed (or APACHE_PORT is defined) and port requires ${USE_APACHE}
. endif
APACHE_VERSION= ${AP_CUR_VERSION}
.else
AP_CUR_VERSION= none
. if !defined(${APACHE_PORT})
#Fallback to smallest version...
APACHE_VERSION= ${AP_VERSION:C/\+//}
. endif
.endif
.if exists(${APXS})
APXS_PREFIX!= ${APXS} -q prefix 2> /dev/null || echo NULL
. if ${APXS_PREFIX} == NULL
IGNORE= : Your apache does not support DSO modules
. endif
. if defined(AP_GENPLIST) && ${APXS_PREFIX} != ${PREFIX}
IGNORE?= PREFIX must be egal to APXS_PREFIX.
. endif
.endif
.if ${APACHE_VERSION} == "20"
AP_BUILDEXT= la
PLIST_SUB+= APACHEMODDIR="libexec/apache2" \
APACHEINCLUDEDIR="include/apache2"
APACHE_PORT= www/apache${APACHE_VERSION}
.elif ${APACHE_VERSION} == "21"
AP_BUILDEXT= la
PLIST_SUB+= APACHEMODDIR="libexec/apache${APACHE_VERSION}" \
APACHEINCLUDEDIR="include/apache${APACHE_VERSION}"
APACHE_PORT= www/apache${APACHE_VERSION}
.else
AP_BUILDEXT= so
PLIST_SUB+= APACHEMODDIR="libexec/apache" \
APACHEINCLUDEDIR="include/apache"
APACHE_PORT?= www/apache13
.endif
.for VAR in ${OVERRIDABLE_VARS}
. if defined(AP${APACHE_VERSION}_${VAR})
${VAR} =${AP${APACHE_VERSION}_${VAR}}
. endif
.endfor
BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
RUN_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
PLIST_SUB+= AP_NAME="${SHORTMODNAME}"
PLIST_SUB+= AP_MODULE="${MODULENAME}.so"
.if defined(AP_GENPLIST)
PLIST?= ${WRKDIR}/ap-plist
.endif
.if defined(AP_INC)
AP_EXTRAS+= -I ${AP_INC}
.endif
.if defined(AP_LIB)
AP_EXTRAS+= -L ${AP_LIB}
.endif
.endif
.if defined(AP_PORT_IS_SERVER)
.elif defined(AP_PORT_IS_MODULE)
.if defined(AP_FAST_BUILD)
.if !target(ap-gen-plist)
ap-gen-plist:
.if defined(AP_GENPLIST)
. if !exists(${PLIST})
@${ECHO} "===> Generating apache plist"
@${ECHO} "@unexec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%%APACHEMODDIR%%/%%AP_MODULE%%" > ${PLIST}
@${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" >> ${PLIST}
@${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST}
@${ECHO} "@unexec echo \"Don't forget to remove all ${MODULENAME}-related directives in your httpd.conf\"">> ${PLIST}
. endif
.else
@${DO_NADA}
.endif
.endif
.if !target(do-build)
do-build: ap-gen-plist
@cd ${WRKSRC} && ${APXS} -c ${AP_EXTRAS} -o ${MODULENAME}.${AP_BUILDEXT} ${SRC_FILE}
.endif
.if !target(do-install)
do-install:
@${APXS} -i -A -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT}
.endif
.endif
.endif

View file

@ -0,0 +1,230 @@
# -*- mode: Makefile; tab-width: 4; -*-
# ex: ts=4
#
# $FreeBSD$
#
.if defined(_POSTMKINCLUDED) && !defined(Database_Post_Include)
Database_Post_Include= bsd.database.mk
Database_Include_MAINTAINER= vsevolod@FreeBSD.org
# This file contains some routines to interact with different databases, such
# as mysql, postgresql and berkley DB. For including this file define macro
# USE_[DATABASE], for example USE_MYSQL. Defining macro like USE_[DATABASE]_VER
# or WANT_[DATABSE]_VER will include this file too.
#
##
# USE_MYSQL - Add MySQL client dependency.
# If no version is given (by the maintainer via the port or
# by the user via defined variable), try to find the
# currently installed version. Fall back to default if
# necessary (MySQL4.1 = 41).
# DEFAULT_MYSQL_VER
# - MySQL default version. Can be overriden within a port.
# Default: 41.
# WANT_MYSQL_VER
# - Maintainer can set an arbitrary version of MySQL by using it.
# BROKEN_WITH_MYSQL
# - This variable can be defined if the ports doesn't support
# one or more version of MySQL.
# MYSQL_VER - Internal variable for MySQL version.
# WITH_MYSQL_VER
# - User defined variable to set MySQL version.
##
# USE_PGSQL - Add PostgreSQL client dependency.
# If no version is given (by the maintainer via the port or
# by the user via defined variable), try to find the
# currently installed version. Fall back to default if
# necessary (PostgreSQL-7.4 = 74).
# DEFAULT_PGSQL_VER
# - PostgreSQL default version. Can be overridden within a port.
# Default: 74.
# WANT_PGSQL_VER
# - Maintainer can set an arbitrary version of PostgreSQL by
# using it.
# BROKEN_WITH_PGSQL
# - This variable can be defined if the ports doesn't support
# one or more versions of PostgreSQL.
##
# USE_BDB - Add Berkley DB library dependency.
# If no version is given (by the maintainer via the port or
# by the user via defined variable), try to find the
# currently installed version. Fall back to default if
# necessary (db41+).
##
# USE_SQLITE - Add dependency on sqlite library. Valid values are:
# 3 and 2. If version is not specified directly then
# sqlite3 is used (if USE_SQLITE= yes).
.if defined(USE_MYSQL)
DEFAULT_MYSQL_VER?= 41
# MySQL client version currently supported.
MYSQL323_LIBVER= 10
MYSQL40_LIBVER= 12
MYSQL41_LIBVER= 14
MYSQL50_LIBVER= 14
# Setting/finding MySQL version we want.
.if exists(${LOCALBASE}/bin/mysql)
_MYSQL_VER!= ${LOCALBASE}/bin/mysql --version | ${SED} -e 's/.*Distrib \([0-9]\)\.\([0-9]*\).*/\1\2/'
.endif
.if defined(WANT_MYSQL_VER)
.if defined(WITH_MYSQL_VER) && ${WITH_MYSQL_VER} != ${WANT_MYSQL_VER}
BROKEN= The port wants mysql${WANT_MYSQL_VER}-client and you try to install mysql${WITH_MYSQL_VER}-client.
.endif
MYSQL_VER= ${WANT_MYSQL_VER}
.elif defined(WITH_MYSQL_VER)
MYSQL_VER= ${WITH_MYSQL_VER}
.else
.if defined(_MYSQL_VER)
MYSQL_VER= ${_MYSQL_VER}
.else
MYSQL_VER= ${DEFAULT_MYSQL_VER}
.endif
.endif # WANT_MYSQL_VER
.if defined(_MYSQL_VER)
.if ${_MYSQL_VER} != ${MYSQL_VER}
BROKEN= MySQL versions mismatch: mysql${_MYSQL_VER}-client is installed and wanted version is mysql${MYSQL_VER}-client
.endif
.endif
# And now we are checking if we can use it
.if defined(MYSQL${MYSQL_VER}_LIBVER)
.if defined(BROKEN_WITH_MYSQL)
. for VER in ${BROKEN_WITH_MYSQL}
. if (${MYSQL_VER} == "${VER}")
IGNORE= "Doesn't work with MySQL version : ${MYSQL_VER} (Doesn't support MySQL ${BROKEN_WITH_MYSQL})"
. endif
. endfor
.endif # BROKEN_WITH_MYSQL
LIB_DEPENDS+= mysqlclient.${MYSQL${MYSQL_VER}_LIBVER}:${PORTSDIR}/databases/mysql${MYSQL_VER}-client
.else
IGNORE= "Unknown MySQL version: ${MYSQL_VER}"
.endif # Check for correct libs
.endif # USE_MYSQL
.if defined(USE_PGSQL)
DEFAULT_PGSQL_VER?= 74
PGSQL73_LIBVER= 3
PGSQL74_LIBVER= 3
PGSQL80_LIBVER= 4
# Setting/finding PostgreSQL version we want.
.if exists(${LOCALBASE}/bin/pg_config)
_PGSQL_VER!= ${LOCALBASE}/bin/pg_config --version | ${SED} -n 's/PostgreSQL[^0-9]*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*/\1\2/p'
.endif
.if defined(WANT_PGSQL_VER) && defined(_PGSQL_VER) && ${WANT_PGSQL_VER} != ${_PGSQL_VER}
BROKEN= the port wants postgresql${WANT_PGSQL_VER}-client but you have postgresql${_PGSQL_VER}-client installed
.endif
.if defined(_PGSQL_VER)
PGSQL_VER= ${_PGSQL_VER}
.elif defined(WANT_PGSQL_VER)
PGSQL_VER= ${WANT_PGSQL_VER}
.else
PGSQL_VER= ${DEFAULT_PGSQL_VER}
.endif
# And now we are checking if we can use it
.if defined(PGSQL${PGSQL_VER}_LIBVER)
.if defined(BROKEN_WITH_PGSQL)
. for VER in ${BROKEN_WITH_PGSQL}
. if (${PGSQL_VER} == "${VER}")
IGNORE= "Does not work with postgresql${PGSQL_VER}-client PostgresSQL \(${BROKEN_WITH_PGSQL} not supported\)"
. endif
. endfor
.endif # BROKEN_WITH_PGSQL
LIB_DEPENDS+= pq.${PGSQL${PGSQL_VER}_LIBVER}:${PORTSDIR}/databases/postgresql${PGSQL_VER}-client
.else
IGNORE= "Unknown PostgreSQL version: ${PGSQL_VER}"
.endif # Check for correct version
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
.endif # USE_PGSQL
.if defined(USE_BDB)
_DB_PORTS= 2 3 40 41 42 43 40+ 41+ 42+ 43+
# Dependence lines for different db versions
db2_DEPENDS= db2.0:${PORTSDIR}/databases/db2
db3_DEPENDS= db3.3:${PORTSDIR}/databases/db3
db40_DEPENDS= db4.0:${PORTSDIR}/databases/db4
db41_DEPENDS= db41.1:${PORTSDIR}/databases/db41
db42_DEPENDS= db-4.2.2:${PORTSDIR}/databases/db42
db43_DEPENDS= db-4.3.0:${PORTSDIR}/databases/db43
# Detect db4 versions by finding some files
db40_FIND= ${PREFIX}/include/db4/db.h
db41_FIND= ${PREFIX}/include/db41/db.h
db42_FIND= ${PREFIX}/include/db42/db.h
db43_FIND= ${PREFIX}/include/db43/db.h
# For specifying 40+ 41+ 42+
_DB_40P= 40 41 42 43
_DB_41P= 41 42 43
_DB_42P= 42 43
_WANT_BDB_VER= ${USE_BDB}
# Assume the default bdb version as 41
.if ${USE_BDB} == "yes"
_WANT_BDB_VER= 41+
.endif
# Detect bdb version
_FOUND= no
.for bdb in ${_DB_PORTS}
.if ${_WANT_BDB_VER} == "${bdb}" && ${_FOUND} == "no"
_MATCHED_DB_VER:= ${bdb:S/+//}
. if ${_MATCHED_DB_VER} == "${bdb}"
# USE_BDB is exactly specified
LIB_DEPENDS+= ${db${bdb}_DEPENDS}
_FOUND= yes
.else
# USE_BDB is specified as VER+
. for db4 in ${_DB_${_MATCHED_DB_VER}P}
. if exists(${db${db4}_FIND}) && ${_FOUND} == "no"
LIB_DEPENDS+= ${db${db4}_DEPENDS}
_FOUND= yes
. endif
. endfor
. if ${_FOUND} == "no"
# No existing db4 version is detected in system
LIB_DEPENDS+= ${db${_MATCHED_DB_VER}_DEPENDS}
_FOUND= yes
. endif
. endif
.endif
.endfor
# USE_BDB is specified incorrectly, so mark this as BROKEN
.if ${_FOUND} == "no"
IGNORE= "Unknown bdb version: ${USE_BDB}"
.endif
.endif # USE_BDB
# Handling sqlite dependency
.if defined(USE_SQLITE)
.if ${USE_SQLITE} == "yes"
_SQLITE_VER= 3
.else
_SQLITE_VER= ${USE_SQLITE}
.endif
.if ${_SQLITE_VER} != "3" && ${_SQLITE_VER} != "2"
IGNORE= "Unknown sqlite version: ${_SQLITE_VER}"
.endif
LIB_DEPENDS+= sqlite${_SQLITE_VER}:${PORTSDIR}/databases/sqlite${_SQLITE_VER}
.endif # defined(USE_SQLITE)
.endif # defined(_POSTMKINCLUDED) && !defined(Database_Post_Include)

View file

@ -0,0 +1,582 @@
#-*- mode: Fundamental; tab-width: 4; -*-
# ex:ts=4
#
# bsd.java.mk - Support for Java-based ports.
#
# Created by: Ernst de Haan <znerd@FreeBSD.org>
#
# For FreeBSD committers:
# Please send all suggested changes to the maintainer instead of committing
# them to CVS yourself.
#
# $FreeBSD$
#
.if !defined(Java_Include)
Java_Include= bsd.java.mk
Java_Include_MAINTAINER= glewis@FreeBSD.org hq@FreeBSD.org
#-------------------------------------------------------------------------------
# Variables that each port can define:
#
# USE_JAVA Should be defined to the remaining variables to have any
# effect
#
# JAVA_VERSION List of space-separated suitable java versions for the
# port. An optional "+" allows you to specify a range of
# versions. (allowed values: 1.1[+] 1.2[+] 1.3[+] 1.4[+])
#
# JAVA_OS List of space-separated suitable JDK port operating systems
# for the port. (allowed values: native linux)
#
# JAVA_VENDOR List of space-separated suitable JDK port vendors for the
# port. (allowed values: freebsd bsdjava sun ibm blackdown)
#
# JAVA_BUILD When set, it means that the selected JDK port should be
# added to build dependencies for the port.
#
# JAVA_RUN This variable works exactly the same as JAVA_BUILD but
# regarding run dependencies.
#
# USE_JIKES Whether the port should or should not use jikes(1) to build.
# See Stage 6 header for further detail.
#
# USE_ANT Should be defined when the port uses Apache Ant. Ant is thus
# considered to be the sub-make command. When no 'do-build'
# target is defined by the port, a default one will be set
# that simply runs Ant according to MAKE_ENV, MAKE_ARGS and
# ALL_TARGET. Read the documentation in bsd.port.mk for more
# information.
#
#-------------------------------------------------------------------------------
# Variables defined for the port:
#
# JAVA_PORT The name of the JDK port. (e.g. 'java/jdk14')
#
# JAVA_PORT_VERSION The version of the JDK port. (e.g. '1.4')
#
# JAVA_PORT_OS The operating system used by the JDK port. (e.g. 'linux')
#
# JAVA_PORT_VENDOR The vendor of the JDK port. (e.g. 'sun')
#
# JAVA_PORT_OS_DESCRIPTION Description of the operating system used by the
# JDK port. (e.g. 'Linux')
#
# JAVA_PORT_VENDOR_DESCRIPTION Description of the vendor of the JDK port.
# (e.g. 'FreeBSD Foundation')
#
# JAVA_HOME Path to the installation directory of the JDK. (e.g.
# '/usr/local/jdk1.3.1')
#
# JAVAC Path to the Java compiler to use. (e.g.
# '/usr/local/jdk1.1.8/bin/javac' or '/usr/local/bin/jikes')
#
# JAR Path to the JAR tool to use. (e.g.
# '/usr/local/jdk1.2.2/bin/jar' or '/usr/local/bin/fastjar')
#
# APPLETVIEWER Path to the appletviewer utility. (e.g.
# '/usr/local/linux-jdk1.2.2/bin/appletviewer')
#
# JAVA Path to the java executable. Use this for executing Java
# programs. (e.g. '/usr/local/jdk1.3.1/bin/java')
#
# JAVADOC Path to the javadoc utility program.
#
# JAVAH Path to the javah program.
#
# JAVAP Path to the javap program.
#
# JAVA_KEYTOOL Path to the keytool utility program. This settings is
# availble only if the JDK is Java 1.2 or higher.
#
# JAVA_N2A Path to the native2ascii tool.
#
# JAVA_POLICYTOOL Path to the policytool program. This variable is available
# only if the JDK is Java 1.2 or higher.
#
# JAVA_SERIALVER Path to the serialver utility program.
#
# RMIC Path to the RMI stub/skeleton generator, rmic.
#
# RMIREGISTRY Path to the RMI registry program, rmiregistry.
#
# RMID Path to the RMI daemon program. This settings is only
# available if the JDK is Java 1.2 or higher.
#
# JAVA_CLASSES Path to the archive that contains the JDK class files. On
# JDK 1.2 or later, this is ${JAVA_HOME}/jre/lib/rt.jar.
# Earlier JDK's use ${JAVA_HOME}/lib/classes.zip.
#
# JAVASHAREDIR The base directory for all shared Java resources.
#
# JAVAJARDIR The directory where a port should install JAR files.
#
# JAVALIBDIR The directory where JAR files installed by other ports
# are located.
#
# HAVE_JIKES Defined and set to "yes" whenever the port will effectively
# use Jikes. See stage 6 header for further detail.
#
#-------------------------------------------------------------------------------
# Porter's hints
#
# To retrieve the Major version number from JAVA_PORT_VERSION (e.g. "1.3"):
# -> ${JAVA_PORT_VERSION:C/^([0-9])\.([0-9])(.*)$/\1.\2/}
#
#-------------------------------------------------------------------------------
# There are the following stages:
#
# Stage 1: Define constants
# Stage 2: bsd.java.mk 1.0 backward compatibility
# Stage 3: Determine which JDK ports are installed and which JDK ports are
# suitable
# Stage 4: <REMOVED> (merged in stage 3)
# Stage 5: Decide the exact JDK to use (or install)
# Stage 6: Add any dependencies if necessary
# Stage 7: Define all settings for the port to use
#
. if defined(USE_JAVA)
#-------------------------------------------------------------------------------
# Stage 1: Define constants
#
# System-global directories
# NB: If the value of JAVALIBDIR is altered here it must also be altered
# in java/javavmwrapper/Makefile.
JAVASHAREDIR?= ${PREFIX}/share/java
JAVAJARDIR?= ${JAVASHAREDIR}/classes
JAVALIBDIR?= ${LOCALBASE}/share/java/classes
# Add appropriate substitutions to PLIST_SUB and LIST_SUB
PLIST_SUB+= JAVASHAREDIR="${JAVASHAREDIR:S,^${PREFIX}/,,}" \
JAVAJARDIR="${JAVAJARDIR:S,^${PREFIX}/,,}"
SUB_LIST+= JAVASHAREDIR="${JAVASHAREDIR}" \
JAVAJARDIR="${JAVAJARDIR}" \
JAVALIBDIR="${JAVALIBDIR}"
. if defined(JAVA_VERSION)
SUB_LIST+= JAVA_VERSION="${JAVA_VERSION}"
. endif
. if defined(JAVA_VENDOR)
SUB_LIST+= JAVA_VENDOR="${JAVA_VENDOR}"
. endif
. if defined(JAVA_OS)
SUB_LIST+= JAVA_OS="${JAVA_OS}"
. endif
# The complete list of Java versions, os and vendors supported.
__JAVA_VERSION_LIST= 1.1 1.2 1.3 1.4 1.5
_JAVA_VERSION_LIST= ${__JAVA_VERSION_LIST} ${__JAVA_VERSION_LIST:S/$/+/}
_JAVA_OS_LIST= native linux
_JAVA_VENDOR_LIST= freebsd bsdjava sun blackdown ibm
# Set all meta-information about JDK ports:
# port location, corresponding JAVA_HOME, JDK version, OS, vendor
_JAVA_PORT_NATIVE_FREEBSD_JDK_1_3_INFO= PORT=java/diablo-jdk13 HOME=${LOCALBASE}/diablo-jdk1.3.1 \
VERSION=1.3.1 OS=native VENDOR=freebsd
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1_INFO= PORT=java/jdk11 HOME=${LOCALBASE}/jdk1.1.8 \
VERSION=1.1.8 OS=native VENDOR=bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2_INFO= PORT=java/jdk12 HOME=${LOCALBASE}/jdk1.2.2 \
VERSION=1.2.2 OS=native VENDOR=bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3_INFO= PORT=java/jdk13 HOME=${LOCALBASE}/jdk1.3.1 \
VERSION=1.3.1 OS=native VENDOR=bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4_INFO= PORT=java/jdk14 HOME=${LOCALBASE}/jdk1.4.2 \
VERSION=1.4.2 OS=native VENDOR=bsdjava
_JAVA_PORT_NATIVE_BSDJAVA_JDK_1_5_INFO= PORT=java/jdk15 HOME=${LOCALBASE}/jdk1.5.0 \
VERSION=1.5.0 OS=native VENDOR=bsdjava
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2_INFO= PORT=java/linux-blackdown-jdk12 HOME=${LOCALBASE}/linux-blackdown-jdk1.2.2 \
VERSION=1.2.2 OS=linux VENDOR=blackdown
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3_INFO= PORT=java/linux-blackdown-jdk13 HOME=${LOCALBASE}/linux-blackdown-jdk1.3.1 \
VERSION=1.3.1 OS=linux VENDOR=blackdown
_JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4_INFO= PORT=java/linux-blackdown-jdk14 HOME=${LOCALBASE}/linux-blackdown-jdk1.4.2 \
VERSION=1.4.2 OS=linux VENDOR=blackdown
_JAVA_PORT_LINUX_IBM_JDK_1_3_INFO= PORT=java/linux-ibm-jdk13 HOME=${LOCALBASE}/linux-ibm-jdk1.3.1 \
VERSION=1.3.1 OS=linux VENDOR=ibm
_JAVA_PORT_LINUX_IBM_JDK_1_4_INFO= PORT=java/linux-ibm-jdk14 HOME=${LOCALBASE}/linux-ibm-jdk1.4.2 \
VERSION=1.4.1 OS=linux VENDOR=ibm
_JAVA_PORT_LINUX_SUN_JDK_1_2_INFO= PORT=java/linux-sun-jdk12 HOME=${LOCALBASE}/linux-sun-jdk1.2.2 \
VERSION=1.2.2 OS=linux VENDOR=sun
_JAVA_PORT_LINUX_SUN_JDK_1_3_INFO= PORT=java/linux-sun-jdk13 HOME=${LOCALBASE}/linux-sun-jdk1.3.1 \
VERSION=1.3.1 OS=linux VENDOR=sun
_JAVA_PORT_LINUX_SUN_JDK_1_4_INFO= PORT=java/linux-sun-jdk14 HOME=${LOCALBASE}/linux-sun-jdk1.4.2 \
VERSION=1.4.2 OS=linux VENDOR=sun
# Verbose description for each VENDOR
_JAVA_VENDOR_freebsd= "FreeBSD Foundation"
_JAVA_VENDOR_bsdjava= "BSD Java Porting Team"
_JAVA_VENDOR_blackdown= Blackdown
_JAVA_VENDOR_ibm= IBM
_JAVA_VENDOR_sun= Sun
# Verbose description for each OS
_JAVA_OS_native= Native
_JAVA_OS_linux= Linux
# Enforce preferred Java ports according to OS
_JAVA_PREFERRED_PORTS+= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4
# List all JDK ports
__JAVA_PORTS_ALL= JAVA_PORT_NATIVE_BSDJAVA_JDK_1_5 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_4 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_3 \
JAVA_PORT_NATIVE_FREEBSD_JDK_1_3 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_2 \
JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1 \
JAVA_PORT_LINUX_SUN_JDK_1_4 \
JAVA_PORT_LINUX_SUN_JDK_1_3 \
JAVA_PORT_LINUX_SUN_JDK_1_2 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_4 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_3 \
JAVA_PORT_LINUX_BLACKDOWN_JDK_1_2 \
JAVA_PORT_LINUX_IBM_JDK_1_4 \
JAVA_PORT_LINUX_IBM_JDK_1_3
_JAVA_PORTS_ALL= ${JAVA_PREFERRED_PORTS} \
${_JAVA_PREFERRED_PORTS} \
${__JAVA_PORTS_ALL}
# Set the name of the file that indicates that a JDK is indeed installed, as a
# relative path within the JAVA_HOME directory.
_JDK_FILE=bin/javac
# Set the path to Jikes and define the Jikes dependency
_JIKES_PATH= ${LOCALBASE}/bin/jikes
DEPEND_JIKES= ${_JIKES_PATH}:${PORTSDIR}/java/jikes
#-------------------------------------------------------------------------------
# Stage 2: bsd.java.mk 1.0 backward compatibility
#
# First detect if we are using bsd.java.mk v1.0
_USE_BSD_JAVA_MK_1_0!= ${ECHO_CMD} "${_JAVA_VERSION_LIST}" \
| ${TR} " " "\n" \
| ${GREP} -q "^${USE_JAVA}$$" && ${ECHO_CMD} "yes" || ${ECHO_CMD} "no"
. if (${_USE_BSD_JAVA_MK_1_0} == "yes")
# Then affect the variables so that we may use v2.0
# USE_JAVA --> JAVA_VERSION
. if !defined(JAVA_VERSION)
JAVA_VERSION= ${USE_JAVA}
. else
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: The port is using bsd.java.mk 1.0 but sets a value for JAVA_VERSION. This may cause problems."
@${FALSE}
. endif
# NO_{BUILD|RUN}_DEPENDS_JAVA --> JAVA_{BUILD|RUN}
. if defined(NO_BUILD_DEPENDS_JAVA) && defined(NO_RUN_DEPENDS_JAVA)
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: NO_BUILD_DEPENDS_JAVA and NO_RUN_DEPENDS_JAVA cannot be set at the same time.";
@${FALSE}
. else
. if !defined(NO_BUILD_DEPENDS_JAVA) && !defined(NO_BUILD)
JAVA_BUILD= jdk
. endif
. if !defined(NO_RUN_DEPENDS_JAVA)
JAVA_RUN= jdk
. endif
. endif
# NEED_JAVAC --> JAVA_{BUILD|RUN}={jdk|jre}
. if defined(NEED_JAVAC)
. if (${NEED_JAVAC:U} == "YES")
JAVA_BUILD= jdk
. elif (${NEED_JAVAC:U} == "NO")
JAVA_BUILD= jre
. else
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: \"${NEED_JAVAC}\" is not a valid value for NEED_JAVAC. It should be YES or NO, or it should be undefined.";
@${FALSE}
. endif
. endif
. endif
#-------------------------------------------------------------------------------
# Stage 3: Determine which JDK ports are suitable and which JDK ports are
# suitable
#
# From here, the port is using bsd.java.mk v2.0
# Error checking: defined JAVA_{HOME,PORT,PORT_VERSION,PORT_VENDOR,PORT_OS}
. for variable in JAVA_HOME JAVA_PORT JAVA_PORT_VERSION JAVA_PORT_VENDOR JAVA_PORT_OS
. if defined(${variable})
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Environment error: \"${variable}\" should not be defined."
@${FALSE}
. endif
. endfor
# Error checking: JAVA_VERSION
_JAVA_VERSION_LIST_REGEXP!= ${ECHO_CMD} "${_JAVA_VERSION_LIST}" | ${SED} "s/ /\\\|/g"
_ERROR_CHECKING_JAVA_VERSION!= ${ECHO_CMD} "${JAVA_VERSION}" | ${TR} " " "\n" \
| ${GREP} -v "${_JAVA_VERSION_LIST_REGEXP}" || true
. if (${_ERROR_CHECKING_JAVA_VERSION} != "")
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: \"${JAVA_VERSION}\" is not a valid value for JAVA_VERSION. It should be one or more of: ${__JAVA_VERSION_LIST} (with an optional \"+\" suffix.)";
@${FALSE}
. endif
# Error checking: JAVA_VENDOR
_JAVA_VENDOR_LIST_REGEXP!= ${ECHO_CMD} "${_JAVA_VENDOR_LIST}" | ${SED} "s/ /\\\|/g"
_ERROR_CHECKING_JAVA_VENDOR!= ${ECHO_CMD} "${JAVA_VENDOR}" | ${TR} " " "\n" \
| ${GREP} -v "${_JAVA_VENDOR_LIST_REGEXP}" || true
. if (${_ERROR_CHECKING_JAVA_VENDOR} != "")
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: \"${JAVA_VENDOR}\" is not a valid value for JAVA_VENDOR. It should be one or more of: ${_JAVA_VENDOR_LIST}";
@${FALSE}
. endif
# Error checking: JAVA_OS
_JAVA_OS_LIST_REGEXP!= ${ECHO_CMD} "${_JAVA_OS_LIST}" | ${SED} "s/ /\\\|/g"
_ERROR_CHECKING_JAVA_OS!= ${ECHO_CMD} "${JAVA_OS}" | ${TR} " " "\n" \
| ${GREP} -v "${_JAVA_OS_LIST_REGEXP}" || true
. if (${_ERROR_CHECKING_JAVA_OS} != "")
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: \"${JAVA_OS}\" is not a valid value for JAVA_OS. It should be one or more of: ${_JAVA_OS_LIST}";
@${FALSE}
. endif
# Set default values for JAVA_BUILD and JAVA_RUN
# When nothing is set, assume JAVA_BUILD=jdk and JAVA_RUN=jre
# (unless NO_BUILD is set)
. if !defined(JAVA_EXTRACT) && !defined(JAVA_BUILD) && !defined(JAVA_RUN)
. if !defined(NO_BUILD)
JAVA_BUILD= jdk
. endif
JAVA_RUN= jre
. endif
# JDK dependency setting
. undef _JAVA_PORTS_INSTALLED
. undef _JAVA_PORTS_POSSIBLE
. if defined(JAVA_VERSION)
_JAVA_VERSION= ${JAVA_VERSION:S/1.1+/1.1 1.2 1.3 1.4 1.5/:S/1.2+/1.2 1.3 1.4 1.5/:S/1.3+/1.3 1.4 1.5/:S/1.4+/1.4 1.5/:S/1.5+/1.5/}
. else
_JAVA_VERSION= ${__JAVA_VERSION_LIST}
. endif
. if defined(JAVA_OS)
_JAVA_OS= ${JAVA_OS}
. else
_JAVA_OS= ${_JAVA_OS_LIST}
. endif
. if defined(JAVA_VENDOR)
_JAVA_VENDOR= ${JAVA_VENDOR}
. else
_JAVA_VENDOR= ${_JAVA_VENDOR_LIST}
. endif
. for A_JAVA_PORT in ${_JAVA_PORTS_ALL}
A_JAVA_PORT_INFO:= ${A_JAVA_PORT:S/^/\${_/:S/$/_INFO}/}
A_JAVA_PORT_HOME= ${A_JAVA_PORT_INFO:MHOME=*:S,HOME=,,}
A_JAVA_PORT_VERSION= ${A_JAVA_PORT_INFO:MVERSION=*:C/VERSION=([0-9])\.([0-9])(.*)/\1.\2/}
A_JAVA_PORT_OS= ${A_JAVA_PORT_INFO:MOS=*:S,OS=,,}
A_JAVA_PORT_VENDOR= ${A_JAVA_PORT_INFO:MVENDOR=*:S,VENDOR=,,}
A_JAVA_PORT_INSTALLED!= ${TEST} -x "${A_JAVA_PORT_HOME}/${_JDK_FILE}" \
&& ${ECHO_CMD} "${A_JAVA_PORT}" \
|| ${TRUE}
__JAVA_PORTS_INSTALLED!= ${ECHO_CMD} "${__JAVA_PORTS_INSTALLED} ${A_JAVA_PORT_INSTALLED}"
A_JAVA_PORT_POSSIBLE!= ${ECHO_CMD} "${_JAVA_VERSION}" | ${GREP} -q "${A_JAVA_PORT_VERSION}" \
&& ${ECHO_CMD} "${_JAVA_OS}" | ${GREP} -q "${A_JAVA_PORT_OS}" \
&& ${ECHO_CMD} "${_JAVA_VENDOR}" | ${GREP} -q "${A_JAVA_PORT_VENDOR}" \
&& ${ECHO_CMD} "${A_JAVA_PORT}" \
|| ${TRUE}
__JAVA_PORTS_POSSIBLE!= ${ECHO_CMD} "${__JAVA_PORTS_POSSIBLE} ${A_JAVA_PORT_POSSIBLE}"
. endfor
_JAVA_PORTS_INSTALLED= ${__JAVA_PORTS_INSTALLED:C/ [ ]+/ /g}
_JAVA_PORTS_POSSIBLE= ${__JAVA_PORTS_POSSIBLE:C/ [ ]+/ /g}
#-------------------------------------------------------------------------------
# Stage 5: Decide the exact JDK to use (or install)
#
# Find an installed JDK port that matches the requirements of the port
. undef _JAVA_PORTS_INSTALLED_POSSIBLE
. for A_JAVA_PORT in ${_JAVA_PORTS_POSSIBLE}
A_JAVA_PORT_INSTALLED_POSSIBLE!= ${ECHO_CMD} "${_JAVA_PORTS_INSTALLED}" | ${GREP} -q "${A_JAVA_PORT}" \
&& ${ECHO_CMD} "${A_JAVA_PORT}" || ${TRUE}
__JAVA_PORTS_INSTALLED_POSSIBLE!= ${ECHO_CMD} "${__JAVA_PORTS_INSTALLED_POSSIBLE} ${A_JAVA_PORT_INSTALLED_POSSIBLE}"
. endfor
_JAVA_PORTS_INSTALLED_POSSIBLE= ${__JAVA_PORTS_INSTALLED_POSSIBLE:C/ [ ]+/ /g}
. if ${_JAVA_PORTS_INSTALLED_POSSIBLE} != ""
_JAVA_PORT!= ${ECHO_CMD} "${_JAVA_PORTS_INSTALLED_POSSIBLE}" \
| ${AWK} '{ print $$1 }'
# If no installed JDK port fits, then pick one from the list of possible ones
. else
_JAVA_PORT!= ${ECHO_CMD} "${_JAVA_PORTS_POSSIBLE}" \
| ${AWK} '{ print $$1 }'
. endif
_JAVA_PORT_INFO:= ${_JAVA_PORT:S/^/\${_/:S/$/_INFO}/}
JAVA_PORT= ${_JAVA_PORT_INFO:MPORT=*:S,PORT=,,}
JAVA_HOME= ${_JAVA_PORT_INFO:MHOME=*:S,HOME=,,}
JAVA_PORT_VERSION= ${_JAVA_PORT_INFO:MVERSION=*:S,VERSION=,,}
JAVA_PORT_OS= ${_JAVA_PORT_INFO:MOS=*:S,OS=,,}
JAVA_PORT_VENDOR= ${_JAVA_PORT_INFO:MVENDOR=*:S,VENDOR=,,}
JAVA_PORT_VENDOR_DESCRIPTION:= ${JAVA_PORT_VENDOR:S/^/\${_JAVA_VENDOR_/:S/$/}/}
JAVA_PORT_OS_DESCRIPTION:= ${JAVA_PORT_OS:S/^/\${_JAVA_OS_/:S/$/}/}
#-------------------------------------------------------------------------------
# Stage 6: Add any dependencies if necessary
#
# Jikes support: If USE_JIKES is set to YES, then use Jikes. If USE_JIKES is
# set to NO, then don't use it. If it is set to a different value, then fail
# with an error message. Otherwise USE_JIKES is not set, in which case it is
# checked if Jikes is already installed. If it is, then it will be used,
# otherwise it will not be used.
#
# As a result, HAVE_JIKES is defined and set to "yes" when Jikes is used by the
# port according to the above policy.
. undef HAVE_JIKES
# First test if USE_JIKES has a valid value
. if defined(USE_JIKES) && !(${USE_JIKES:U} == "YES") && !(${USE_JIKES:U} == "NO")
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: \"${USE_JIKES}\" is not a valid value for USE_JIKES. It should be YES or NO, or it should be undefined.";
@${FALSE}
. endif
# Then test if jikes is needed or available: -> HAVE_JIKES=yes
. if (exists(${_JIKES_PATH}) && (!defined(USE_JIKES) || (${USE_JIKES:U} == "YES"))) \
|| (defined(USE_JIKES) && (${USE_JIKES:U} == "YES"))
HAVE_JIKES= yes
. endif
# Add jikes port to the dependencies if needed
. if !defined(NO_BUILD) && defined(HAVE_JIKES)
BUILD_DEPENDS+= ${DEPEND_JIKES}
. endif
# Ant Support: USE_ANT --> JAVA_BUILD=jdk
. if defined(USE_ANT)
JAVA_BUILD= jdk
. endif
# Add the JDK port to the dependencies
DEPEND_JAVA= ${JAVA}:${PORTSDIR}/${JAVA_PORT}
. if defined(JAVA_EXTRACT)
EXTRACT_DEPENDS+= ${DEPEND_JAVA}
. endif
. if defined(JAVA_BUILD)
. if defined(NO_BUILD)
check-makevars::
@${ECHO_CMD} "${PKGNAME}: Makefile error: JAVA_BUILD and NO_BUILD cannot be set at the same time.";
@${FALSE}
. endif
BUILD_DEPENDS+= ${DEPEND_JAVA}
. endif
. if defined(JAVA_RUN)
RUN_DEPENDS+= ${DEPEND_JAVA}
. endif
# Ant support: default do-build target
. if defined(USE_ANT)
ANT?= ${LOCALBASE}/bin/ant
MAKE_ENV+= JAVA_HOME=${JAVA_HOME}
. if defined(HAVE_JIKES)
MAKE_ARGS+= -Dbuild.compiler=jikes
. endif
BUILD_DEPENDS+= ${ANT}:${PORTSDIR}/devel/apache-ant
ALL_TARGET?=
. if !target(do-build)
do-build:
@(cd ${BUILD_WRKSRC}; \
${SETENV} ${MAKE_ENV} ${ANT} ${MAKE_ARGS} ${ALL_TARGET})
. endif
. endif
#-----------------------------------------------------------------------------
# Stage 7: Define all settings for the port to use
#
# At this stage both JAVA_HOME and JAVA_PORT are definitely given a value.
#
# Define the location of the Java compiler. If HAVE_JIKES is defined, then
# use Jikes.
# Only define JAVAC if a JDK is needed or USE_JIKES=yes
. undef JAVAC
# Then test if a JAVAC has to be set (JAVA_BUILD==jdk)
. if defined(JAVA_BUILD)
. if (${JAVA_BUILD:U} == "JDK") && !defined(JAVAC)
# Use jikes if available and not explicitly forbidden (see Stage 6)
. if defined(HAVE_JIKES)
JAVAC?= ${_JIKES_PATH} -bootclasspath ${JAVA_CLASSES}
# Otherwise use 'javac'
. else
JAVAC?= ${JAVA_HOME}/bin/javac
. endif
. endif
. endif
# Define the location of some more executables.
APPLETVIEWER?= ${JAVA_HOME}/bin/appletviewer
JAR?= ${JAVA_HOME}/bin/jar
JAVA?= ${JAVA_HOME}/bin/java
JAVADOC?= ${JAVA_HOME}/bin/javadoc
JAVAH?= ${JAVA_HOME}/bin/javah
JAVAP?= ${JAVA_HOME}/bin/javap
JAVA_N2A?= ${JAVA_HOME}/bin/native2ascii
JAVA_SERIALVER?=${JAVA_HOME}/bin/serialver
RMIC?= ${JAVA_HOME}/bin/rmic
RMIREGISTRY?= ${JAVA_HOME}/bin/rmiregistry
# Some executables only exists in JDK 1.2 and up
. if ${_JAVA_PORT} != "JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1"
JAVA_KEYTOOL?= ${JAVA_HOME}/bin/keytool
JAVA_POLICYTOOL?= ${JAVA_HOME}/bin/policytool
RMID?= ${JAVA_HOME}/bin/rmid
. endif
# Set the location of the ZIP or JAR file with all standard Java classes.
. if ${_JAVA_PORT} == "JAVA_PORT_NATIVE_BSDJAVA_JDK_1_1"
JAVA_CLASSES= ${JAVA_HOME}/lib/classes.zip
. else
JAVA_CLASSES= ${JAVA_HOME}/jre/lib/rt.jar
. endif
#-------------------------------------------------------------------------------
# Additional Java support
# Debug target
# Use it to check Java dependency while porting
java-debug:
@${ECHO_CMD} "_USE_BSD_JAVA_MK_1_0= ${_USE_BSD_JAVA_MK_1_0}"
@${ECHO_CMD}
@${ECHO_CMD} "# User specified parameters:"
@${ECHO_CMD} "JAVA_VERSION= ${JAVA_VERSION} (${_JAVA_VERSION})"
@${ECHO_CMD} "JAVA_OS= ${JAVA_OS} (${_JAVA_OS})"
@${ECHO_CMD} "JAVA_VENDOR= ${JAVA_VENDOR} (${_JAVA_VENDOR})"
@${ECHO_CMD} "JAVA_BUILD= ${JAVA_BUILD}"
@${ECHO_CMD} "JAVA_RUN= ${JAVA_RUN}"
@${ECHO_CMD} "JAVA_EXTRACT= ${JAVA_EXTRACT}"
@${ECHO_CMD}
@${ECHO_CMD} "# JDK port dependency selection process:"
@${ECHO_CMD} "_JAVA_PORTS_POSSIBLE= ${_JAVA_PORTS_POSSIBLE}"
@${ECHO_CMD} "_JAVA_PORTS_INSTALLED= ${_JAVA_PORTS_INSTALLED}"
@${ECHO_CMD} "_JAVA_PORTS_INSTALLED_POSSIBLE= ${_JAVA_PORTS_INSTALLED_POSSIBLE}"
@${ECHO_CMD} "_JAVA_PORT= ${_JAVA_PORT}"
@${ECHO_CMD} "_JAVA_PORT_INFO= ${_JAVA_PORT_INFO:S/\t/ /}"
@${ECHO_CMD}
@${ECHO_CMD} "# Selected JDK port:"
@${ECHO_CMD} "JAVA_PORT= ${JAVA_PORT}"
@${ECHO_CMD} "JAVA_HOME= ${JAVA_HOME}"
@${ECHO_CMD} "JAVA_PORT_VERSION= ${JAVA_PORT_VERSION}"
@${ECHO_CMD} "JAVA_PORT_OS= ${JAVA_PORT_OS} (${JAVA_PORT_OS_DESCRIPTION})"
@${ECHO_CMD} "JAVA_PORT_VENDOR= ${JAVA_PORT_VENDOR} (${JAVA_PORT_VENDOR_DESCRIPTION})"
@${ECHO_CMD}
@${ECHO_CMD} "# Additional variables:"
@${ECHO_CMD} "JAVAC= ${JAVAC}"
@${ECHO_CMD} "JAVA_CLASSES= ${JAVA_CLASSES}"
. endif
.endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,419 +0,0 @@
#-*- mode: makefile; tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
PORTMK_VERSION= 20050202
.if defined(_PREMKINCLUDED)
check-makefile::
@${ECHO_CMD} "${PKGNAME}: Makefile error: you cannot include bsd.port[.pre].mk twice"
@${FALSE}
.endif
_PREMKINCLUDED= yes
.if defined(MAKE_VERSION)
.if ${MAKE_VERSION} >= 5200408030 || ${MAKE_VERSION} >= 4200408030 && ${MAKE_VERSION} < 5000000000
NOPRECIOUSSOFTMAKEVARS= yes
.endif
.endif
AWK?= /usr/bin/awk
BASENAME?= /usr/bin/basename
BRANDELF?= /usr/bin/brandelf
.if exists(/usr/bin/bzip2)
BZCAT?= /usr/bin/bzcat
BZIP2_CMD?= /usr/bin/bzip2
.else
BZCAT?= ${LOCALBASE}/bin/bzcat
BZIP2_CMD?= ${LOCALBASE}/bin/bzip2
BZIP2DEPENDS= yes
.endif
CAT?= /bin/cat
CHGRP?= /usr/bin/chgrp
CHMOD?= /bin/chmod
CHOWN?= /usr/sbin/chown
CHROOT?= /usr/sbin/chroot
COMM?= /usr/bin/comm
CP?= /bin/cp
CPIO?= /usr/bin/cpio
CUT?= /usr/bin/cut
DATE?= /bin/date
DC?= /usr/bin/dc
DIALOG?= /usr/bin/dialog
DIRNAME?= /usr/bin/dirname
EGREP?= /usr/bin/egrep
EXPR?= /bin/expr
FALSE?= false # Shell builtin
FILE?= /usr/bin/file
FIND?= /usr/bin/find
FMT?= /usr/bin/fmt
GREP?= /usr/bin/grep
GUNZIP_CMD?= /usr/bin/gunzip -f
GZCAT?= /usr/bin/gzcat
GZIP?= -9
GZIP_CMD?= /usr/bin/gzip -nf ${GZIP}
HEAD?= /usr/bin/head
ID?= /usr/bin/id
IDENT?= /usr/bin/ident
LDCONFIG?= /sbin/ldconfig
LN?= /bin/ln
LS?= /bin/ls
MKDIR?= /bin/mkdir -p
MKTEMP?= /usr/bin/mktemp
MV?= /bin/mv
OBJCOPY?= /usr/bin/objcopy
OBJDUMP?= /usr/bin/objdump
PASTE?= /usr/bin/paste
PAX?= /bin/pax
PRINTF?= /usr/bin/printf
REALPATH?= /bin/realpath
RM?= /bin/rm
RMDIR?= /bin/rmdir
SED?= /usr/bin/sed
SETENV?= /usr/bin/env
SH?= /bin/sh
SORT?= /usr/bin/sort
STRIP_CMD?= /usr/bin/strip
SU_CMD?= /usr/bin/su root -c
TAIL?= /usr/bin/tail
TEST?= test # Shell builtin
TR?= /usr/bin/tr
TRUE?= true # Shell builtin
UNAME?= /usr/bin/uname
.if exists(/usr/bin/unzip)
UNZIP_CMD?= /usr/bin/unzip
.else
UNZIP_CMD?= ${LOCALBASE}/bin/unzip
ZIPDEPENDS= yes
.endif
WHICH?= /usr/bin/which
XARGS?= /usr/bin/xargs
YACC?= /usr/bin/yacc
# ECHO is defined in /usr/share/mk/sys.mk, which can either be "echo",
# or "true" if the make flag -s is given. Use ECHO_CMD where you mean
# the echo command.
ECHO_CMD?= echo # Shell builtin
# Used to print all the '===>' style prompts - override this to turn them off.
ECHO_MSG?= ${ECHO_CMD}
# Get the default maintainer
MAINTAINER?= ports@FreeBSD.org
# Get the architecture
.if !defined(ARCH)
ARCH!= ${UNAME} -p
.endif
# Kludge for pre-3.0 systems
MACHINE_ARCH?= i386
# Get the operating system type
.if !defined(OPSYS)
OPSYS!= ${UNAME} -s
.endif
# Get the operating system revision
.if !defined(OSREL)
OSREL!= ${UNAME} -r | ${SED} -e 's/[-(].*//'
.endif
# Get __FreeBSD_version
.if !defined(OSVERSION)
.if exists(/sbin/sysctl)
OSVERSION!= /sbin/sysctl -n kern.osreldate
.else
OSVERSION!= /usr/sbin/sysctl -n kern.osreldate
.endif
.endif
# Get the object format.
.if !defined(PORTOBJFORMAT)
PORTOBJFORMAT!= ${TEST} -x /usr/bin/objformat && /usr/bin/objformat || ${ECHO_CMD} aout
.endif
MASTERDIR?= ${.CURDIR}
PORTMK_CONF?= /etc/portmk.conf
.if exists(${PORTMK_CONF})
.include "${PORTMK_CONF}"
.endif
# If they exist, include Makefile.inc, then architecture/operating
# system specific Makefiles, then local Makefile.local.
.if ${MASTERDIR} != ${.CURDIR} && exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
USE_SUBMAKE= yes
.endif
.if exists(${MASTERDIR}/../Makefile.inc)
.include "${MASTERDIR}/../Makefile.inc"
USE_SUBMAKE= yes
.endif
.if exists(${MASTERDIR}/Makefile.${ARCH}-${OPSYS})
.include "${MASTERDIR}/Makefile.${ARCH}-${OPSYS}"
USE_SUBMAKE= yes
.elif exists(${MASTERDIR}/Makefile.${OPSYS})
.include "${MASTERDIR}/Makefile.${OPSYS}"
USE_SUBMAKE= yes
.elif exists(${MASTERDIR}/Makefile.${ARCH})
.include "${MASTERDIR}/Makefile.${ARCH}"
USE_SUBMAKE= yes
.endif
.if exists(${MASTERDIR}/Makefile.local)
.include "${MASTERDIR}/Makefile.local"
USE_SUBMAKE= yes
.endif
# where 'make config' records user configuration options
PORT_DBDIR?= /var/db/ports
.if defined(LATEST_LINK)
UNIQUENAME?= ${LATEST_LINK}
.else
UNIQUENAME?= ${PKGNAMEPREFIX}${PORTNAME}
.endif
OPTIONSFILE?= ${PORT_DBDIR}/${UNIQUENAME}/options
_OPTIONSFILE!= ${ECHO_CMD} "${OPTIONSFILE}"
.if defined(OPTIONS) && !defined(_OPTIONSNG_READ)
.if exists(${_OPTIONSFILE}) && !make(rmconfig)
.include "${_OPTIONSFILE}"
.endif
.if exists(${_OPTIONSFILE}.local)
.include "${_OPTIONSFILE}.local"
.endif
.endif
# check for old, crufty, makefile types, part 1:
.if !defined(PORTNAME) || !( defined(PORTVERSION) || defined (DISTVERSION) ) || defined(PKGNAME)
check-makefile::
@${ECHO_CMD} "Makefile error: you need to define PORTNAME and PORTVERSION instead of PKGNAME."
@${ECHO_CMD} "(This port is too old for your bsd.port.mk, please update it to match"
@${ECHO_CMD} " your bsd.port.mk.)"
@${FALSE}
.endif
.if defined(PORTVERSION)
.if ${PORTVERSION:M*[-_,]*}x != x
BROKEN= "PORTVERSION ${PORTVERSION} may not contain '-' '_' or ','"
.endif
DISTVERSION?= ${PORTVERSION:S/:/::/g}
.elif defined(DISTVERSION)
PORTVERSION= ${DISTVERSION:L:C/([a-z])[a-z]+/\1/g:C/([0-9])([a-z])/\1.\2/g:C/:(.)/\1/g:C/[^a-z0-9+]+/./g}
.endif
PORTREVISION?= 0
.if ${PORTREVISION} != 0
_SUF1= _${PORTREVISION}
.endif
PORTEPOCH?= 0
.if ${PORTEPOCH} != 0
_SUF2= ,${PORTEPOCH}
.endif
# check for old, crufty, makefile types, part 2. The "else" case
# should have been handled in part 1, above.
.if !defined(PKGNAME)
PKGNAME= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION:C/[-_,]/./g}${_SUF1}${_SUF2}
.endif
DISTNAME?= ${PORTNAME}-${DISTVERSIONPREFIX}${DISTVERSION:C/:(.)/\1/g}${DISTVERSIONSUFFIX}
# These need to be absolute since we don't know how deep in the ports
# tree we are and thus can't go relative. They can, of course, be overridden
# by individual Makefiles or local system make configuration.
PORTSDIR?= /usr/ports
LOCALBASE?= /usr/local
X11BASE?= /usr/X11R6
LINUXBASE?= /compat/linux
DISTDIR?= ${PORTSDIR}/distfiles
_DISTDIR?= ${DISTDIR}/${DIST_SUBDIR}
.if ${OSVERSION} >= 600000
INDEXFILE?= INDEX-6
.elif ${OSVERSION} >= 500036
INDEXFILE?= INDEX-5
.else
INDEXFILE?= INDEX
.endif
.if defined(USE_BZIP2)
EXTRACT_SUFX?= .tar.bz2
.elif defined(USE_ZIP)
EXTRACT_SUFX?= .zip
.else
EXTRACT_SUFX?= .tar.gz
.endif
PACKAGES?= ${PORTSDIR}/packages
TEMPLATES?= ${PORTSDIR}/Templates
.if (!defined(PKGDIR) && exists(${MASTERDIR}/pkg/DESCR)) || \
(!defined(MD5_FILE) && exists(${MASTERDIR}/files/md5))
check-makefile::
@${ECHO_CMD} "Makefile error: your port uses an old layout. Please update it to match this bsd.port.mk. If you have updated your ports collection via cvsup and are still getting this error, see Q12 and Q13 in the cvsup FAQ on http://www.polstra.com for further information."
@${FALSE}
.endif
PATCHDIR?= ${MASTERDIR}/files
FILESDIR?= ${MASTERDIR}/files
SCRIPTDIR?= ${MASTERDIR}/scripts
PKGDIR?= ${MASTERDIR}
.if defined(USE_IMAKE) && !defined(USE_X_PREFIX)
USE_X_PREFIX= yes
.endif
.if defined(USE_X_PREFIX) && ${USE_X_PREFIX} == "no"
.undef USE_X_PREFIX
.endif
.if defined(USE_X_PREFIX)
USE_XLIB= yes
.endif
.if defined(USE_X_PREFIX)
PREFIX?= ${X11BASE}
.elif defined(USE_LINUX_PREFIX)
PREFIX?= ${LINUXBASE}
NO_MTREE= yes
.else
PREFIX?= ${LOCALBASE}
.endif
PKGCOMPATDIR?= ${LOCALBASE}/lib/compat/pkg
.if defined(WITH_APACHE2)
APACHE_PORT?= www/apache2
.else
APACHE_PORT?= www/apache13
.endif
APXS?= ${LOCALBASE}/sbin/apxs
.if defined(USE_APACHE)
BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
RUN_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
.endif
.if ${OSVERSION} >= 500036
PERL_VERSION?= 5.8.6
PERL_VER?= 5.8.6
.else
.if ${OSVERSION} >= 500032
PERL_VERSION?= 5.6.1
PERL_VER?= 5.6.1
.else
.if ${OSVERSION} >= 500007
PERL_VERSION?= 5.6.0
PERL_VER?= 5.6.0
.else
.if ${OSVERSION} >= 300000
PERL_VERSION?= 5.00503
.else
PERL_VERSION?= 5.00502
.endif
PERL_VER?= 5.005
.endif
.endif
.endif
.if !defined(PERL_LEVEL) && defined(PERL_VERSION)
perl_major= ${PERL_VERSION:C|^([1-9]+).*|\1|}
_perl_minor= 00${PERL_VERSION:C|^([1-9]+)\.([0-9]+).*|\2|}
perl_minor= ${_perl_minor:C|^.*(...)|\1|}
.if ${perl_minor} >= 100
perl_minor= ${PERL_VERSION:C|^([1-9]+)\.([0-9][0-9][0-9]).*|\2|}
perl_patch= ${PERL_VERSION:C|^.*(..)|\1|}
.else # ${perl_minor} < 100
_perl_patch= 0${PERL_VERSION:C|^([1-9]+)\.([0-9]+)\.*|0|}
perl_patch= ${_perl_patch:C|^.*(..)|\1|}
.endif # ${perl_minor} < 100
PERL_LEVEL= ${perl_major}${perl_minor}${perl_patch}
.else
PERL_LEVEL=0
.endif # !defined(PERL_LEVEL) && defined(PERL_VERSION)
.if ${PERL_LEVEL} >= 500600
PERL_ARCH?= mach
.else
PERL_ARCH?= ${ARCH}-freebsd
.endif
.if ${PERL_LEVEL} >= 500800
PERL_PORT?= perl5.8
.else
PERL_PORT?= perl5
.endif
SITE_PERL_REL?= lib/perl5/site_perl/${PERL_VER}
SITE_PERL?= ${LOCALBASE}/${SITE_PERL_REL}
.if ${PERL_LEVEL} < 500600
PERL5= /usr/bin/perl${PERL_VERSION}
PERL= /usr/bin/perl
.else
PERL5= ${LOCALBASE}/bin/perl${PERL_VERSION}
PERL= ${LOCALBASE}/bin/perl
.endif
# XXX: (not yet): .if defined(USE_AUTOTOOLS)
# .include "${PORTSDIR}/Mk/bsd.autotools.mk"
# XXX: (not yet): .endif
.if defined(USE_OPENSSL)
.include "${PORTSDIR}/Mk/bsd.openssl.mk"
.endif
.if defined(EMACS_PORT_NAME)
.include "${PORTSDIR}/Mk/bsd.emacs.mk"
.endif
.if defined(USE_GNUSTEP)
.include "${PORTSDIR}/Mk/bsd.gnustep.mk"
.endif
.if defined(USE_PHP)
.include "${PORTSDIR}/Mk/bsd.php.mk"
.endif
.if defined(USE_PYTHON)
.include "${PORTSDIR}/Mk/bsd.python.mk"
.endif
.if defined(USE_JAVA)
.include "${PORTSDIR}/Mk/bsd.java.mk"
.endif
.if defined(USE_RUBY) || defined(USE_LIBRUBY)
.include "${PORTSDIR}/Mk/bsd.ruby.mk"
.endif
.if defined(USE_QT_VER) || defined(USE_KDELIBS_VER) || defined(USE_KDEBASE_VER)
.include "${PORTSDIR}/Mk/bsd.kde.mk"
.endif
.if defined(WANT_GNOME) || defined(USE_GNOME) || defined(USE_GTK)
.include "${PORTSDIR}/Mk/bsd.gnome.mk"
.endif
.if defined(USE_SDL) || defined(WANT_SDL)
.include "${PORTSDIR}/Mk/bsd.sdl.mk"
.endif
.if ${OSVERSION} >= 502123
X_WINDOW_SYSTEM ?= xorg
.elif (${OSVERSION} >= 450005 && !defined(XFREE86_VERSION)) || \
(defined(XFREE86_VERSION) && ${XFREE86_VERSION} == 4)
X_WINDOW_SYSTEM ?= xfree86-4
.else
X_WINDOW_SYSTEM ?= xfree86-3
.endif
# Location of mounted CDROM(s) to search for files
CD_MOUNTPTS?= /cdrom ${CD_MOUNTPT}
WANT_OPENLDAP_VER?= 22
# Owner and group of the WWW user
WWWOWN?= www
WWWGRP?= www

View file

@ -1,3 +1,434 @@
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
# $FreeBSD$
#
# The include file <bsd.port.subdir.mk> contains the default targets
# for building ports subdirectories.
#
#
# +++ variables +++
#
# STRIP The flag passed to the install program to cause the binary
# to be stripped. This is to be used when building your
# own install script so that the entire system can be made
# stripped/not-stripped using a single knob. [-s]
#
# ECHO_MSG Used to print all the '===>' style prompts - override this
# to turn them off [echo].
#
# OPSYS Get the operating system type [`uname -s`]
#
# SUBDIR A list of subdirectories that should be built as well.
# Each of the targets will execute the same target in the
# subdirectories.
#
#
# +++ targets +++
#
# README.html:
# Creating README.html for package.
#
# afterinstall, all, beforeinstall, build, checksum, clean,
# clean-for-cdrom, clean-restricted,
# clean-for-cdrom-list, clean-restricted-list,
# configure, deinstall,
# depend, depends, describe, extract, fetch, fetch-list, ignorelist,
# install, maintainer, makesum, package, readmes, realinstall, reinstall,
# tags
#
# search:
# Search for ports using either 'make search key=<keyword>'
# or 'make search name=<keyword>'.
.include "${PORTSDIR}/Mk/bsd.port.subdir.mk"
.MAIN: all
.if !defined(DEBUG_FLAGS)
STRIP?= -s
.endif
.if !defined(NOPRECIOUSMAKEVARS)
.if !defined(ARCH)
ARCH!= /usr/bin/uname -p
.endif
.if !defined(OSREL)
OSREL!= /usr/bin/uname -r | sed -e 's/[-(].*//'
.endif
.if !defined(OSVERSION)
.if exists(/sbin/sysctl)
OSVERSION!= /sbin/sysctl -n kern.osreldate
.else
OSVERSION!= /usr/sbin/sysctl -n kern.osreldate
.endif
.endif
.if !defined(PORTOBJFORMAT)
PORTOBJFORMAT!= test -x /usr/bin/objformat && /usr/bin/objformat || echo aout
.endif
.endif
ID?= /usr/bin/id
UID!= ${ID} -u
LOCALBASE?= ${DESTDIR}/usr/local
.if exists(${LOCALBASE}/sbin/pkg_info)
PKG_INFO?= ${LOCALBASE}/sbin/pkg_info
.else
PKG_INFO?= /usr/sbin/pkg_info
.endif
SED?= /usr/bin/sed
PKGINSTALLVER!= ${PKG_INFO} -P 2>/dev/null | ${SED} -e 's/.*: //'
.if !defined(OPSYS)
OPSYS!= /usr/bin/uname -s
.endif
ECHO_MSG?= echo
# local customization of the ports tree
.if exists(${.CURDIR}/Makefile.local)
.include "${.CURDIR}/Makefile.local"
.endif
TARGETS+= all
TARGETS+= build
TARGETS+= checksum
TARGETS+= clean
TARGETS+= clean-for-cdrom
TARGETS+= clean-for-cdrom-list
TARGETS+= clean-restricted
TARGETS+= clean-restricted-list
TARGETS+= configure
TARGETS+= deinstall
TARGETS+= depend
TARGETS+= depends
TARGETS+= distclean
TARGETS+= extract
TARGETS+= fetch
TARGETS+= fetch-list
TARGETS+= ignorelist
TARGETS+= makesum
TARGETS+= maintainer
TARGETS+= package
TARGETS+= package-recursive
TARGETS+= realinstall
TARGETS+= reinstall
TARGETS+= tags
.for __target in ${TARGETS}
.if !target(${__target})
.if defined(SUBDIR) && !empty(SUBDIR)
${__target}: ${SUBDIR:S/^/_/:S/$/.${__target}/}
.else
${__target}:
.endif
.endif
.endfor
.if defined(SUBDIR) && !empty(SUBDIR)
.for __target in ${TARGETS} checksubdirs describe readmes
${SUBDIR:S/^/_/:S/$/.${__target}/}: _SUBDIRUSE
.endfor
_SUBDIRUSE: .USE
@OK=""; sub=${.TARGET:S/^_//:R}; \
for dud in $$DUDS; do \
if [ $${dud} = $$sub ]; then \
OK="false"; \
${ECHO_MSG} "===> ${DIRPRFX}$$sub skipped"; \
fi; \
done; \
if test -d ${.CURDIR}/$${sub}.${MACHINE_ARCH}; then \
edir=$${sub}.${MACHINE_ARCH}; \
elif test -d ${.CURDIR}/$${sub}; then \
edir=$${sub}; \
else \
OK="false"; \
${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
fi; \
if [ "$$OK" = "" ]; then \
${ECHO_MSG} "===> ${DIRPRFX}$${edir}"; \
cd ${.CURDIR}/$${edir}; \
${MAKE} -B ${.TARGET:E:realinstall=install} \
DIRPRFX=${DIRPRFX}$$edir/; \
fi
.for _subdir in ${SUBDIR:S/^/_/}
${_subdir}:: ${_subdir:S/$/.all/}
.endfor
.endif
.if !target(install)
.if !target(beforeinstall)
beforeinstall:
.endif
.if !target(afterinstall)
afterinstall:
.endif
install: afterinstall
afterinstall: realinstall
realinstall: beforeinstall ${SUBDIR:S/^/_/:S/$/.realinstall/}
.endif
IGNOREDIR= CVS Mk Templates Tools distfiles packages pkg
.if !target(checksubdirs)
.if defined(PORTSTOP)
checksubdirs: checksubdir ${SUBDIR:S/^/_/:S/$/.checksubdirs/}
.else
checksubdirs: checksubdir
.endif
.endif
.if !target(checksubdir)
checksubdir:
@for d in *; do \
if [ -d "$$d" ]; then \
found=0; \
for s in ${SUBDIR} ${IGNOREDIR}; do \
if [ "x$$s" = "x$$d" ]; then \
found=1; \
break; \
fi; \
done; \
if [ $$found = 0 ]; then \
${ECHO} "Warning: directory $$d not in SUBDIR"; \
fi; \
fi; \
done
@for s in ${SUBDIR}; do \
if ! [ -d ${.CURDIR}/$$s ]; then \
${ECHO} "Warning: directory $$s in SUBDIR does not exist"; \
fi \
done
.endif
.if !target(describe)
.if defined(PORTSTOP)
# This is a bit convoluted to deal with the fact that make will overlap I/O from child make processes
# if they write more than 2k: this will corrupt the INDEX file. make -P does not do this, but it adds
# extraneous output and redirects stderr, so we lose error reporting from child makes. Instead we have
# to roll our own implementation of make -P and make sure that each child make writes to their own file,
# which we will combine at the end. This gives substantial performance benefits over doing a make -j1
.if defined(BUILDING_INDEX)
describe: ${SUBDIR:S/^/describe./}
.for i in ${SUBDIR}
describe.$i:
@cd ${.CURDIR}; ${MAKE} -B ${i:S/^/_/:S/$/.describe/} > ${INDEX_TMPDIR}/${INDEXFILE}.desc.${i}
.endfor
.else
describe: ${SUBDIR:S/^/_/:S/$/.describe/}
.endif
.else
describe:
@for sub in ${SUBDIR}; do \
if test -d ${.CURDIR}/$${sub}; then \
${ECHO_MSG} "===> ${DIRPRFX}$${sub}"; \
cd ${.CURDIR}/$${sub}; \
${MAKE} -B describe || \
(echo "===> ${DIRPRFX}$${sub} failed" >&2; \
exit 1) ;\
else \
${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
fi; \
done
.endif
.endif
.if !target(readmes)
.if defined(PORTSTOP)
readmes: readme ${SUBDIR:S/^/_/:S/$/.readmes/}
@${ECHO_MSG} "===> Creating README.html for all ports"
@perl ${PORTSDIR}/Tools/make_readmes < ${PORTSDIR}/${INDEXFILE}
.else
readmes: readme
.endif
.endif
.if !target(readme)
readme:
@rm -f README.html
@make README.html
.endif
.if (${OPSYS} == "NetBSD")
PORTSDIR ?= /usr/opt
.else
PORTSDIR ?= /usr/ports
.endif
TEMPLATES ?= ${PORTSDIR}/Templates
.if defined(PORTSTOP)
README= ${TEMPLATES}/README.top
.else
README= ${TEMPLATES}/README.category
.endif
COMMENTFILE?= ${.CURDIR}/pkg/COMMENT
DESCR?= ${.CURDIR}/pkg/DESCR
.if ${OSVERSION} >= 600000
INDEXFILE?= INDEX-6
.elif ${OSVERSION} >= 500036
INDEXFILE?= INDEX-5
.else
INDEXFILE?= INDEX
.endif
HTMLIFY= sed -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
package-name:
@echo ${.CURDIR} | sed -e 's^.*/^^'
README.html:
@echo "===> Creating README.html"
@> $@.tmp
.for entry in ${SUBDIR}
.if exists(${entry})
.if defined(PORTSTOP)
@echo -n '<a href="'${entry}/README.html'">'"`echo ${entry} | ${HTMLIFY}`"'</a>: ' >> $@.tmp
.else
@echo -n '<a href="'${entry}/README.html'">'"`cd ${entry}; make package-name | ${HTMLIFY}`</a>: " >> $@.tmp
.endif
@echo `cd ${entry}; make -V COMMENT` | ${HTMLIFY} >> $@.tmp
.endif
.endfor
@sort -t '>' +1 -2 $@.tmp > $@.tmp2
.if exists(${DESCR})
@${HTMLIFY} ${DESCR} > $@.tmp3
.else
@> $@.tmp3
.endif
.if defined(COMMENT)
@echo "${COMMENT}" | ${HTMLIFY} > $@.tmp4
.else
.if exists(${COMMENTFILE})
@${HTMLIFY} ${COMMENTFILE} > $@.tmp4
.else
@> $@.tmp4
.endif
.endif
@cat ${README} | \
sed -e 's/%%CATEGORY%%/'"`basename ${.CURDIR}`"'/g' \
-e '/%%COMMENT%%/r$@.tmp4' \
-e '/%%COMMENT%%/d' \
-e '/%%DESCR%%/r$@.tmp3' \
-e '/%%DESCR%%/d' \
-e '/%%SUBDIR%%/r$@.tmp2' \
-e '/%%SUBDIR%%/d' \
> $@
@rm -f $@.tmp $@.tmp2 $@.tmp3 $@.tmp4
.if !defined(NOPRECIOUSMAKEVARS)
.MAKEFLAGS: \
ARCH="${ARCH:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
OPSYS="${OPSYS:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
OSREL="${OSREL:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
OSVERSION="${OSVERSION:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
PORTOBJFORMAT="${PORTOBJFORMAT:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
UID="${UID:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
PKGINSTALLVER="${PKGINSTALLVER:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}"
.endif
PORTSEARCH_DISPLAY_FIELDS?=name,path,info,maint,index,bdeps,rdeps,www
PORTSEARCH_KEYLIM?=0
PORTSEARCH_XKEYLIM?=0
PORTSEARCH_IGNORECASE?=1
search: ${PORTSDIR}/${INDEXFILE}
@here=${.CURDIR}; \
cd ${PORTSDIR}; \
if [ -z "$$key" -a -z "$$xkey" -a \
-z "$$name" -a -z "$$xname" -a \
-z "$$path" -a -z "$$xpath" -a \
-z "$$info" -a -z "$$xinfo" -a \
-z "$$maint" -a -z "$$xmaint" -a \
-z "$$cat" -a -z "$$xcat" -a \
-z "$$bdeps" -a -z "$$xbdeps" -a \
-z "$$rdeps" -a -z "$$xrdeps" -a \
-z "$$www" -a -z "$$xwww" ]; \
then \
echo "The search target requires a keyword parameter or name parameter,"; \
echo "e.g.: \"make search key=somekeyword\""; \
echo "or \"make search name=somekeyword\""; \
exit; \
fi; \
awk -F\| -v there="$$here/" -v top="$$(pwd -P)" \
-v key="$$key" -v xkey="$$xkey" \
-v name="$$name" -v xname="$$xname" \
-v path="$$path" -v xpath="$$xpath" \
-v info="$$info" -v xinfo="$$xinfo" \
-v maint="$$maint" -v xmaint="$$xmaint" \
-v cat="$$cat" -v xcat="$$xcat" \
-v bdeps="$$bdeps" -v xbdeps="$$xbdeps" \
-v rdeps="$$rdeps" -v xrdeps="$$xrdeps" \
-v www="$$www" -v xwww="$$xwww" \
-v icase="$${icase:-${PORTSEARCH_IGNORECASE}}" \
-v keylim="$${keylim:-${PORTSEARCH_KEYLIM}}" \
-v xkeylim="$${xkeylim:-${PORTSEARCH_XKEYLIM}}" \
-v display="$${display:-${PORTSEARCH_DISPLAY_FIELDS}}" \
'BEGIN { \
gsub(/\+/,"\\+",name); \
if (substr(there, 1, length(top)) == top) \
there = "${PORTSDIR}" substr(there, 1 + length(top)); \
therelen = length(there); \
keylen = length(key); keylim = keylim && keylen; \
if (!keylim && keylen) \
parms[0] = (icase ? tolower(key) : key); \
xkeylen = length(xkey); xkeylim = xkeylim && xkeylen; \
if (!xkeylim && xkeylen) \
xparms[0] = (icase ? tolower(xkey) : xkey); \
if (icase) { \
if (length(name)) parms[1] = tolower(name); if (length(xname)) xparms[1] = tolower(xname); \
if (length(path)) parms[2] = tolower(path); if (length(xpath)) xparms[2] = tolower(xpath); \
if (length(info)) parms[4] = tolower(info); if (length(xinfo)) xparms[4] = tolower(xinfo); \
if (length(maint)) parms[6] = tolower(maint); if (length(xmaint)) xparms[6] = tolower(xmaint); \
if (length(cat)) parms[7] = tolower(cat); if (length(xcat)) xparms[7] = tolower(xcat); \
if (length(bdeps)) parms[8] = tolower(bdeps); if (length(xbdeps)) xparms[8] = tolower(xbdeps); \
if (length(rdeps)) parms[9] = tolower(rdeps); if (length(xrdeps)) xparms[9] = tolower(xrdeps); \
if (length(www)) parms[10] = tolower(www); if (length(xwww)) xparms[10] = tolower(xwww); \
} else { \
if (length(name)) parms[1] = name; if (length(xname)) xparms[1] = xname; \
if (length(path)) parms[2] = path; if (length(xpath)) xparms[2] = xpath; \
if (length(info)) parms[4] = info; if (length(xinfo)) xparms[4] = xinfo; \
if (length(maint)) parms[6] = maint; if (length(xmaint)) xparms[6] = xmaint; \
if (length(cat)) parms[7] = cat; if (length(xcat)) xparms[7] = xcat; \
if (length(bdeps)) parms[8] = bdeps; if (length(xbdeps)) xparms[8] = xbdeps; \
if (length(rdeps)) parms[9] = rdeps; if (length(xrdeps)) xparms[9] = xrdeps; \
if (length(www)) parms[10] = www; if (length(xwww)) xparms[10] = xwww; \
} \
fields["name"] = 1; names[1] = "Port"; \
fields["path"] = 2; names[2] = "Path"; \
fields["info"] = 4; names[4] = "Info"; \
fields["maint"] = 6; names[6] = "Maint"; \
fields["cat"] = 7; names[7] = "Index"; \
fields["bdeps"] = 8; names[8] = "B-deps"; \
fields["rdeps"] = 9; names[9] = "R-deps"; \
fields["www"] = 10; names[10] = "WWW"; \
split(display, d, /,[ \t]*/); \
for (i in d) { \
disp[fields[d[i]]] = 1; \
} \
} \
{ \
if (substr($$2, 1, therelen) != there) \
next; \
for (i in parms) \
if ((icase ? tolower($$i) : $$i) !~ parms[i]) \
next; \
for (i in xparms) \
if ((icase ? tolower($$i) : $$i) ~ xparms[i]) \
next; \
found = 0; \
for (i = 1; i < 11; i++) \
if (i in disp) { \
if (xkeylim && (icase ? tolower($$i) : $$i) ~ xkey) \
next; \
if (!found && keylim && (icase ? tolower($$i) : $$i) ~ key) \
found = 1; \
} \
if (keylim && !found) \
next; \
for (i = 1; i < 11; i++) \
if (i in disp) \
printf("%s:\t%s\n", names[i], $$i); \
print(""); \
}' ${PORTSDIR}/${INDEXFILE}

View file

@ -0,0 +1,145 @@
# -*- mode: Makefile; tab-width: 4; -*-
# ex: ts=4
#
# $FreeBSD$
#
.if !defined(_POSTMKINCLUDED) && !defined(Tcl_Pre_Include)
Tcl_Pre_Include= bsd.tcl.mk
Tcl_Include_MAINTAINER= vsevolod@FreeBSD.org
# USE_TCL: Depend on tcl to run. In case of incompatible APIs of different
# TCL versions the version can be specified directly. If version
# is not specified (USE_TCL=yes) then the latest version is
# used (8.4 currently).
# Available values are: 84, 83, 82, 81 and 80.
#
# USE_TK: Depend on tk to run. In case of incompatible APIs of different
# TK versions the version can be specified directly. If version
# is not specified (USE_TK=yes) then the latest version is
# used (8.4 currently).
# Available values are: 84, 83, 82, 81 and 80.
##
# TCL_LIBDIR: Path where tcl libraries can be found
#
# TCL_INCLUDEDIR: Path where tcl C headers can be found
##
# TK_LIBDIR: Path where tk libraries can be found
#
# TK_INCLUDEDIR: Path where tk C headers can be found
##
# TCLSH: Path to tclsh executable respecting tcl version
#
# WISH: Path to wish executable respecting tk version
##
# PATCH_TCL_SCRIPTS: List of tcl scripts that need to be patched to replace tclsh
# calls to tclsh${TK_VER} calls. Note that this implies USE_REINPLACE
# as REINPLACE_CMD is used for patching. Also note that post-patch
# target is used.
#
# PATCH_TK_SCRIPTS: List of tcl scripts that need to be patched to replace wish
# calls to wish${TK_VER} calls. Note that this implies USE_REINPLACE
# as REINPLACE_CMD is used for patching. Also note that post-patch
# target is used.
.if defined(USE_TCL) || defined(USE_TCL_BUILD)
_TCL_VERSIONS= 84 83 82 81 80
.if defined(USE_TCL_BUILD)
USE_TCL= ${USE_TCL_BUILD}
_BUILD= yes
.endif
.if ${USE_TCL} == "yes"
USE_TCL= 84
.endif
TCL_VER:= ${USE_TCL:S/8/8./}
# Special case
.if ${USE_TCL} == "81"
USE_TCL= tcl81-thread
.endif
_FOUND= no
.for ver in ${_TCL_VERSIONS}
. if ${USE_TCL} == ${ver}
_FOUND= yes
. if defined(_BUILD)
BUILD_DEPENDS+= tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${USE_TCL}
. else
RUN_DEPENDS+= tclsh${TCL_VER}:${PORTSDIR}/lang/tcl${USE_TCL}
. endif
TCL_INCLUDEDIR= ${LOCALBASE}/include/tcl${TCL_VER}
TCL_LIBDIR= ${LOCALBASE}/lib/tcl${TCL_VER}
TCLSH= ${LOCALBASE}/bin/tclsh${TCL_VER}
. endif
.endfor
.if ${_FOUND} == "no"
IGNORE= "Unknown TCL version specified: ${USE_TCL}"
.endif
.endif # defined(USE_TCL)
.if defined(USE_TK)
_TK_VERSIONS= 84 83 82 81 80
.if ${USE_TK} == "yes"
USE_TK= 84
.endif
TK_VER:= ${USE_TK:S/8/8./}
.if defined(USE_TCL) && ${TCL_VER} != ${TK_VER}
IGNORE= "TCL and TK versions must be equal (${TCL_VER} vs ${TK_VER})"
.endif
_FOUND= no
.for ver in ${_TK_VERSIONS}
. if ${USE_TK} == ${ver}
_FOUND= yes
RUN_DEPENDS+= wish${TK_VER}:${PORTSDIR}/x11-toolkits/tk${USE_TK}
TCL_INCLUDEDIR= ${LOCALBASE}/include/tcl${TK_VER}
TCL_LIBDIR= ${LOCALBASE}/lib/tcl${TK_VER}
TK_INCLUDEDIR= ${LOCALBASE}/include/tk${TK_VER}
TK_LIBDIR= ${LOCALBASE}/lib/tk${TK_VER}
TCLSH= ${LOCALBASE}/bin/tclsh${TK_VER}
WISH= ${LOCALBASE}/bin/wish${TK_VER}
. endif
.endfor
.if ${_FOUND} == "no"
IGNORE= "Unknown TK version specified: ${USE_TK}"
.endif
.endif # defined(USE_TK)
.if defined(PATCH_TCL_SCRIPTS) || defined (PATCH_TK_SCRIPTS)
USE_REINPLACE= yes
.endif
.endif # !defined(_POSTMKINCLUDED) && !defined(Tcl_Pre_Include)
.if defined(_POSTMKINCLUDED) && !defined(Tcl_Post_Include)
Tcl_Post_Include= bsd.tcl.mk
.if defined(PATCH_TCL_SCRIPTS) || defined (PATCH_TK_SCRIPTS)
.if !target(post-patch)
post-patch:
.if defined(PATCH_TCL_SCRIPTS) && defined(TCLSH)
. for tcl_script in ${PATCH_TCL_SCRIPTS}
@${REINPLACE_CMD} -e 's,tclsh,${TCLSH},' ${WRKSRC}/${tcl_script}
. endfor
.endif
.if defined(PATCH_TK_SCRIPTS) && defined(WISH)
. for tk_script in ${PATCH_TK_SCRIPTS}
@${REINPLACE_CMD} -e 's,wish,${WISH},' ${WRKSRC}/${tk_script}
. endfor
.endif
.endif # !target(post-patch)
.endif # defined(PATCH_TCL_SCRIPTS) || defined (PATCH_TK_SCRIPTS)
.endif # defined(_POSTMKINCLUDED) && !defined(Tcl_Post_Include)

File diff suppressed because it is too large Load diff

View file

@ -1,373 +0,0 @@
#!/usr/bin/perl -w
#
# Copyright (c) 2004 Oliver Eikemeier. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
#
# MAINTAINER= eik@FreeBSD.org
#
require 5.005;
use strict;
use Getopt::Std;
my $pkgname;
my %description;
my %values;
my @order;
my @section;
my %haswithout;
my %hasoverride;
my %default;
my %value;
my $isoverride;
my $isedit;
sub parsemaster {
my $currdesc;
my ($master) = @_;
-r $master
or return 1;
open MASTER, "<$master"
or die "Can't read $master: $!\n";
push @section, "Configurable options for $pkgname";
push @order, $#section;
$description{0} = [];
while(<MASTER>) {
chomp;
last if /^##/;
next if /^#?\s*$/;
if (/^#!\s*(.*)$/) {
if ($1 =~ /MAIN/i) {
$currdesc = \@{$description{0}};
}
else {
push @section, $1;
$currdesc = \@{$description{$#section}};
push @order, $#section;
}
}
elsif(/^#WITH(OUT)?_([A-Z][A-Z0-9_]*)(?:=\s*(.*))?$/) {
my ($without, $name, $val) = ($1, $2, $3);
if (defined $values{$name}) {
print STDERR ">> $pkgname: Duplicate parameter $name at $master line $.: $_.\n";
next;
}
if (defined $val) {
my @v;
foreach my $r (split /,\s*/, $val) {
$r =~ s/\s+$//;
if (length $r > 0) {
push @v, $r;
$haswithout{$name} = 1
if $r =~ /^(?:no|none|off|false)$/i;
}
}
if ($#v == -1 || $#v == 0 && $v[0] =~ /^auto$/i) {
push @v, qw(yes no);
$haswithout{$name} = 1;
}
$values{$name} = \@v;
$default{$name} = defined $without && $haswithout{$name} ? 'no' : $values{$name}->[0];
}
else {
@{$values{$name}} = qw(yes no);
$haswithout{$name} = 1;
$default{$name} = defined $without ? 'no' : 'yes';
}
$currdesc = \@{$description{$name}};
push @order, $name;
}
elsif (/^# (.*)$/) {
push @{$currdesc}, $1
if defined $currdesc;
}
elsif (/^##$/) {
last;
}
else {
print STDERR ">> $pkgname: Parse error at $master line $.: $_.\n"
}
}
close MASTER;
}
sub parseoverride {
my $currdesc;
my ($override) = @_;
-r $override
or return 1;
open OVERRIDE, "<$override"
or die "Can't read $override: $!\n";
while(<OVERRIDE>) {
chomp;
last if /^##/;
next if /^#?\s*$/;
next if /^#\s*\$FreeBSD/;
if (/^#!/) {
undef $currdesc;
}
elsif(/^#WITH(OUT)?_([A-Z][A-Z0-9_]*)(?:=\s*(.*))?$/) {
my ($without, $name, $val) = ($1, $2, $3);
if (!defined $values{$name}) {
print STDERR ">> $pkgname: Override parameter $name not in master file.\n";
next;
}
if (defined $val) {
my @v;
foreach my $r (split /,\s*/, $val) {
$r =~ s/\s+$//;
if (length $r > 0) {
push @v, $r;
$haswithout{$name} = 1
if $r =~ /^(?:no|none|off|false)$/i;
}
}
if ($#v == -1 || $#v == 0 && $v[0] =~ /^auto$/i) {
push @v, qw(yes no);
$haswithout{$name} = 1;
}
$values{$name} = \@v;
$default{$name} = defined $without && $haswithout{$name} ? 'no' : $values{$name}->[0];
}
else {
@{$values{$name}} = qw(yes no);
$haswithout{$name} = 1;
$default{$name} = defined $without ? 'no' : 'yes';
}
delete $description{$name};
$currdesc = \@{$description{$name}};
$hasoverride{$name} = 1;
}
elsif (/^# (.*)$/) {
push @{$currdesc}, $1
if defined $currdesc;
}
elsif (/^##$/) {
last;
}
else {
print STDERR ">> $pkgname: Parse error at $override line $.: $_.\n"
}
}
close OVERRIDE;
$isoverride = 1;
}
sub parseoptions {
my ($options) = @_;
-r $options
or return 1;
open OPTIONS, "<$options"
or die "Can't open $options: $!\n";
while (<OPTIONS>) {
chomp;
next if /^(:?#|\s*$)/;
next if /^_OPTIONS/;
next if /^\./;
if (/^WITH(OUT)?_([A-Z][A-Z0-9_]*)\??=(.*)$/) {
my ($without, $name, $val) = ($1, $2, $3);
next if !defined $values{$name};
next if defined $value{$name};
if (defined $without) {
$value{$name} = 'no';
}
else {
$value{$name} = $val;
}
}
else {
print STDERR ">> $pkgname: Parse error at $options line $.: $_\n";
}
}
}
sub parseeditoptions {
my ($options) = @_;
-r $options
or return 1;
open OPTIONS, "<$options"
or die "Can't open $options: $!\n";
while (<OPTIONS>) {
chomp;
s/\s*#.*$//;
next if /^$/;
if (/^([A-Z][A-Z0-9_]*)\s*=\s*(.*)$/) {
my ($name, $val) = ($1, $2);
next if !defined $values{$name};
next if $#{$values{$name}} == 0 && $values{$name}->[0] =~ /^ignore$/i;
next if $isoverride && $#{$values{$name}} == 0;
my $candidate;
foreach my $c (@{$values{$name}}) {
if ($c eq '*' || $c eq $val) {
$candidate = $val;
last;
}
elsif (lc $c eq lc $val) {
$candidate = $c;
}
elsif ($c eq 'yes' && $val =~ /^(?:y|yes|on|t|true)$/i) {
$candidate = $c;
}
elsif ($c eq 'no' && $val =~ /^(?:n|no|off|f|false)$/i) {
$candidate = $c;
}
}
$value{$name} = $candidate
if defined $candidate;
}
else {
print STDERR ">> $pkgname: Parse error at $options line $.: $_\n";
}
}
$isedit = 1;
}
sub print_editoptions {
foreach my $name (@order) {
if ($name =~ /^\d/) {
my $headline;
foreach (1..length $section[$name]) {
$headline .= "#";
}
print "##$headline##\n";
print "# $section[$name] #\n";
print "##$headline##\n";
print @{$description{$name}} ? "#\n" : "\n";
}
else {
my $val = $default{$name};
next if $#{$values{$name}} == 0 && $values{$name}->[0] =~ /^ignore$/i;
if (defined $value{$name} && !($isoverride && $#{$values{$name}} == 0)) {
$val = $value{$name};
}
print "$name=", $val,
" # valid values: ", join(", ", @{$values{$name}}), "\n";
}
if (@{$description{$name}}) {
foreach (@{$description{$name}}) {
if ($_ eq '.') {
print "#\n";
}
elsif ($_ =~ /^#/) {
print "#$_\n";
}
else {
print "# $_\n";
}
}
print "\n";
}
}
}
sub print_dialogoptions {
foreach my $name (@order) {
next if $name =~ /^\d/;
next if !$isedit && $isoverride && !$hasoverride{$name};
next if !$isedit && $#{$values{$name}} == 0 && $values{$name}->[0] =~ /^ignore$/i;
my $val = defined $value{$name} ? $value{$name} : $default{$name};
next if $val ne 'yes' && $val ne 'no';
$val = $val eq 'yes' ? 'On' : 'Off';
my $desc = join ' ', @{$description{$name}};
$desc = "$name support"
if !$desc;
$desc =~ s/\. .*//;
$desc = substr($desc, 0, 38) . '...'
if length $desc > 41;
$desc =~ s/["\$]/\\&/g;
print ' ', $name, ' "', $desc, '" ', $val;
}
print "\n";
}
sub print_options {
print "_OPTIONSNG_READ?=$pkgname\n";
foreach my $name (@order) {
next if $name =~ /^\d/;
next if !$isedit && $isoverride && !$hasoverride{$name};
next if !$isedit && $#{$values{$name}} == 0 && $values{$name}->[0] =~ /^ignore$/i;
my $val = defined $value{$name} ? $value{$name} : $default{$name};
if ($haswithout{$name}) {
if ($val =~ /^(no|none|off|false)$/i) {
print ".undef WITH_$name\n"
if (!$isedit && $isoverride && $#{$values{$name}} == 0);
print ".ifndef WITH_$name\n";
print "WITHOUT_$name?=yes\n";
print ".endif\n";
}
else {
print ".undef WITHOUT_$name\n"
if (!$isedit && $isoverride && $#{$values{$name}} == 0);
print ".ifndef WITHOUT_$name\n";
print "WITH_$name?=$val\n";
print ".endif\n";
}
}
else {
print "WITH_$name?=$val\n";
}
}
}
my %opts;
getopts('p:M:O:g:t:edo', \%opts);
$pkgname = defined $opts{p} ? $opts{p} : "anonyous";
parsemaster $opts{M}
if defined $opts{M};
parseoverride $opts{O}
if defined $opts{O};
parseoptions $opts{g}
if defined $opts{g};
parseeditoptions $opts{t}
if defined $opts{t};
print_editoptions
if $opts{e};
print_dialogoptions
if $opts{d};
print_options
if $opts{o};

View file

@ -1,299 +0,0 @@
#!/bin/sh -e
#
# Copyright (c) 2004 Oliver Eikemeier. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
#
# MAINTAINER= eik@FreeBSD.org
#
# These variables are referenced and must be exported from the Makefile:
#
# CURDIR
# OBJDIR
# MASTERDIR
# OPTIONS_MASTER
# OPTIONS_OVERRIDE
# OPTIONS_FILE
# OPTIONS_CMD
# PKGNAME
#
# utilities
LOCALBASE="${LOCALBASE:-/usr/local}"
AWK=/usr/bin/awk
CAT=/bin/cat
CHMOD=/bin/chmod
CP=/bin/cp
CUT=/usr/bin/cut
DIALOG=/usr/bin/dialog
EXPR=/bin/expr
FETCH=/usr/bin/fetch
GREP=/usr/bin/grep
LS=/bin/ls
MKDIR='/bin/mkdir -p'
MKTEMP=/usr/bin/mktemp
MV=/bin/mv
REALPATH=/bin/realpath
RM=/bin/rm
SED=/usr/bin/sed
SETENV=/usr/bin/env
SORT=/usr/bin/sort
TR=/usr/bin/tr
WC=/usr/bin/wc
# global constants
### utility functions ###
###
# do_create generates default options for a master (or override) options files
###
do_create()
{
local rc
if [ -n "$OPTIONS_OVERRIDE" ]; then
OVERRIDEFILE="$OPTIONS_DEFAULT"
elif [ "$CURDIR" != `$REALPATH "$MASTERDIR"` ]; then
if [ -f "$CURDIR/options" ]; then
OVERRIDEFILE="$CURDIR/options"
elif [ -n "$PKGNAMESUFFIX" -a -f "$MASTERDIR/options.${PKGNAMESUFFIX#-}" ]; then
OVERRIDEFILE="$MASTERDIR/options.${PKGNAMESUFFIX#-}"
else
OVERRIDEFILE=
fi
else
OVERRIDEFILE=
fi
if [ -n "$OPTIONS_MASTER" ]; then
MASTERFILE="$OPTIONS_MASTER"
elif [ -f "$MASTERDIR/options" ]; then
MASTERFILE="$MASTERDIR/options"
else
echo ">> makeconfig: Can't find $MASTERDIR/options" >&2
return 1
fi
if [ -n "$OVERRIDEFILE" ]; then
SRCFILE="$OVERRIDEFILE"
else
SRCFILE="$MASTERFILE"
fi
if ! TMP_OPTIONS=`$MKTEMP -q "$SRCFILE.XXXXXX"`; then
echo ">> makeconfig: Can't create temporary options file"
return 1
fi
$SED -e '/^##/,$d' "$SRCFILE" > "$TMP_OPTIONS"
echo "## AUTOMATICALLY GENERATED FILE - DO NOT CHANGE ANYTHING BELOW THIS LINE ##" >> "$TMP_OPTIONS"
echo "# use \`make config' to edit the local configuration" >> "$TMP_OPTIONS"
echo "# use \`make makeconfig' to edit the defaults (MAINTAINER only)" >> "$TMP_OPTIONS"
echo >> "$TMP_OPTIONS"
if $OPTIONS_CMD -p "default" -M "$MASTERFILE" -O "$OVERRIDEFILE" -o >> "$TMP_OPTIONS"; then
$MV -f "$TMP_OPTIONS" "$SRCFILE"
$CHMOD a+r "$SRCFILE"
else
$RM -f "$TMP_OPTIONS"
fi
return $rc
}
###
# do_delete removes a saved configuration
###
do_delete()
{
local rc
$RM -f "$OPTIONS_FILE"
return $rc
}
###
# do_edit edits a custom configuration
###
do_edit()
{
local rc
OPTIONS_DIR="${OPTIONS_FILE%/*}"
if [ ! -d "$OPTIONS_DIR" ] && ! $MKDIR "$OPTIONS_DIR"; then
echo ">> config: Can't create $OPTIONS_DIR." 2>&1
return 1
fi
if [ -n "$OPTIONS_OVERRIDE" ]; then
OVERRIDE="$OPTIONS_DEFAULT"
elif [ "$CURDIR" != `$REALPATH "$MASTERDIR"` ]; then
if [ -f "$CURDIR/options" ]; then
OVERRIDE="$CURDIR/options"
elif [ -n "$PKGNAMESUFFIX" -a -f "$MASTERDIR/options.${PKGNAMESUFFIX#-}" ]; then
OVERRIDE="$MASTERDIR/options.${PKGNAMESUFFIX#-}"
else
OVERRIDE=
fi
else
OVERRIDE=
fi
if [ -n "$OPTIONS_MASTER" ]; then
MASTER="$OPTIONS_MASTER"
elif [ -f "$MASTERDIR/options" ]; then
MASTER="$MASTERDIR/options"
else
echo ">> makeconfig: Can't find $MASTERDIR/options" >&2
return 1
fi
TMP_OPTIONS=`$MKTEMP -t options`
$OPTIONS_CMD -p "$PKGNAME" -M "$MASTER" -O "$OVERRIDE" -g "$OPTIONS_FILE" -e > "$TMP_OPTIONS"
${EDITOR:-/usr/bin/vi} "$TMP_OPTIONS"
TMP_OPTIONS_FILE=`$MKTEMP -q "$OPTIONS_FILE.XXXXXX"`
echo "## AUTOMATICALLY GENERATED FILE - DO NOT EDIT ##" > "$TMP_OPTIONS_FILE"
$OPTIONS_CMD -p "$PKGNAME" -M "$MASTER" -O "$OVERRIDE" -g "$OPTIONS_FILE" -t "$TMP_OPTIONS" -o >> "$TMP_OPTIONS_FILE"
$RM -f "$TMP_OPTIONS"
$MV -f "$TMP_OPTIONS_FILE" "$OPTIONS_FILE"
$CHMOD a+r "$OPTIONS_FILE"
return $rc
}
###
# do_graphical displays a menu to generate a custom configuration
###
do_graphical()
{
local rc
if [ -n "$OPTIONS_OVERRIDE" ]; then
OVERRIDE="$OPTIONS_DEFAULT"
elif [ "$CURDIR" != `$REALPATH "$MASTERDIR"` ]; then
if [ -f "$CURDIR/options" ]; then
OVERRIDE="$CURDIR/options"
elif [ -n "$PKGNAMESUFFIX" -a -f "$MASTERDIR/options.${PKGNAMESUFFIX#-}" ]; then
OVERRIDE="$MASTERDIR/options.${PKGNAMESUFFIX#-}"
else
OVERRIDE=
fi
else
OVERRIDE=
fi
if [ -n "$OPTIONS_MASTER" ]; then
MASTER="$OPTIONS_MASTER"
elif [ -f "$MASTERDIR/options" ]; then
MASTER="$MASTERDIR/options"
else
echo ">> makeconfig: Can't find $MASTERDIR/options" >&2
return 1
fi
TMP_OPTIONS=`$MKTEMP -t options`
DIALOGRC=`$OPTIONS_CMD -p "$PKGNAME" -M "$MASTER" -O "$OVERRIDE" -g "$OPTIONS_FILE" -d`
/bin/sh -c "$DIALOG --checklist \"Options for $PKGNAME\" 21 70 15 $DIALOGRC 2>\"$TMP_OPTIONS\""
#TMP_OPTIONS_FILE=`$MKTEMP -q "$OPTIONS_FILE.XXXXXX"`
#echo "## AUTOMATICALLY GENERATED FILE - DO NOT EDIT ##" > "$TMP_OPTIONS_FILE"
#$OPTIONS_CMD -p "$PKGNAME" -M "$MASTER" -O "$OVERRIDE" -g "$OPTIONS_FILE" -t "$TMP_OPTIONS" -o >> "$TMP_OPTIONS_FILE"
$CAT "$TMP_OPTIONS"
$RM -f "$TMP_OPTIONS"
#$MV -f "$TMP_OPTIONS_FILE" "$OPTIONS_FILE"
return $rc
}
###
# do_list lists the current configuration
###
do_list()
{
local rc
return $rc
}
###
# main
###
opt_create=false
opt_delete=false
opt_edit=false
opt_graphical=false
opt_list=false
while getopts "cdegl" opt; do
case "$opt" in
c) opt_create=true;;
d) opt_delete=true;;
e) opt_edit=true;;
g) opt_graphical=true;;
l) opt_list=true;;
?) echo "Usage: $0 -cdegl"; exit 1;;
esac
done
shift $(($OPTIND-1))
$opt_create &&
{ do_create || exit 1; }
$opt_delete &&
{ do_delete || exit 1; }
$opt_edit &&
{ do_edit || exit 1; }
$opt_graphical &&
{ do_graphical || exit 1; }
$opt_list &&
{ do_list || exit 1; }
exit 0

View file

@ -1,139 +0,0 @@
#!/usr/bin/perl -w
#
# Copyright (c) 2004 Oliver Eikemeier. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
#
# MAINTAINER= eik@FreeBSD.org
#
require 5.005;
use strict;
my $dbdir = $ENV{RANKDIR} ? $ENV{RANKDIR} : '/var/db/distrank';
my $fping = $ENV{FPING} ? $ENV{FPING} : '/usr/local/sbin/fping';
-x $fping
or die "fping required\n";
-d $dbdir || mkdir $dbdir, 0777
or die "Can't create $dbdir\n";
my $rankfile = "$dbdir/ranks-fping";
my $now = time;
my %distance;
if (-r $rankfile) {
open RANKS, "<$rankfile";
while (<RANKS>) {
chomp;
my ($host, $d, $e) = split;
$distance{$host} = [$d, $e]
if defined $e && $e >= $now;
}
close RANKS;
}
my %mastersites;
my %newdistance;
my $distgood = 0;
my $distdefault = 5000;
my $distbad = 10000;
my $expgood = $now + 14 * 86400;
my $expdefault = $now + 7 * 86400;
my $hostcount = 0;
while (<>) {
chomp;
next
if exists $mastersites{$_};
if (m'^(?:ftp|https?)://(?:[^/]*@)?([^/:]+\.[^/:]+)(?::\d+)?(?:/|$)'i) {
my $host = lc $1;
$mastersites{$_} = $host;
if (!defined $distance{$host}) {
$distance{$host} = [$distdefault, $expdefault];
$newdistance{$host} = undef
}
$hostcount++;
} elsif (m'^file:'i) {
$mastersites{$_} = 'FILE';
} else {
$mastersites{$_} = 'UNKNOWN';
}
}
if (%newdistance && $hostcount > 1) {
if (!open FPING, '-|') {
if (!open FPINGIN, '|-') {
open STDERR, '>&STDOUT';
exec $fping, '-q', '-C', '3';
die
}
foreach (keys %newdistance) {
print FPINGIN $_, "\n";
}
close FPINGIN;
exit;
}
while(<FPING>) {
/([^\s:]+)\s*:\s*([\s\d.-]*)/ or next;
my $sum = 0.0;
my $num = 0;
foreach my $val (split ' ', $2) {
$val ne '-' || next;
$sum += $val;
$num++;
}
if ($num > 0) {
$distance{$1} = [$sum/$num, $expgood];
}
}
close FPING;
open RANKS, ">$rankfile";
while (my ($host, $val) = each %distance) {
printf RANKS "%s\t%.2f\t%d\n", $host, $val->[0], $val->[1]
if defined $val;
}
close RANKS;
}
$distance{FILE} = [$distgood, 0];
$distance{UNKNOWN} = [$distbad, 0];
foreach (sort {$distance{$mastersites{$a}}->[0] <=> $distance{$mastersites{$b}}->[0]} keys %mastersites) {
print $_, "\n";
}

View file

@ -1,393 +0,0 @@
#!/usr/bin/perl -w
#
# Copyright (c) 2004 Oliver Eikemeier. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright notice
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# $FreeBSD$
#
# MAINTAINER= eik@FreeBSD.org
#
require 5.005;
use strict;
use Geo::IP;
use constant PI => 3.14159265358979323846;
my $home = $ENV{CC_HOME} ? lc $ENV{CC_HOME} : 'eu';
my $dbdir = $ENV{RANKDIR} ? $ENV{RANKDIR} : '/var/db/distrank';
-d $dbdir || mkdir $dbdir, 0777 or die "Can't create $dbdir\n";
my $rankfile = "$dbdir/ranks-geoip";
my $now = time;
my %distance;
if (-r $rankfile) {
open RANKS, "<$rankfile";
while (<RANKS>) {
chomp;
my ($host, $d, $e) = split;
$distance{$host} = [$d, $e]
if defined $e && $e >= $now;
}
close RANKS;
}
my %mastersites;
my %newdistance;
my $distgood = -1;
my $distdefault = PI/2;
my $distbad = 2;
my $expgood = $now + 14 * 86400;
my $expdefault = $now + 7 * 86400;
my $hostcount = 0;
while (<>) {
chomp;
next
if exists $mastersites{$_};
if (m'^(?:ftp|https?)://(?:[^/]*@)?([^/:]+\.[^/:]+)(?::\d+)?(?:/|$)'i) {
my $host = lc $1;
$mastersites{$_} = $host;
if (!defined $distance{$host}) {
$distance{$host} = [$distdefault, $expdefault];
$newdistance{$host} = undef
}
$hostcount++;
} elsif (m'^file:'i) {
$mastersites{$_} = 'FILE';
} else {
$mastersites{$_} = 'UNKNOWN';
}
}
# calculate_distance and the associated table is from Geo::Mirror, and therefore
# Copyright (c) 2002, T.J. Mather, tjmather@tjmather.com, New York, NY, USA
my (%lat, %lon);
sub getlatlon {
my ($cc) = @_;
my ($lat_cc, $lon_cc) = ($lat{$cc}, $lon{$cc});
# Convert all the degrees to radians
$lat_cc *= PI/180
if defined $lat_cc;
$lon_cc *= PI/180
if defined $lon_cc;
return ($lat_cc, $lon_cc);
}
if (%newdistance && $hostcount > 1) {
while (<main::DATA>) {
my ($country, $lat, $lon) = split(':');
$lat{$country} = $lat;
$lon{$country} = $lon;
}
close main::DATA;
my $gi = Geo::IP->new(GEOIP_MEMORY_CACHE);
my ($lat_home, $lon_home) = getlatlon($home);
foreach (keys %newdistance) {
my $dist;
my $cc = lc $gi->country_code_by_name($_);
if ($cc) {
my ($lat_cc, $lon_cc) = getlatlon($cc)
if defined $cc;
# Find the deltas
my $delta_lat = $lat_cc - $lat_home;
my $delta_lon = $lon_cc - $lon_home;
# Find the Great Circle distance
my $temp = sin($delta_lat/2.0)**2 + cos($lat_home) * cos($lat_cc) * sin($delta_lon/2.0)**2;
$dist = atan2(sqrt($temp),sqrt(1-$temp));
$distance{$_} = [$dist, $expgood]
if defined $dist;
}
}
open RANKS, ">$rankfile";
while (my ($host, $val) = each %distance) {
printf RANKS "%s\t%.4f\t%d\n", $host, $val->[0], $val->[1]
if defined $val;
}
close RANKS;
}
$distance{FILE} = [$distgood, 0];
$distance{UNKNOWN} = [$distbad, 0];
foreach (sort {$distance{$mastersites{$a}}->[0] <=> $distance{$mastersites{$b}}->[0]} keys %mastersites) {
print $_, "\n";
}
__END__
af:33:65
al:41:20
dz:28:3
as:-14:-170
ad:42:1
ao:-12:18
ai:18:-63
aq:-90:0
ag:17:-61
ar:-34:-64
am:40:45
aw:12:-69
au:-27:133
at:47:13
az:40:47
bs:24:-76
bh:26:50
bd:24:90
bb:13:-59
by:53:28
be:50:4
bz:17:-88
bj:9:2
bm:32:-64
bt:27:90
bo:-17:-65
ba:44:18
bw:-22:24
bv:-54:3
br:-10:-55
io:-6:71
vg:18:-64
bg:43:25
bf:13:-2
bi:-3:30
kh:13:105
cm:6:12
ca:60:-95
cv:16:-24
ky:19:-80
cf:7:21
td:15:19
cl:-30:-71
cn:35:105
cx:-10:105
cc:-12:96
co:4:-72
km:-12:44
cd:0:25
cg:-1:15
ck:-21:-159
cr:10:-84
ci:8:-5
hr:45:15
cu:21:-80
cy:35:33
cz:49:15
dk:56:10
dj:11:43
dm:15:-61
do:19:-70
ec:-2:-77
eg:27:30
sv:13:-88
gq:2:10
er:15:39
ee:59:26
et:8:38
fk:-51:-59
fo:62:-7
fj:-18:175
fi:64:26
fr:46:2
gf:4:-53
pf:-15:-140
ga:-1:11
gm:13:-16
ge:42:43
de:51:9
eu:48:10
gh:8:-2
gi:36:-5
gr:39:22
gl:72:-40
gd:12:-61
gp:16:-61
gu:13:144
gt:15:-90
gn:11:-10
gw:12:-15
gy:5:-59
ht:19:-72
hm:-53:72
va:41:12
hn:15:-86
hk:22:114
hu:47:20
is:65:-18
in:20:77
id:-5:120
ir:32:53
iq:33:44
ie:53:-8
il:31:34
it:42:12
jm:18:-77
sj:71:-8
jp:36:138
jo:31:36
ke:1:38
ki:1:173
kp:40:127
kr:37:127
kw:29:45
kg:41:75
lv:57:25
lb:33:35
ls:-29:28
lr:6:-9
ly:25:17
li:47:9
lt:56:24
lu:49:6
mo:22:113
mk:41:22
mg:-20:47
mw:-13:34
my:2:112
mv:3:73
ml:17:-4
mt:35:14
mh:9:168
mq:14:-61
mr:20:-12
mu:-20:57
yt:-12:45
mx:23:-102
fm:6:158
mc:43:7
mn:46:105
ms:16:-62
ma:32:-5
mz:-18:35
na:-22:17
nr:-0:166
np:28:84
nl:52:5
an:12:-68
nc:-21:165
nz:-41:174
ni:13:-85
ne:16:8
ng:10:8
nu:-19:-169
nf:-29:167
mp:15:145
no:62:10
om:21:57
pk:30:70
pw:7:134
pa:9:-80
pg:-6:147
py:-23:-58
pe:-10:-76
ph:13:122
pn:-25:-130
pl:52:20
pt:39:-8
pr:18:-66
qa:25:51
re:-21:55
ro:46:25
ru:60:100
rw:-2:30
sh:-15:-5
kn:17:-62
lc:13:-60
pm:46:-56
vc:13:-61
ws:-13:-172
sm:43:12
st:1:7
sa:25:45
sn:14:-14
sc:-4:55
sl:8:-11
sg:1:103
sk:48:19
si:46:15
sb:-8:159
so:10:49
za:-29:24
gs:-54:-37
es:40:-4
lk:7:81
sd:15:30
sr:4:-56
sj:78:20
sz:-26:31
se:62:15
ch:47:8
sy:35:38
tj:39:71
tz:-6:35
th:15:100
tg:8:1
tk:-9:-172
to:-20:-175
tt:11:-61
tn:34:9
tr:39:35
tm:40:60
tc:21:-71
tv:-8:178
ug:1:32
ua:49:32
ae:24:54
gb:54:-2
us:38:-97
uy:-33:-56
uz:41:64
vu:-16:167
ve:8:-66
vn:16:106
vi:18:-64
wf:-13:-176
eh:24:-13
ye:15:48
yu:44:21
zm:-15:30
zw:-20:30
tw:23:121