Search code examples
valagnome-builder

Gnome Builder. How to include a package?


I'm trying to find my feet with Gnome Builder and Vala and create a simple helper application for work. I need to do a basic http GET and so I'm trying to experiment with Soup however I'm coming unstuck with how to tell Builder to use the libsoup package, because right now any reference in the code to Soup results in error 'The symbol Soup could not be found'. All I've done so far is copied and pasted some sample Soup code. Does anyone know how can I tell Builder to use libsoup (or any other package/library)? Thanks!


Solution

  • This is a buildsystem-related issue as you don't have libsoup-2.4 included in the default Autotools layout Builder uses.

    Let me suggest you Meson which is supported in GNOME Builder and will be much less of a burden to learn.

    Include a meson.build file containing the following:

    project ('your-app', 'c', 'vala')
    
    glib_dep = dependency('glib-2.0')
    gobject_dep = dependency('gobject-2.0')
    soup_dep = dependency('libsoup-2.4')
    
    executable('your-app', 'your-app.vala', 
               dependencies: [glib_dep, gobject_dep, soup_dep])
    

    Open the meson.build file using "Open Project" in the main menu and launch typical configure/build steps from the header bar.