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

Fix the need of staticlib target to have a build.rs customization #2

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
78 changes: 57 additions & 21 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions src/cabal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ custom-setup
setup-depends: Cabal, base, directory, process"
};

let lib_name = name.replace('-', "_"); // In library generated by Cargo, '-' is replaced by '_'
let package_name = name.replace('_', "-"); // Cabal does not expect '_' for packages names

let extra = if enable_nix {
format!(
"
-- `haskell.nix` tell GHC linker where to find the `libNAME.a` by setting
-- automatically `extra-lib-dirs`:
-- https://input-output-hk.github.io/haskell.nix/tutorials/pkg-map.html
extra-libraries: {name}
extra-libraries: {lib_name}

-- Cross-compilation to target `x86_64-w64-mingw32-cc` thrown a lot of
-- `undefined reference to 'X'` errors during linking stage ...
Expand All @@ -32,7 +35,7 @@ custom-setup
format!(
"
-- Libraries that are bundled with the package.
extra-bundled-libraries: {name}"
extra-bundled-libraries: {lib_name}"
)
};

Expand All @@ -49,7 +52,7 @@ custom-setup
-- documentation, see: http://haskell.org/cabal/users-guide/
--
-- The name of the package.
name: {name}
name: {package_name}

-- The package version.
-- See the Haskell package versioning policy (PVP) for standards
Expand Down
Loading