Skip to content

Commit

Permalink
stack: force only system libs
Browse files Browse the repository at this point in the history
because macports' libiconv is free in the ${prefix}, it is
picked up opportunistically by the build of ghc.

macports version of libiconv is different than the system version
of libiconv. The bootstrap ghc compiler is built against the
system libiconv, and so requires linking against that version.

during the build of stack, pkg-config calls for the zlib.pc. In
macports, the zlib.pc file brings in flags that link against the
libraries in ${prefix}/lib, where libiconv is then found.

to get around this, bring in a modified zlib.pc that uses only
system paths. This forces the use of and link against the system
zlib, and prevents libiconv in the ${prefix} from being
opportunistically linked.
  • Loading branch information
kencu committed Nov 15, 2023
1 parent a89ddb9 commit d0c0bd7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lang/stack/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,10 @@ if { [variant_isset "prebuilt"] } {

depends_build-append port:pkgconfig

# use a modified zlib.pc that forces the system paths to be used
# this prevents -L${prefix}/lib from being added to the library link path
# which causes libiconv linkage errors
build.env-append PKG_CONFIG_PATH=${filespath}/zlibsystempkgconfig

set haskell_stack.bin ${workpath}/bin/stack
}
13 changes: 13 additions & 0 deletions lang/stack/files/zlibsystempkgconfig/zlib.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
includedir=${prefix}/include

Name: zlib
Description: zlib compression library
Version: 1.3

Requires:
Libs: -L${libdir} -L${sharedlibdir} -lz
Cflags: -I${includedir}

0 comments on commit d0c0bd7

Please sign in to comment.