Re: [Qbs] Module adding source files to a project

2019-11-28 Thread Alberto Mardegan
Hi Richard,

On 28/11/19 01:17, Richard Weickelt wrote:
> Ideally, I think, the user would just invoke some tool and use a prebuilt
> binary and not need to build the run-time from source. If building from
> source is required, let the user install AppImageKit somewhere and just
> point Qbs to the installation path in a property like shown below.

you know what? I have no idea what I was thinking about when writing my
e-mail :-)
Indeed, the AppImageKit project provides the appimagetool binary, which
is not unreasonable to require to be installed when someone wants to
create an AppImage. The appimage QBS module could use a Probe to locate
it, or allow the user to specify its location.

> Why do you need to build "runtime" from source? Is a prebuilt version not
> shipped together with AppImageKit or at least available here:
> https://github.com/AppImage/AppImageKit/releases ?

My biggest concern was with the CPU architecture, as I was assuming (I
didn't have an internet connection when I was thinking about this) that
the AppImageKit project wouldn't make binaries but for x86_64; this is
not the case, and binaries exist for all the most popular architectures.

Ciao,
  Alberto

-- 
http://www.mardy.it - Geek in un lingua international
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] Module adding source files to a project

2019-11-27 Thread Richard Weickelt
> Should the AppImageKit repository (or only the parts needed for building
> the runtime.c file) be imported into the QBS repository (maybe added as
> a git submodule)? Or should we fetch the sources at runtime?

Ideally, I think, the user would just invoke some tool and use a prebuilt
binary and not need to build the run-time from source. If building from
source is required, let the user install AppImageKit somewhere and just
point Qbs to the installation path in a property like shown below.

> Do we have examples of other modules having similar requirements?

Just a module would not be enough. You will need at least one separate
product item for the run-time binary. An appimage module makes sense if you
need common appimage properties in multiple product items, for instance the
AppImageKit install path.

>   I'd like to write a QBS module to package Linux applications into the
> AppImage format. This is a format in which the all application's files
> (and non-trivial dependencies) are packed into a single executable file,
> which, when executed, unpacks the application data by mounting into a
> squashfs filesystem and then executes the application's main binary.
> 
> The trick here is how to create the "loader" part of the binary: the
> AppImage project provides the source code, which consists of a C file
> [1] and all of its dependencies (a slightly modified version of
> libsquashfs, and a few other utility files), but it's not clear to me on
> what would be the best way to bring these files into one's project.

Why do you need to build "runtime" from source? Is a prebuilt version not
shipped together with AppImageKit or at least available here:
https://github.com/AppImage/AppImageKit/releases ?

Presuming that runtime.c is shipped with AppImageKit, there are probably
many ways to implement that. Here is a very naive idea of a product item
that does both: building the run-time binary as well as packaging up the
application bundle:

// AppImage.qbs
CppApplication {
type: [ "application", "appimage.runtime", "appimage.package ]
property string appImageKitInstallPath

Group {
name: "runtime"
prefix: appImageKitInstallPath + "/"
files:  [ "runtime.c" ]
}

// Have a look at
https://code.qt.io/cgit/qbs/qbs.git/tree/src/packages/archive/archive.qbs#n49
// The rule will need to depend on all all installables and
// appimage.runtime and will bake the run-time and the rest together
// into an artifact of type "appimage.package".
// You will specify the depencies later in yourproject.qbs
Rule {}
}

// yourproject.qbs
Project {
CppApplication { name: "yourapp"; /* ... */ }
AppImage {
appImageKitInstallPath: "/path/to/AppImageKit"
Depends { name: "yourapp" }
}
}

Maybe that gives you an idea how and where to start.

You could also create a AppImageRuntime product item and an AppImagePackage
product item to separate the two tasks better. And you could also implement
a module if these items have common properties or you could put all rules
into the module.

Richard
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


[Qbs] Module adding source files to a project

2019-11-27 Thread Alberto Mardegan
Hi there!
  I'd like to write a QBS module to package Linux applications into the
AppImage format. This is a format in which the all application's files
(and non-trivial dependencies) are packed into a single executable file,
which, when executed, unpacks the application data by mounting into a
squashfs filesystem and then executes the application's main binary.

The trick here is how to create the "loader" part of the binary: the
AppImage project provides the source code, which consists of a C file
[1] and all of its dependencies (a slightly modified version of
libsquashfs, and a few other utility files), but it's not clear to me on
what would be the best way to bring these files into one's project.

Should the AppImageKit repository (or only the parts needed for building
the runtime.c file) be imported into the QBS repository (maybe added as
a git submodule)? Or should we fetch the sources at runtime?

Do we have examples of other modules having similar requirements?

Ciao,
  Alberto


[1]: https://github.com/AppImage/AppImageKit/blob/master/src/runtime.c

-- 
http://www.mardy.it - Geek in un lingua international
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs