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

The .cabal file mangling in android/impl.nix is fragile #494

Open
nomeata opened this issue May 11, 2019 · 2 comments
Open

The .cabal file mangling in android/impl.nix is fragile #494

nomeata opened this issue May 11, 2019 · 2 comments

Comments

@nomeata
Copy link
Contributor

nomeata commented May 11, 2019

I was just staring at an odd error

Setup: No 'main-is' field found for executable libkaleidogen.so

No 'main-is' field found for executable libkaleidogen-sdl.so

No 'main-is' field found for executable libkaleidogen-android.so

and it took me some sleuthing to find out that there is a sed script in

sed -i 's%^executable *\(.*\)$%executable lib\1.so\n cc-options: -shared -fPIC\n ld-options: -shared -Wl,--gc-sections,--version-script=${./haskellActivity.version},-u,Java_systems_obsidian_HaskellActivity_haskellStartMain,-u,hs_main\n ghc-options: -shared -fPIC -threaded -no-hs-main -lHSrts_thr -lCffi -lm -llog%i' *.cabal
that only works if the executable section is indented by two spaces (I had four).

Not sure what an easy solution is. But maybe add an echo after the sed saying “Mangling .cabal file to produce android libraries” so leave a breadcrumb for debugging.

@ryantrinkle
Copy link
Member

Ah wow, sorry about that! Yes, we should make it more debuggable, and I do wonder if there's a better way to do it. Maybe we can write a Haskell script that parses the file with cabal, mangles it, and then produces the new version with cabal?

@nomeata
Copy link
Contributor Author

nomeata commented May 11, 2019

You could probably use a multi-line regex to match on the header for executable and the indent of the next non-empty line, and use that. Still fragile and hacky, but pushes the line a bit further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants