Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5930947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:37:31+00:00 2026-05-22T14:37:31+00:00

I have a working SDL/Haskell application that I would like to build using Cabal

  • 0

I have a working SDL/Haskell application that I would like to build using Cabal instead of the current Makefile (because that is the “Haskell way”). The Makefile is itself very simple, and I was hoping that the default cabal build process could allow me to reconstruct a build command specified in my Makefile. The problem is that it makes use of “sdl-config”, a utility that gives you all the necessary cc- compiler options:

wrapper.o: SDLWrapper_stub.h
    ghc -no-hs-main `sdl-config --cflags` -Wall wrapper.c -c

Cabal does not seem to expand that into a shell call when calling GHC. How can I specify that sdl-config’s options should be fed into GHC when compiling wrapper.o?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:37:32+00:00Added an answer on May 22, 2026 at 2:37 pm

    Using the configure style in Cabal, you can write a little configure script that substitutes a variable for the output of the sdl-config command. The values will then be replaced in a $foo.buildinfo.in file, yielding a $foo.buildinfo file, that Cabal will include in the build process.

    General solution: the configure script

     #!/bin/sh
    
     SDLFLAGS=`sdl-config --cflags`
     echo Found "$SDLFLAGS"
     sed 's,@SDLFLAGS@,'"$SDLFLAGS"',' z.buildinfo.in > z.buildinfo       
    

    The $foo.builinfo.in file

    cc-options: @SDLFLAGS@
    

    The .cabal file

    Build-type:          Configure
    

    When you run "cabal configure" the "cc-options" field in z.buildinfo will be created to hold:

    cc-options: -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT 
    

    which cabal will include in the build.

    Done.

    Specific solution for pkg-config tools

    For tools that support the pkg-config-style of configuration, such as sdl or cairo and others, Cabal has specific support already:

    pkgconfig-depends: package list

    A list of pkg-config packages, needed to build this package. They can be annotated with versions, e.g. gtk+-2.0 >= 2.10, cairo >= 1.0. If no version constraint is specified, any version is assumed to be acceptable. Cabal uses pkg-config to find if the packages are available on the system and to find the extra compilation and linker options needed to use the packages.

    If you need to bind to a C library that supports pkg-config (use pkg-config –list-all to find out if it is supported) then it is much preferable to use this field rather than hard code options into the other fields.

    So for sdl you just need:

    pkgconfig-depends: sdl
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this function in Haskell (I am using the Haskell-SDL library): pixel ::
I have been working on a C++ project that uses SDL, and wonder if
I'm working on some cross-platform code using OpenGL and SDL, but have immediately run
I have working code that opens up a word document programmatically using vbscript, makes
I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#)
I have been working with a string[] array in C# that gets returned from
I have been working on some legacy C++ code that uses variable length structures
I have a working copy of my project, checked out using Subversion 1.5.1. When
I have working with email option. i can send the Email using the intent
I have working code using the spring-ws library to respond to soap requests. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.