Is it possible to define an ubuntu package as a part?

Hello, I already have a project that builds with make. Underneath, it depends on dub, ldc2, libcurl3, libgtk3-dev.

Discovering compilation recipe is a bit of a daunting task for me. But all my required packages are readily available in Ubuntu 20.04 repo. Is it possible to add an Ubuntu package as a part? If so, could you show me an example snippet?

you likely want build-packages and stage-packages. The first is for packages that you need available to build your app, while the second is for packages that are needed to execute your app. In Ubuntu dependency packages are often split into a -dev and a library package, so for example, libcurl4 is split with libcurl4 and libcurl4-openssl-dev.

The following part is what you want to aim for:

parts:
  my-app:
    source: your-source-files-location
    plugin: make
    build-packages:
      - dub
      - ldc
      - libcurl4-openssl-dev
      - libgtk-3-dev
    stage-packages:
      - libcurl4
      - libgtk-3-0

You might prefer to use the gnome-3-28 extension, which is based on core18, to ensure your app loads the relevant environment for a graphical app:

apps:
  my-app:
    command: path/to/my-app
    desktop: path/to/desktop-file # not necessary. e.g. if you put the desktop file in snap/gui/ then you can omit this line.
    extensions: [gnome-3-28]
    plugs:
      - desktop
      - desktop-legacy
      - x11 # these plugs are examples. you might get away without specifying any at all
1 Like

That’s great!

I must ask, now that I have dub installed in the snap, can I bypass the make and build the application with just dub?

The build command is dub build -b release