Stack project, dependency with build flags

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Stack project, dependency with build flags

John Z.
Hi everyone,
    I'll try with tl:dr; first:
    I have a project with a dependency that -on my system- needs a build
    flag, in order to correctly link against its native dependencies.
    What is a proper way to set up a project like this?

    A longer explanation:
    My project uses `ncurses` library and I'm running Arch. There seems
    to be some religious opinion going around about the layout of
    ncurses headers in /usr/include, and -naturally- Arch and `ncurses`
    disagree. Fortunately, author of `ncurses` included a build flag to
    allow (easy) build on systems which follow the 'wrong' layout.
   
    Thing is, I couldn't figure out how to add this configuration to the
    .cabal of my own project, so for now, I'm stuck with a Makefile that
    invokes `stack` commands with `--flag ncurses:force-narrow-library`.
    I looked in the manual and there doesn't seem to be a way to handle
    this aside the commandline argument.

    So this got me thinking - is there a different way projects like
    these are supposed to be organized? For example, am I supposed to
    check out `ncurses` as a submodule of my project, then replicate
    this build flag on my own project and 'pass it down' somehow?

    Any tips are highly appreciated; I'm really not proficient with
    organizing stack projects properly.

    Cheers!


       
--
"That gum you like is going to come back in style."
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: Stack project, dependency with build flags

Michael Snoyman
IIUC, you can set additional flags in your stack.yaml file:

flags:
  ncurses:
    flagname: true # or false

On Wed, Sep 5, 2018 at 7:35 PM John Z. <[hidden email]> wrote:
Hi everyone,
    I'll try with tl:dr; first:
    I have a project with a dependency that -on my system- needs a build
    flag, in order to correctly link against its native dependencies.
    What is a proper way to set up a project like this?

    A longer explanation:
    My project uses `ncurses` library and I'm running Arch. There seems
    to be some religious opinion going around about the layout of
    ncurses headers in /usr/include, and -naturally- Arch and `ncurses`
    disagree. Fortunately, author of `ncurses` included a build flag to
    allow (easy) build on systems which follow the 'wrong' layout.

    Thing is, I couldn't figure out how to add this configuration to the
    .cabal of my own project, so for now, I'm stuck with a Makefile that
    invokes `stack` commands with `--flag ncurses:force-narrow-library`.
    I looked in the manual and there doesn't seem to be a way to handle
    this aside the commandline argument.

    So this got me thinking - is there a different way projects like
    these are supposed to be organized? For example, am I supposed to
    check out `ncurses` as a submodule of my project, then replicate
    this build flag on my own project and 'pass it down' somehow?

    Any tips are highly appreciated; I'm really not proficient with
    organizing stack projects properly.

    Cheers!



--
"That gum you like is going to come back in style."
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: Stack project, dependency with build flags

John Z.
> IIUC, you can set additional flags in your stack.yaml file:
>
> flags:
>   ncurses:
>     flagname: true # or false
>

Thank you, that was exactly what I needed. I wasn't aware there's a
`flags` section in stack.yaml.


--
"That gum you like is going to come back in style."
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: Stack project, dependency with build flags

Michael Snoyman
No problem.

On Thu, Sep 6, 2018 at 3:51 PM John Z. <[hidden email]> wrote:
> IIUC, you can set additional flags in your stack.yaml file:
>
> flags:
>   ncurses:
>     flagname: true # or false
>

Thank you, that was exactly what I needed. I wasn't aware there's a
`flags` section in stack.yaml.


--
"That gum you like is going to come back in style."
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: Stack project, dependency with build flags

Saurabh Nanda
Additionally you can also pass these flags via the command line. You might have to keep a different set of flags in your git repo, and use a different set of flags for your local dev.

I had a similar problem with hlibsass and mac os. 

On Thu 6 Sep, 2018, 8:30 PM Michael Snoyman, <[hidden email]> wrote:
No problem.

On Thu, Sep 6, 2018 at 3:51 PM John Z. <[hidden email]> wrote:
> IIUC, you can set additional flags in your stack.yaml file:
>
> flags:
>   ncurses:
>     flagname: true # or false
>

Thank you, that was exactly what I needed. I wasn't aware there's a
`flags` section in stack.yaml.


--
"That gum you like is going to come back in style."
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.