Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haskell toolchain for linux #386

Draft
wants to merge 5 commits into
base: LTS-2024
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/bootstrap/stage1/ghc/.hab-plan-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[rules]
license-not-found = {level = "off", source-shasum = "c4c0124857265926f1cf22a09d950d7ba989ff94053a4ddf3dcdab5359f4cab7"}
duplicate-runtime-binary = {level = "off"}
unused-runpath-entry = {level = "off"}
unused-dependency = { level = "off" }
67 changes: 67 additions & 0 deletions packages/bootstrap/stage1/ghc/plan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
pkg_name=ghc-stage1
pkg_origin=core
pkg_version=9.6.3
pkg_license=('BSD-3-Clause')
pkg_upstream_url="https://www.haskell.org/ghc/"
pkg_description="The Glasgow Haskell Compiler - Binary Bootstrap"
pkg_maintainer="The Habitat Maintainers <[email protected]>"
pkg_source="http://downloads.haskell.org/~ghc/${pkg_version}/ghc-${pkg_version}-x86_64-deb11-linux.tar.xz"
pkg_shasum="c4c0124857265926f1cf22a09d950d7ba989ff94053a4ddf3dcdab5359f4cab7"
pkg_dirname="ghc-${pkg_version}"

pkg_bin_dirs=(bin)
pkg_lib_dirs=(lib)
pkg_include_dirs=(include)
pkg_interpreters=(bin/runhaskell bin/runghc)

pkg_deps=(
core/glibc
core/gmp
core/libffi
core/ncurses
)

pkg_build_deps=(
core/gcc
core/make
core/build-tools-patchelf
)

do_unpack() {
do_default_unpack

mv ghc-${pkg_version}-x86_64-unknown-linux ${pkg_dirname}
}

do_build() {
./configure \
--prefix="${pkg_prefix}"
}

do_install() {
# make install
cp -r bin include lib wrappers "${pkg_prefix}"

# The ghc binary (ghc-${pkg_version}) requires libtinfo.so.6, which is not available
# in the current ncurses build because it was built with the --enable-widec option.
ln -sfv "$(pkg_path_for ncurses)/lib/libtinfow.so" "${pkg_prefix}/lib/x86_64-linux-ghc-${pkg_version}/libtinfo.so.6"

# export LD_RUN_PATH="${LD_RUN_PATH}:${pkg_prefix}/lib"
export LD_RUN_PATH="${LD_RUN_PATH}:${pkg_prefix}/lib/x86_64-linux-ghc-${pkg_version}"

build_line "Setting rpath for all binaries to '${LD_RUN_PATH}'"
find "${pkg_prefix}/bin" "${pkg_prefix}/lib/bin" -type f -executable \
-exec patchelf --set-interpreter "$(pkg_path_for glibc)/lib/ld-linux-x86-64.so.2" \
--set-rpath "${LD_RUN_PATH}" {} \;

build_line "Setting rpath for all libraries to '${LD_RUN_PATH}'"
find "${pkg_prefix}/lib" -type f -name "*.so" \
-exec patchelf --set-rpath "${LD_RUN_PATH}" {} \;

patchelf --set-rpath "$LD_RUN_PATH" ${pkg_prefix}/lib/x86_64-linux-ghc-${pkg_version}/libffi.so.8.1.2
patchelf --set-rpath "$LD_RUN_PATH" ${pkg_prefix}/lib/x86_64-linux-ghc-${pkg_version}/libffi.so.8
}

do_strip() {
return 0
}