1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: haskell-cabal.eclass
6 # Haskell herd <haskell@gentoo.org>
8 # Original author: Andres Loeh <kosmikus@gentoo.org>
9 # Original author: Duncan Coutts <dcoutts@gentoo.org>
10 # @BLURB: for packages that make use of the Haskell Common Architecture for Building Applications and Libraries (cabal)
14 # Before inheriting the eclass, set CABAL_FEATURES to
15 # reflect the tools and features that the package makes
18 # Currently supported features:
19 # haddock -- for documentation generation
20 # hscolour -- generation of colourised sources
21 # hoogle -- generation of documentation search index
22 # profile -- if package supports to build profiling-enabled libraries
23 # bootstrap -- only used for the cabal package itself
24 # lib -- the package installs libraries
25 # nocabaldep -- don't add dependency on cabal.
26 # only used for packages that _must_ not pull the dependency
27 # on cabal, but still use this eclass (e.g. haskell-updater).
28 # ghcdeps -- constraint dependency on package to ghc onces
29 # only used for packages that use libghc internally and _must_
30 # not pull upper versions
31 # test-suite -- add support for cabal test-suites (introduced in Cabal-1.8)
33 inherit eutils ghc-package multilib toolchain-funcs
35 # @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
37 # User-specified additional parameters passed to 'setup configure'.
38 # example: /etc/portage/make.conf:
39 # CABAL_EXTRA_CONFIGURE_FLAGS="--enable-shared --enable-executable-dynamic"
40 : ${CABAL_EXTRA_CONFIGURE_FLAGS:=}
42 # @ECLASS-VARIABLE: CABAL_EXTRA_BUILD_FLAGS
44 # User-specified additional parameters passed to 'setup build'.
45 # example: /etc/portage/make.conf: CABAL_EXTRA_BUILD_FLAGS=-v
46 : ${CABAL_EXTRA_BUILD_FLAGS:=}
48 # @ECLASS-VARIABLE: GHC_BOOTSTRAP_FLAGS
50 # User-specified additional parameters for ghc when building
51 # _only_ 'setup' binary bootstrap.
52 # example: /etc/portage/make.conf: GHC_BOOTSTRAP_FLAGS=-dynamic to make
53 # linking 'setup' faster.
54 : ${GHC_BOOTSTRAP_FLAGS:=}
56 # @ECLASS-VARIABLE: CABAL_EXTRA_TEST_FLAGS
58 # User-specified additional parameters passed to 'setup test'.
59 # example: /etc/portage/make.conf:
60 # CABAL_EXTRA_TEST_FLAGS="-v3 --show-details=streaming"
61 : ${CABAL_EXTRA_TEST_FLAGS:=}
63 # @ECLASS-VARIABLE: CABAL_DEBUG_LOOSENING
65 # Show debug output for 'cabal_chdeps' function if set.
66 # Needs working 'diff'.
67 : ${CABAL_DEBUG_LOOSENING:=}
69 HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install pkg_postinst pkg_postrm"
71 # 'dev-haskell/cabal' passes those options with ./configure-based
72 # configuration, but most packages don't need/don't accept it:
74 QA_CONFIGURE_OPTIONS+=" --with-compiler --with-hc --with-hc-pkg --with-gcc"
77 2|3|4|5|6|7) HASKELL_CABAL_EXPF+=" src_configure" ;;
81 EXPORT_FUNCTIONS ${HASKELL_CABAL_EXPF}
83 for feature in ${CABAL_FEATURES}; do
85 haddock) CABAL_USE_HADDOCK=yes;;
86 hscolour) CABAL_USE_HSCOLOUR=yes;;
87 hoogle) CABAL_USE_HOOGLE=yes;;
88 profile) CABAL_USE_PROFILE=yes;;
89 bootstrap) CABAL_BOOTSTRAP=yes;;
90 lib) CABAL_HAS_LIBRARIES=yes;;
91 nocabaldep) CABAL_FROM_GHC=yes;;
92 ghcdeps) CABAL_GHC_CONSTRAINT=yes;;
93 test-suite) CABAL_TEST_SUITE=yes;;
95 # does nothing, removed 2016-09-04
98 *) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
102 if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
104 # don't require depend on itself to build docs.
105 # ebuild bootstraps docs from just built binary
107 # starting from ghc-7.10.2 we install haddock bundled with
108 # ghc to keep links to base and ghc library, otherwise
109 # newer haddock versions change index format and can't
110 # read index files for packages coming with ghc.
111 [[ ${CATEGORY}/${PN} = "dev-haskell/haddock" ]] || \
112 DEPEND="${DEPEND} doc? ( || ( dev-haskell/haddock >=dev-lang/ghc-7.10.2 ) )"
115 if [[ -n "${CABAL_USE_HSCOLOUR}" ]]; then
116 IUSE="${IUSE} hscolour"
117 DEPEND="${DEPEND} hscolour? ( dev-haskell/hscolour )"
120 if [[ -n "${CABAL_USE_HOOGLE}" ]]; then
121 # enabled only in ::haskell
122 #IUSE="${IUSE} hoogle"
126 if [[ -n "${CABAL_USE_PROFILE}" ]]; then
127 IUSE="${IUSE} profile"
130 if [[ -n "${CABAL_TEST_SUITE}" ]]; then
134 # returns the version of cabal currently in use.
135 # Rarely it's handy to pin cabal version from outside.
136 : ${_CABAL_VERSION_CACHE:=""}
138 if [[ -z "${_CABAL_VERSION_CACHE}" ]]; then
139 if [[ "${CABAL_BOOTSTRAP}" ]]; then
140 # We're bootstrapping cabal, so the cabal version is the version
141 # of this package itself.
142 _CABAL_VERSION_CACHE="${PV}"
143 elif [[ "${CABAL_FROM_GHC}" ]]; then
144 _CABAL_VERSION_CACHE="$(ghc-cabal-version)"
146 # We ask portage, not ghc, so that we only pick up
147 # portage-installed cabal versions.
148 _CABAL_VERSION_CACHE="$(ghc-extractportageversion dev-haskell/cabal)"
151 echo "${_CABAL_VERSION_CACHE}"
157 local setup_bootstrap_args=()
159 if [[ -f "${S}/Setup.lhs" ]]; then
160 setupmodule="${S}/Setup.lhs"
161 elif [[ -f "${S}/Setup.hs" ]]; then
162 setupmodule="${S}/Setup.hs"
164 eqawarn "No Setup.lhs or Setup.hs found. Either add Setup.hs to package or call cabal-mksetup from ebuild"
166 setupmodule="${S}/Setup.hs"
169 # We build the setup program using the latest version of
170 # cabal that we have installed
171 cabalpackage=Cabal-$(cabal-version)
172 einfo "Using cabal-$(cabal-version)."
174 if $(ghc-supports-threaded-runtime); then
175 # Cabal has a bug that deadlocks non-threaded RTS:
176 # https://bugs.gentoo.org/537500
177 # https://github.com/haskell/cabal/issues/2398
178 setup_bootstrap_args+=(-threaded)
182 set -- -package "${cabalpackage}" --make "${setupmodule}" \
184 "${setup_bootstrap_args[@]}" \
186 ${GHC_BOOTSTRAP_FLAGS} \
189 echo $(ghc-getghc) "$@"
192 if $(ghc-supports-shared-libraries); then
193 # # some custom build systems might use external libraries,
194 # # for which we don't have shared libs, so keep static fallback
195 # bug #411789, http://hackage.haskell.org/trac/ghc/ticket/5743#comment:3
196 # http://hackage.haskell.org/trac/ghc/ticket/7062
197 # http://hackage.haskell.org/trac/ghc/ticket/3072
198 # ghc does not set RPATH for extralibs, thus we do it ourselves by hands
199 einfo "Prepending $(ghc-libdir) to LD_LIBRARY_PATH"
200 if [[ ${CHOST} != *-darwin* ]]; then
201 LD_LIBRARY_PATH="$(ghc-libdir)${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
202 export LD_LIBRARY_PATH
204 DYLD_LIBRARY_PATH="$(ghc-libdir)${DYLD_LIBRARY_PATH:+:}${DYLD_LIBRARY_PATH}"
205 export DYLD_LIBRARY_PATH
207 { make_setup -dynamic "$@" && ./setup --help >/dev/null; } ||
208 make_setup "$@" || die "compiling ${setupmodule} failed"
210 make_setup "$@" || die "compiling ${setupmodule} failed"
215 local setupdir=${1:-${S}}
216 local setup_src=${setupdir}/Setup.hs
218 rm -vf "${setupdir}"/Setup.{lhs,hs}
219 elog "Creating 'Setup.hs' for 'Simple' build type."
221 echo 'import Distribution.Simple; main = defaultMain' \
222 > "${setup_src}" || die "failed to create default Setup.hs"
228 ./setup "$@" || die "setup hscolour failed"
234 ./setup "$@" || die "setup haddock failed"
238 ewarn "hoogle USE flag requires doc USE flag, building without hoogle"
241 cabal-hscolour-haddock() {
242 # --hyperlink-source implies calling 'setup hscolour'
243 set -- haddock --hyperlink-source
245 ./setup "$@" --hyperlink-source || die "setup haddock --hyperlink-source failed"
248 cabal-hoogle-haddock() {
249 set -- haddock --hoogle
251 ./setup "$@" || die "setup haddock --hoogle failed"
254 cabal-hoogle-hscolour-haddock() {
255 cabal-hscolour-haddock
259 cabal-hoogle-hscolour() {
260 ewarn "hoogle USE flag requires doc USE flag, building without hoogle"
264 cabal-die-if-nonempty() {
265 local breakage_type=$1
268 [[ "${#@}" == 0 ]] && return 0
269 eerror "Detected ${breakage_type} packages: ${@}"
270 die "//==-- Please, run 'haskell-updater' to fix ${breakage_type} packages --==//"
273 cabal-show-brokens() {
274 elog "ghc-pkg check: 'checking for other broken packages:'"
276 $(ghc-getghcpkg) check 2>&1 \
277 | egrep -v '^Warning: haddock-(html|interfaces): ' \
278 | egrep -v '^Warning: include-dirs: ' \
281 cabal-die-if-nonempty 'broken' \
282 $($(ghc-getghcpkg) check --simple-output)
286 cabal-die-if-nonempty 'outdated' \
287 $("${EPREFIX}"/usr/sbin/haskell-updater --quiet --upgrade --list-only)
290 cabal-show-brokens-and-die() {
299 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
301 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
302 # We use the bundled with GHC version if exists
303 # Haddock is very picky about index files
304 # it generates for ghc's base and other packages.
305 local p=${EPREFIX}/usr/bin/haddock-ghc-$(ghc-version)
307 cabalconf+=(--with-haddock="${p}")
309 cabalconf+=(--with-haddock=${EPREFIX}/usr/bin/haddock)
312 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
313 cabalconf+=(--enable-library-profiling)
316 if [[ -n "${CABAL_TEST_SUITE}" ]]; then
317 cabalconf+=($(use_enable test tests))
320 if [[ -n "${CABAL_GHC_CONSTRAINT}" ]]; then
321 cabalconf+=($(cabal-constraint "ghc"))
324 cabalconf+=(--ghc-options="$(ghc-make-args)")
327 for option in ${HCFLAGS}
329 cabalconf+=(--ghc-option="$option")
333 cabalconf+=(--with-ar="$(tc-getAR)")
335 # Building GHCi libs on ppc64 causes "TOC overflow".
337 cabalconf+=(--disable-library-for-ghci)
340 # currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
341 # so translate LDFLAGS to ghc parameters (without filtering)
343 for flag in $CFLAGS; do cabalconf+=(--ghc-option="-optc$flag"); done
344 for flag in $LDFLAGS; do cabalconf+=(--ghc-option="-optl$flag"); done
346 # disable executable stripping for the executables, as portage will
347 # strip by itself, and pre-stripping gives a QA warning.
348 # cabal versions previous to 1.4 does not strip executables, and does
349 # not accept the flag.
350 # this fixes numerous bugs, amongst them;
351 # bug #251881, bug #251882, bug #251884, bug #251886, bug #299494
352 cabalconf+=(--disable-executable-stripping)
354 cabalconf+=(--docdir="${EPREFIX}"/usr/share/doc/${PF})
355 # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes
356 # it's better if the configure chatter is in the build logs:
357 cabalconf+=(--verbose)
359 # We build shared version of our Cabal where ghc ships it's shared
360 # version of it. We will link ./setup as dynamic binary againt Cabal later.
361 [[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \
362 $(ghc-supports-shared-libraries) && \
363 cabalconf+=(--enable-shared)
365 if $(ghc-supports-shared-libraries); then
366 # Experimental support for dynamically linked binaries.
367 # We are enabling it since 7.10.1_rc3
368 if ver_test "$(ghc-version)" -ge "7.10.0.20150316"; then
369 # we didn't enable it before as it was not stable on all arches
370 cabalconf+=(--enable-shared)
371 # Known to break on ghc-7.8/Cabal-1.18
372 # https://ghc.haskell.org/trac/ghc/ticket/9625
373 cabalconf+=(--enable-executable-dynamic)
377 # --sysconfdir appeared in Cabal-1.18+
378 if ./setup configure --help | grep -q -- --sysconfdir; then
379 cabalconf+=(--sysconfdir="${EPREFIX}"/etc)
382 # appeared in Cabal-1.18+ (see '--disable-executable-stripping')
383 if ./setup configure --help | grep -q -- --disable-library-stripping; then
384 cabalconf+=(--disable-library-stripping)
388 --ghc --prefix="${EPREFIX}"/usr \
389 --with-compiler="$(ghc-getghc)" \
390 --with-hc-pkg="$(ghc-getghcpkg)" \
391 --prefix="${EPREFIX}"/usr \
392 --libdir="${EPREFIX}"/usr/$(get_libdir) \
393 --libsubdir=${P}/ghc-$(ghc-version) \
394 --datadir="${EPREFIX}"/usr/share/ \
395 --datasubdir=${P}/ghc-$(ghc-version) \
397 ${CABAL_CONFIGURE_FLAGS} \
398 ${CABAL_EXTRA_CONFIGURE_FLAGS} \
401 ./setup "$@" || cabal-show-brokens-and-die "setup configure failed"
405 set -- build ${CABAL_EXTRA_BUILD_FLAGS} "$@"
408 || die "setup build failed"
412 has "${EAPI:-0}" 0 1 2 && ! use prefix && ED=${D}
414 set -- copy --destdir="${D}" "$@"
416 ./setup "$@" || die "setup copy failed"
418 # cabal is a bit eager about creating dirs,
419 # so remove them if they are empty
420 rmdir "${ED}/usr/bin" 2> /dev/null
424 # This does not actually register since we're using true instead
425 # of ghc-pkg. So it just leaves the .conf file and we can
426 # register that ourselves (if it exists).
428 if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
429 # Newer cabal can generate a package conf for us:
430 ./setup register --gen-pkg-config="${T}/${P}.conf"
431 if [[ -d "${T}/${P}.conf" ]]; then
432 ghc-install-pkg "${T}/${P}.conf"/*
434 ghc-install-pkg "${T}/${P}.conf"
439 # Some cabal libs are bundled along with some versions of ghc
440 # eg filepath-1.0 comes with ghc-6.6.1
441 # by putting CABAL_CORE_LIB_GHC_PV="6.6.1" in an ebuild we are declaring that
442 # when building with this version of ghc, the ebuild is a dummy that is it will
443 # install no files since the package is already included with ghc.
444 # However portage still records the dependency and we can upgrade the package
445 # to a later one that's not included with ghc.
446 # You can also put a space separated list, eg CABAL_CORE_LIB_GHC_PV="6.6 6.6.1".
447 # Those versions are taken as-is from ghc `--numeric-version`.
448 # Package manager versions are also supported:
449 # CABAL_CORE_LIB_GHC_PV="7.10.* PM:7.8.4-r1".
450 cabal-is-dummy-lib() {
451 local bin_ghc_version=$(ghc-version)
452 local pm_ghc_version=$(ghc-pm-version)
454 for version in ${CABAL_CORE_LIB_GHC_PV}; do
455 [[ "${bin_ghc_version}" == ${version} ]] && return 0
456 [[ "${pm_ghc_version}" == ${version} ]] && return 0
462 # exported function: check if cabal is correctly installed for
463 # the currently active ghc (we cannot guarantee this with portage)
464 haskell-cabal_pkg_setup() {
465 if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
466 [[ ${RDEPEND} == *dev-lang/ghc* ]] || eqawarn "QA Notice: A library does not have runtime dependency on dev-lang/ghc."
468 if [[ -n "${CABAL_UNKNOWN}" ]]; then
469 eqawarn "QA Notice: Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}"
471 if cabal-is-dummy-lib; then
472 einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install."
476 haskell-cabal_src_configure() {
477 cabal-is-dummy-lib && return
479 pushd "${S}" > /dev/null || die
485 popd > /dev/null || die
488 # exported function: nice alias
489 cabal_src_configure() {
490 haskell-cabal_src_configure "$@"
493 # exported function: cabal-style bootstrap configure and compile
494 cabal_src_compile() {
495 # it's a common mistake when one bumps ebuild to EAPI="2" (and upper)
496 # and forgets to separate src_compile() to src_configure()/src_compile().
497 # Such error leads to default src_configure and we lose all passed flags.
498 if ! has "${EAPI:-0}" 0 1; then
500 for passed_flag in "$@"; do
501 [[ ${passed_flag} == --flags=* ]] && \
502 eqawarn "QA Notice: Cabal option '${passed_flag}' has effect only in src_configure()"
506 cabal-is-dummy-lib && return
508 has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@"
511 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
512 if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
513 if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then
514 # hoogle, hscolour and haddock
515 cabal-hoogle-hscolour-haddock
517 # haddock and hscolour
518 cabal-hscolour-haddock
521 if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then
530 if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
531 if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then
532 # hoogle and hscolour
533 cabal-hoogle-hscolour
539 if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then
547 haskell-cabal_src_compile() {
548 pushd "${S}" > /dev/null || die
550 cabal_src_compile "$@"
552 popd > /dev/null || die
555 haskell-cabal_src_test() {
558 pushd "${S}" > /dev/null || die
560 if cabal-is-dummy-lib; then
561 einfo ">>> No tests for dummy library: ${CATEGORY}/${PF}"
563 einfo ">>> Test phase [cabal test]: ${CATEGORY}/${PF}"
565 # '--show-details=streaming' appeared in Cabal-1.20
566 if ./setup test --help | grep -q -- "'streaming'"; then
567 cabaltest+=(--show-details=streaming)
572 ${CABAL_TEST_FLAGS} \
573 ${CABAL_EXTRA_TEST_FLAGS} \
576 ./setup "$@" || die "cabal test failed"
579 popd > /dev/null || die
582 # exported function: cabal-style copy and register
583 cabal_src_install() {
584 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
586 if ! cabal-is-dummy-lib; then
591 # create a dummy local package conf file for haskell-updater
592 # if it does not exist (dummy libraries and binaries w/o libraries)
593 local ghc_confdir_with_prefix="$(ghc-confdir)"
595 dodir ${ghc_confdir_with_prefix#${EPREFIX}}
596 local hint_db="${D}/$(ghc-confdir)"
597 local hint_file="${hint_db}/gentoo-empty-${CATEGORY}-${PF}.conf"
598 mkdir -p "${hint_db}" || die
599 touch "${hint_file}" || die
602 haskell-cabal_src_install() {
603 pushd "${S}" > /dev/null || die
607 popd > /dev/null || die
610 haskell-cabal_pkg_postinst() {
611 ghc-package_pkg_postinst
614 haskell-cabal_pkg_postrm() {
615 ghc-package_pkg_postrm
618 # @FUNCTION: cabal_flag
620 # ebuild.sh:use_enable() taken as base
624 # CABAL_CONFIGURE_FLAGS=$(cabal_flag gui)
625 # leads to "--flags=gui" or "--flags=-gui" (useflag 'gui')
627 # CABAL_CONFIGURE_FLAGS=$(cabal_flag gtk gui)
628 # also leads to "--flags=gui" or " --flags=-gui" (useflag 'gtk')
631 if [[ -z "$1" ]]; then
632 echo "!!! cabal_flag() called without a parameter." >&2
633 echo "!!! cabal_flag() <USEFLAG> [<cabal_flagname>]" >&2
640 echo "--flags=${UWORD}"
642 echo "--flags=-${UWORD}"
648 # @FUNCTION: cabal_chdeps
650 # Allows easier patching of $CABAL_FILE (${S}/${PN}.cabal by default)
653 # Accepts argument list as pairs of substitutions: <from-string> <to-string>...
661 # 'base >= 4.2 && < 4.6' 'base >= 4.2 && < 4.7' \
662 # 'containers ==0.4.*' 'containers >= 0.4 && < 0.6'
666 # CABAL_FILE=${S}/${MY_PN}.cabal cabal_chdeps \
667 # 'base >= 4.2 && < 4.6' 'base >= 4.2 && < 4.7'
668 # CABAL_FILE=${S}/${MY_PN}-tools.cabal cabal_chdeps \
669 # 'base == 3.*' 'base >= 4.2 && < 4.7'
673 local cabal_fn=${MY_PN:-${PN}}.cabal
674 local cf=${CABAL_FILE:-${S}/${cabal_fn}}
675 local from_ss # ss - substring
677 local orig_c # c - contents
680 [[ -f $cf ]] || die "cabal file '$cf' does not exist"
688 [[ -n ${from_pat} ]] || break
689 [[ -n ${to_str} ]] || die "'${from_str}' does not have 'to' part"
691 einfo "CHDEP: '${from_pat}' -> '${to_str}'"
693 # escape pattern-like symbols
694 from_pat=${from_pat//\*/\\*}
695 from_pat=${from_pat//\[/\\[}
697 new_c=${orig_c//${from_pat}/${to_str}}
699 if [[ -n $CABAL_DEBUG_LOOSENING ]]; then
700 echo "${orig_c}" >"${T}/${cf}".pre
701 echo "${new_c}" >"${T}/${cf}".post
702 diff -u "${T}/${cf}".{pre,post}
705 [[ "${orig_c}" == "${new_c}" ]] && die "no trigger for '${from_pat}'"
711 echo "${new_c}" > "$cf" ||
712 die "failed to update"
715 # @FUNCTION: cabal-constraint
717 # Allowes to set contraint to the libraries that are
718 # used by specified package
721 echo "--constraint \"$p == $v\""
722 done < $(ghc-pkgdeps ${1})
725 # @FUNCTION: replace-hcflags
726 # @USAGE: <old> <new>
728 # Replace the <old> flag with <new> in HCFLAGS. Accepts shell globs for <old>.
729 # The implementation is picked from flag-o-matic.eclass:replace-flags()
731 [[ $# != 2 ]] && die "Usage: replace-hcflags <old flag> <new flag>"
734 for f in ${HCFLAGS} ; do
735 # Note this should work with globs like -O*
736 if [[ ${f} == ${1} ]]; then
737 einfo "HCFLAGS: replacing '${f}' to '${2}'"
742 export HCFLAGS="${new[*]}"