Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/cabal.mk
Show All 17 Lines | |||||
# usual "_" syntax: invariant-0.5.1_1 | # usual "_" syntax: invariant-0.5.1_1 | ||||
# When creating a new port, the initial list can be built | # When creating a new port, the initial list can be built | ||||
# using make-use-cabal auxiliary target. | # using make-use-cabal auxiliary target. | ||||
# | # | ||||
# CABAL_FLAGS List of Cabal flags to be passed verbatim into --flags | # CABAL_FLAGS List of Cabal flags to be passed verbatim into --flags | ||||
# argument of cabal-install utility. Used for both | # argument of cabal-install utility. Used for both | ||||
# cabal configure and cabal build. | # cabal configure and cabal build. | ||||
# | # | ||||
# EXECUTABLES List of executable Cabal targets to be built and installed. | # CABAL_EXECUTABLES List of executable Cabal targets to be built and installed. | ||||
# Consult the .cabal file of the project being porter to get | |||||
# possible values for this variable. | |||||
# default: ${PORTNAME} | # default: ${PORTNAME} | ||||
# | # | ||||
# opt_USE_CABAL Variant of USE_CABAL to be used with options framework. | # opt_USE_CABAL Variant of USE_CABAL to be used with options framework. | ||||
# opt_CABAL_FLAGS Variant of CABAL_FLAGS to be used with options framework. | # opt_CABAL_FLAGS Variant of CABAL_FLAGS to be used with options framework. | ||||
# Note that it works a bit differently from CABAL_FLAGS: | # Note that it works a bit differently from CABAL_FLAGS: | ||||
# it appends "${opt_CABAL_FLAGS}" when the option is enabled | # it appends "${opt_CABAL_FLAGS}" when the option is enabled | ||||
# and "-${opt_CABAL_FLAGS}" otherwise. | # and "-${opt_CABAL_FLAGS}" otherwise. | ||||
# opt_EXECUTABLES Variant of EXECUTABLES to be used with options framework. | # opt_CABAL_EXECUTABLES Variant of CABAL_EXECUTABLES to be used with | ||||
# options framework. | |||||
# | # | ||||
# CABAL_WRAPPER_SCRIPTS A subset of ${EXECUTABLES} containing Haskell | # CABAL_WRAPPER_SCRIPTS A subset of ${CABAL_EXECUTABLES} containing Haskell | ||||
# programs to be wrapped into a shell script that sets | # programs to be wrapped into a shell script that sets | ||||
# *_datadir environment variables before running the program. | # *_datadir environment variables before running the program. | ||||
# This is needed for Haskell programs that install their | # This is needed for Haskell programs that install their | ||||
# data files under share/ directory. | # data files under share/ directory. | ||||
# | # | ||||
# FOO_DATADIR_VARS Additional environment vars to add to FOO executable's | # FOO_DATADIR_VARS Additional environment vars to add to FOO executable's | ||||
# wrapper script. | # wrapper script. | ||||
# | # | ||||
Show All 23 Lines | |||||
. if ${ARCH} == i386 && defined(USE_CABAL) && ${USE_CABAL:Mbasement-0.0.14} | . if ${ARCH} == i386 && defined(USE_CABAL) && ${USE_CABAL:Mbasement-0.0.14} | ||||
# Upstream issue: https://github.com/haskell-foundation/foundation/issues/565 | # Upstream issue: https://github.com/haskell-foundation/foundation/issues/565 | ||||
BROKEN= basement-0.0.14 package doesn't compile on i386 | BROKEN= basement-0.0.14 package doesn't compile on i386 | ||||
. endif | . endif | ||||
PKGNAMEPREFIX?= hs- | PKGNAMEPREFIX?= hs- | ||||
EXECUTABLES?= ${PORTNAME} | CABAL_EXECUTABLES?= ${PORTNAME} | ||||
CABAL_CMD?= cabal | CABAL_CMD?= cabal | ||||
CABAL_PORT= devel/hs-cabal-install | CABAL_PORT= devel/hs-cabal-install | ||||
CABAL_HOME= ${WRKDIR}/cabal-home | CABAL_HOME= ${WRKDIR}/cabal-home | ||||
CABAL_LIBEXEC= libexec/cabal | CABAL_LIBEXEC= libexec/cabal | ||||
CABAL_EXTRACT_SUFX= .tar.gz | CABAL_EXTRACT_SUFX= .tar.gz | ||||
CABAL_ARCH= ${ARCH:S/amd64/x86_64/:C/armv.*/arm/:S/powerpc64/ppc64/} | CABAL_ARCH= ${ARCH:S/amd64/x86_64/:C/armv.*/arm/:S/powerpc64/ppc64/} | ||||
CABAL_DEPSDIR= ${WRKSRC}/${CABAL_DEPS_SUBDIR} | CABAL_DEPSDIR= ${WRKSRC}/${CABAL_DEPS_SUBDIR} | ||||
Show All 38 Lines | |||||
DISTFILES+= ${PORTNAME}-${PORTVERSION}${CABAL_EXTRACT_SUFX} | DISTFILES+= ${PORTNAME}-${PORTVERSION}${CABAL_EXTRACT_SUFX} | ||||
. endif | . endif | ||||
_USES_extract= 701:cabal-post-extract | _USES_extract= 701:cabal-post-extract | ||||
_USES_patch= 701:cabal-post-patch | _USES_patch= 701:cabal-post-patch | ||||
_USES_configure=301:cabal-pre-configure | _USES_configure=301:cabal-pre-configure | ||||
_USES_stage= 751:cabal-post-install-script | _USES_stage= 751:cabal-post-install-script | ||||
BUILD_TARGET?= ${EXECUTABLES:S/^/exe:&/} | BUILD_TARGET?= ${CABAL_EXECUTABLES:S/^/exe:&/} | ||||
_use_cabal= ${USE_CABAL:O:u} | _use_cabal= ${USE_CABAL:O:u} | ||||
. for package in ${_use_cabal} | . for package in ${_use_cabal} | ||||
_PKG_GROUP= ${package:C/[\.-]//g} | _PKG_GROUP= ${package:C/[\.-]//g} | ||||
_PKG_WITHOUT_REV= ${package:C/_[0-9]+//} | _PKG_WITHOUT_REV= ${package:C/_[0-9]+//} | ||||
_REV= ${package:C/[^_]*//:S/_//} | _REV= ${package:C/[^_]*//:S/_//} | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | cd ${WRKSRC} && \ | ||||
${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} new-build --offline --disable-benchmarks --disable-tests ${CABAL_WITH_ARGS} --flags "${CABAL_FLAGS}" ${BUILD_ARGS} ${BUILD_TARGET} | ${SETENV} ${MAKE_ENV} HOME=${CABAL_HOME} ${CABAL_CMD} new-build --offline --disable-benchmarks --disable-tests ${CABAL_WITH_ARGS} --flags "${CABAL_FLAGS}" ${BUILD_ARGS} ${BUILD_TARGET} | ||||
. endif | . endif | ||||
. if !target(do-install) | . if !target(do-install) | ||||
do-install: | do-install: | ||||
. if defined(CABAL_WRAPPER_SCRIPTS) && !empty(CABAL_WRAPPER_SCRIPTS) | . if defined(CABAL_WRAPPER_SCRIPTS) && !empty(CABAL_WRAPPER_SCRIPTS) | ||||
${MKDIR} ${STAGEDIR}${PREFIX}/${CABAL_LIBEXEC} | ${MKDIR} ${STAGEDIR}${PREFIX}/${CABAL_LIBEXEC} | ||||
. endif | . endif | ||||
. for exe in ${EXECUTABLES} | . for exe in ${CABAL_EXECUTABLES} | ||||
. if defined(CABAL_WRAPPER_SCRIPTS) && ${CABAL_WRAPPER_SCRIPTS:M${exe}} | . if defined(CABAL_WRAPPER_SCRIPTS) && ${CABAL_WRAPPER_SCRIPTS:M${exe}} | ||||
${INSTALL_PROGRAM} \ | ${INSTALL_PROGRAM} \ | ||||
$$(find ${WRKSRC}/dist-newstyle -name ${exe} -type f -perm +111) \ | $$(find ${WRKSRC}/dist-newstyle -name ${exe} -type f -perm +111) \ | ||||
${STAGEDIR}${PREFIX}/${CABAL_LIBEXEC}/${exe} | ${STAGEDIR}${PREFIX}/${CABAL_LIBEXEC}/${exe} | ||||
${ECHO_CMD} '#!/bin/sh' > ${STAGEDIR}${PREFIX}/bin/${exe} | ${ECHO_CMD} '#!/bin/sh' > ${STAGEDIR}${PREFIX}/bin/${exe} | ||||
${ECHO_CMD} '' >> ${STAGEDIR}${PREFIX}/bin/${exe} | ${ECHO_CMD} '' >> ${STAGEDIR}${PREFIX}/bin/${exe} | ||||
${ECHO_CMD} 'export ${exe:S/-/_/g}_datadir=${DATADIR}' >> ${STAGEDIR}${PREFIX}/bin/${exe} | ${ECHO_CMD} 'export ${exe:S/-/_/g}_datadir=${DATADIR}' >> ${STAGEDIR}${PREFIX}/bin/${exe} | ||||
. for dep in ${${exe}_DATADIR_VARS} | . for dep in ${${exe}_DATADIR_VARS} | ||||
${ECHO_CMD} 'export ${dep:S/-/_/g}_datadir=${DATADIR}' >> ${STAGEDIR}${PREFIX}/bin/${exe} | ${ECHO_CMD} 'export ${dep:S/-/_/g}_datadir=${DATADIR}' >> ${STAGEDIR}${PREFIX}/bin/${exe} | ||||
. endfor | . endfor | ||||
${ECHO_CMD} '' >> ${STAGEDIR}${PREFIX}/bin/${exe} | ${ECHO_CMD} '' >> ${STAGEDIR}${PREFIX}/bin/${exe} | ||||
${ECHO_CMD} 'exec ${PREFIX}/${CABAL_LIBEXEC}/${exe} "$$@"' >> ${STAGEDIR}${PREFIX}/bin/${exe} | ${ECHO_CMD} 'exec ${PREFIX}/${CABAL_LIBEXEC}/${exe} "$$@"' >> ${STAGEDIR}${PREFIX}/bin/${exe} | ||||
${CHMOD} +x ${STAGEDIR}${PREFIX}/bin/${exe} | ${CHMOD} +x ${STAGEDIR}${PREFIX}/bin/${exe} | ||||
. else | . else | ||||
${INSTALL_PROGRAM} \ | ${INSTALL_PROGRAM} \ | ||||
$$(find ${WRKSRC}/dist-newstyle -name ${exe} -type f -perm +111) \ | $$(find ${WRKSRC}/dist-newstyle -name ${exe} -type f -perm +111) \ | ||||
${STAGEDIR}${PREFIX}/bin/${exe} | ${STAGEDIR}${PREFIX}/bin/${exe} | ||||
. endif | . endif | ||||
. endfor | . endfor | ||||
. endif | . endif | ||||
. if !defined(SKIP_CABAL_PLIST) | . if !defined(SKIP_CABAL_PLIST) | ||||
cabal-post-install-script: | cabal-post-install-script: | ||||
. for exe in ${EXECUTABLES} | . for exe in ${CABAL_EXECUTABLES} | ||||
${ECHO_CMD} 'bin/${exe}' >> ${TMPPLIST} | ${ECHO_CMD} 'bin/${exe}' >> ${TMPPLIST} | ||||
. if defined(CABAL_WRAPPER_SCRIPTS) && ${CABAL_WRAPPER_SCRIPTS:M${exe}} | . if defined(CABAL_WRAPPER_SCRIPTS) && ${CABAL_WRAPPER_SCRIPTS:M${exe}} | ||||
${ECHO_CMD} '${CABAL_LIBEXEC}/${exe}' >> ${TMPPLIST} | ${ECHO_CMD} '${CABAL_LIBEXEC}/${exe}' >> ${TMPPLIST} | ||||
. endif | . endif | ||||
. endfor | . endfor | ||||
. endif | . endif | ||||
.endif | .endif |