Skip to content

Commit

Permalink
cabal: Update to version 3.14.1.1; Fix build issue in PG haskell_cabal
Browse files Browse the repository at this point in the history
  • Loading branch information
essandess committed Jan 18, 2025
1 parent a12b49f commit a9c767e
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 30 deletions.
45 changes: 33 additions & 12 deletions _resources/port1.0/group/haskell_cabal-1.0.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ proc haskell_cabal.add_dependencies {} {
depends_patch-append \
port:cabal-prebuilt \
port:ghc-prebuilt
depends_build-append \
depends_lib-append \
port:cabal-prebuilt \
port:ghc-prebuilt
} else {
depends_patch-append \
port:cabal
depends_build-append \
port:cabal \
port:ghc
depends_lib-append \
port:cabal \
port:ghc \
port:gmp \
port:libiconv
}
Expand Down Expand Up @@ -86,6 +86,9 @@ proc haskell_cabal.get_env {} {
options haskell_cabal.cabal_root
default haskell_cabal.cabal_root {${workpath}/.home/.cabal}

# https://github.com/haskell/cabal/issues/10755
# disable --enable-relocatable until this issue is addressed

post-patch {
xinstall -m 0755 -d [option haskell_cabal.cabal_root]
set cabal_config_fd [open ${haskell_cabal.cabal_root}/config w+]
Expand Down Expand Up @@ -121,12 +124,12 @@ post-patch {
"jobs: \$ncpus" \
"documentation: True" \
"doc-index-file: \$htmldir/html/${subport}/index.html" \
"relocatable: True" \
"relocatable: False" \
"install-method: copy" \
"installdir: ${prefix}/bin" \
"logs-dir: [option haskell_cabal.cabal_root]/logs" \
"store-dir: [option haskell_cabal.cabal_root]/store" \
"" \
"installdir: ${prefix}/bin" \
"install-dirs global" \
" prefix: ${prefix}" \
" bindir: ${prefix}/bin" \
Expand Down Expand Up @@ -155,6 +158,7 @@ supported_archs arm64 x86_64
options haskell_cabal.bin \
haskell_cabal.env \
haskell_cabal.global_flags \
haskell_cabal.update_flags \
haskell_cabal.build_dir \
haskell_cabal.use_prebuilt \
haskell_cabal.installsubdir \
Expand All @@ -177,8 +181,17 @@ default haskell_cabal.bin {[haskell_cabal.getcabalbin]}
default haskell_cabal.env \
{[haskell_cabal.get_env]}

default haskell_cabal.global_flags \
{--config-file=[option haskell_cabal.cabal_root]/config}
default haskell_cabal.global_flags {\
--config-file=[option haskell_cabal.cabal_root]/config\
--store-dir=[option haskell_cabal.cabal_root]/store\
}

default haskell_cabal.update_flags {\
--ghc\
--with-compiler=${prefix}/bin/ghc\
--prefix=${prefix}\
${haskell_cabal.installdir_args}\
}

default haskell_cabal.build_dir {${workpath}/dist}

Expand Down Expand Up @@ -206,7 +219,7 @@ post-patch {
if {[tbool haskell_cabal.use_prebuilt]} {
xinstall -d ${haskell_cabal.cabal_root}/bin
# bootstrap from *-prebuilt
# the link to exedir_prebuilt got ghc and ghc-pkg is a hac
# the link to exedir_prebuilt got ghc and ghc-pkg is a hack
# to accommodate cabal's hack method of locating ghc-pkg
# https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.6.1.0.md
set ghc_prebuilt_version \
Expand Down Expand Up @@ -236,13 +249,17 @@ post-patch {

pre-configure {
system -W ${worksrcpath} \
"env ${haskell_cabal.env} ${haskell_cabal.bin} ${haskell_cabal.global_flags} update"
"env ${haskell_cabal.env} ${haskell_cabal.bin} ${haskell_cabal.global_flags} update ${haskell_cabal.update_flags}"
}

use_configure no
default configure.cmd {${haskell_cabal.bin}\
${haskell_cabal.global_flags}}
default configure.pre_args {}
default configure.args {configure}
default configure.args {\
configure\
${haskell_cabal.installdir_args}\
}
default configure.universal_args {}
default configure.env {${haskell_cabal.env}}

Expand All @@ -255,10 +272,12 @@ default build.args {${build.target}}
default build.post_args {\
[haskell_cabal.build_getjobsarg]\
--builddir=${haskell_cabal.build_dir}\
--ghc\
--with-compiler=${prefix}/bin/ghc\
--prefix=${prefix}\
${haskell_cabal.installdir_args}\
--enable-relocatable\
}
# --enable-relocatable
default build.env {${haskell_cabal.env}}

default destroot.cmd {${haskell_cabal.bin}\
Expand All @@ -269,11 +288,13 @@ default destroot.args {${destroot.target}}
default destroot.post_args {\
[haskell_cabal.build_getjobsarg]\
--builddir=${haskell_cabal.build_dir}\
--ghc\
--with-compiler=${prefix}/bin/ghc\
--installdir=${destroot}${prefix}/bin\
--install-method=copy\
--enable-relocatable\
--overwrite-policy=always\
}
# --enable-relocatable
default destroot.env {${haskell_cabal.env}}

default test.cmd {${haskell_cabal.bin}\
Expand Down
47 changes: 29 additions & 18 deletions lang/cabal/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
PortSystem 1.0

name cabal
version 3.10.3.0
version 3.14.1.1
revision 0
categories lang haskell devel
platforms darwin
license BSD
maintainers {ieee.org:s.t.smith @essandess} openmaintainer

Expand Down Expand Up @@ -59,18 +58,19 @@ set distfile_haskell ${cabal_distname}.tar.xz
distfiles ${distfile_haskell}:haskell

# set build_arch by hand on arm64/x86_64 systems to get x86_64/arm64 checksums
# sudo port -d checksum cabal-prebuilt os.arch=i386 build_arch=x86_64
# sudo port -d checksum cabal-prebuilt os.arch=arm build_arch=arm64
# run `port clean --all cabal-prebuilt` afterwards
if {${build_arch} eq {arm64}} {
checksums ${distfile_haskell} \
rmd160 2ba95f233a0ec06d6a2fcef1783fa6bbef7d4066 \
sha256 f4f606b1488a4b24c238f7e09619959eed89c550ed8f8478b350643f652dc08c \
size 11676488
rmd160 65b2c1d87a22c59da3e58d6f9e03f91671f83a8b \
sha256 bd40920fb3d5bcf3d78ce93445039ba43bc5edf769c52234223f25b83e3cc682 \
size 12728880
} elseif {${build_arch} eq {x86_64}} {
checksums ${distfile_haskell} \
rmd160 4b44b2fea41b91cd08e94957a414ecc8e5ed7778 \
sha256 3aed78619b2164dd61eb61afb024073ae2c50f6655fa60fcc1080980693e3220 \
size 5623520
rmd160 d4b3a14b37d0b56964354550cfb48a1848be6e3c \
sha256 3690d8f7aa368141574f9eaf8e75bc26932ed7b422f5ade107d6972b3b72532f \
size 6065364
}

# cabal may use these MacPorts build tools:
Expand All @@ -94,15 +94,15 @@ if {${name} eq ${subport}} {
master_sites https://github.com/haskell/${name}/archive/refs/tags:github
distfiles ${distfile_github}:github
checksums ${distfile_github} \
rmd160 d72a00040f2b717de39e1b2386e81d86cc44c06f \
sha256 29d622886624f72f1c5be1fb385b1eb612a72e487c2c91ca8cbefb84abdbf352 \
size 2285154
rmd160 667727335b6372a7b927d3bdf016cd2db631a339 \
sha256 c5d3e5bdf78c2fce9f6b48d31d4561ef151587fc3c102e57a3c4b341578a836a \
size 3638559

extract.only-append \
${distfile_github}
if {[exists extract.rename]} {
extract.rename yes
}
if {[exists extract.rename]} {
extract.rename yes
}
variant prebuilt \
description {This variant is deprecated.} {
ui_error "Please install the port ${name}-prebuilt."
Expand All @@ -111,7 +111,7 @@ if {[exists extract.rename]} {

# use these to specify python versions, python3 required
# use ${prefix}/var/macports/sources/rsync.macports.org/macports/release/tarballs/ports/_resources/port1.0/group/python-1.0.tcl
set python3_version 312
set python3_version 313
set python3_branch [string index ${python3_version} 0].[string range ${python3_version} 1 end]
set python3_prefix ${frameworks_dir}/Python.framework/Versions/${python3_branch}
set python3_bin ${python3_prefix}/bin/python${python3_branch}
Expand Down Expand Up @@ -155,19 +155,27 @@ if {[exists extract.rename]} {
"CABAL_CONFIG=${haskell_cabal.cabal_root}/config" \
"GHC=${prefix}/bin/ghc"

set project_file cabal.release.project

haskell_cabal.update_flags-append \
--project-file=${project_file}

build.target ${name}-install \
--project-file=cabal.project.release
--project-file=${project_file}
build.post_args-append \
--bindir=${prefix}/bin \
--datadir=${prefix}/share/${subport}

--datadir=${prefix}/share/${subport} \
--allow-newer
post-build {
# https://github.com/haskell/cabal/blob/c1f490a50782cc89030889fae8edd9f95db7c1e4/Makefile#L207
system -W ${worksrcpath} \
"sphinx-build-${python3_branch} -n --keep-going -E\
doc ${haskell_cabal.build_dir}/doc/users-guide"
}

destroot.post_args-append \
--allow-newer

post-destroot {
xinstall -d ${destroot}${prefix}/share/doc/${distname}

Expand Down Expand Up @@ -203,3 +211,6 @@ subport cabal-prebuilt {
It is intended to be used to bootstrap ghc and other Haskell-based tools.
"
}

livecheck.url https://github.com/haskell/${name}/tags
livecheck.regex "archive/refs/tags/${name}\-install\-v(\[^\"\]+)\.tar\.gz"

0 comments on commit a9c767e

Please sign in to comment.