Pablo Walters
Posts: 20
Joined: Sun Nov 27, 2016 6:21 am

How can I package an application for distribution?

Tue Nov 29, 2016 10:37 am

I want to make it easy for users to install my app with an icon, resources, and execuable. This is a small graphics app that uses OpenGL and runs in an X window.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6228
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: How can I package an application for distribution?

Tue Nov 29, 2016 10:50 am


Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: How can I package an application for distribution?

Tue Nov 29, 2016 11:13 am

Personally I would not want to make such an application into a debian package. Not unless you want to actually want to get it accepted into the Debian repositories and then maintain it in Debian forever.

Why not just make a compressed archive out of the thing:

$ tar -xczf myApp.tgz myAppDirectory

Then the user only needs to unpack that.

One could include an installation script in the package that copies the files to some suitable place and perhaps sets up a PATH for the it and put any icon in the right place for the window manager.

I like to install such things into /opt rather than mixing them up with the main OS binaries and libraries.

Better idea is to just publish the thing as source code on github and let people clone the repository from there. The install instruction only need tell them how to compile it. This might not be suitable of you app is horrible complicated to build though.
Memory in C++ is a leaky abstraction .

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6228
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: How can I package an application for distribution?

Tue Nov 29, 2016 11:27 am

I would definitely prefer properly packaged software rather than files scattered around the filesystem which I have to keep track of.

Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: How can I package an application for distribution?

Tue Nov 29, 2016 12:23 pm

Who said anything about "files scattered around".

It's a common practice to put all the applications files under a directory in /opt. Things like Google Chrome and Firefox do that.

In a way it's neater than splattering files all over /usr/bin, /usr/lib, etc etc. And it save polluting your actual operating system files and it's dependency database.

Not only that it makes it possible to have the same installation work on systems other than Debian.
Memory in C++ is a leaky abstraction .

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6228
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: How can I package an application for distribution?

Tue Nov 29, 2016 12:31 pm

Heater wrote:Who said anything about "files scattered around".

It's a common practice to put all the applications files under a directory in /opt. Things like Google Chrome and Firefox do that.

In a way it's neater than splattering files all over /usr/bin, /usr/lib, etc etc. And it save polluting your actual operating system files and it's dependency database.

Not only that it makes it possible to have the same installation work on systems other than Debian.
I'll agree to disagree on all of that.

User avatar
r3d4
Posts: 982
Joined: Sat Jul 30, 2011 8:21 am
Location: ./

Re: How can I package an application for distribution?

Tue Nov 29, 2016 12:35 pm

Heater wrote: Why not just make a compressed archive out of the thing:

$ tar -xczf myApp.tgz myAppDirectory

Then the user only needs to unpack that.
that... and perhaps install the corect version of any missing Dependencys ...

Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: How can I package an application for distribution?

Tue Nov 29, 2016 1:38 pm

@ShiftPlusOne,
I'll agree to disagree on all of that.
Disagreement is more than welcome. It would be nice if you gave your reasons for disagreeing though.

How can we know how wrong you are for disagreeing otherwise? :)

@r3d4,
that... and perhaps install the corect version of any missing Dependencys ...
This is where life gets messy.

There is no reason an install script can't do the necessary "apt-get install..." of required packages.

Personally I would rather the installation instructions just stated what is required so that I can install them manually.

If the app requires versions of things that are not available in the standard repositories for your OS I'd rather they came bundled in the package and installed in /opt.

The last thing I like to see is have standard parts of my OS messed around with by some application installation.

The very last thing I like to see is instructions to add some alien repository to /apt/sources to install an app. That is the road to getting your whole OS installation blown to hell. Certainly a security problem.
Memory in C++ is a leaky abstraction .

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6228
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: How can I package an application for distribution?

Tue Nov 29, 2016 1:57 pm

Heater wrote:@ShiftPlusOne,
I'll agree to disagree on all of that.
Disagreement is more than welcome. It would be nice if you gave your reasons for disagreeing though.

How can we know how wrong you are for disagreeing otherwise? :)
I would if it was of any real consequence or if I wanted to kill some time. Pick your battles and all that.

Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: How can I package an application for distribution?

Tue Nov 29, 2016 2:10 pm

It is of real consequence to our opening poster!
Memory in C++ is a leaky abstraction .

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6228
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: How can I package an application for distribution?

Tue Nov 29, 2016 2:17 pm

Not so much if both are valid options.

gkreidl
Posts: 6307
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: How can I package an application for distribution?

Tue Nov 29, 2016 3:29 pm

There's a simple way to create a deb package using checkinstall, using something like this
sudo checkinstall make install
A bit of manual editing (interactively) is needed for configuration.

If you add all dependencies the user can install the package with gdebi (instead of dpkg) and it will install all dependencies (similar to apt-get).
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Pablo Walters
Posts: 20
Joined: Sun Nov 27, 2016 6:21 am

Re: How can I package an application for distribution?

Tue Nov 29, 2016 4:18 pm

Where is a good place to write application specific temp data?

For iOS, OSX, and adroid apps there is a nice sand boxed temp directory
associated with each app.

Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: How can I package an application for distribution?

Tue Nov 29, 2016 4:37 pm

Just stick it in /tmp.

Create temp files with the name of your program and a uuid. For example Microsoft's Visual Studio Code for Linux creates temp files like:

vscode-3b454d918ef7ff2cee662f266cc48c63b94c019e.sock

Note that Visual Studio Code is installed from a tar archive and an install script!
Memory in C++ is a leaky abstraction .

ejolson
Posts: 5202
Joined: Tue Mar 18, 2014 11:47 am

Re: How can I package an application for distribution?

Tue Nov 29, 2016 4:50 pm

Pablo Walters wrote:Where is a good place to write application specific temp data?

For iOS, OSX, and adroid apps there is a nice sand boxed temp directory
associated with each app.
Firefox, creates a cache subdirectory in the user's home directory. The difficulty is when the home directory is shared through NFS and the user wants to run Firefox simultaneously on two separate machines. Creating a cache in /tmp is also reasonable, but care needs to be taken with race conditions so the directory is owned by the correct user and really in the right place. In Linux and any multi-user multi-tasking system, different users expect to be able to simultaneously run the program and multiple logins of the same user expect to be able to run multiple copies. These difficulties are mitigated in Android and iOS by only allowing a single user to log in once and run only one copy of each program.

Pablo Walters
Posts: 20
Joined: Sun Nov 27, 2016 6:21 am

Re: How can I package an application for distribution?

Wed Nov 30, 2016 11:31 am

Ok. I''ll install the app in /opt and make a temp directory in /tmp/ with the name
of the app in it.

What's the best way of adding my app directory to the PATH when installing?

How can I make an icon for the app and install that in the right place for the window manager?

Is there a way to automatically create a link on the desktop to my app when it is installed?

gkreidl
Posts: 6307
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: How can I package an application for distribution?

Wed Nov 30, 2016 11:50 am

Pablo Walters wrote:Ok. I''ll install the app in /opt and make a temp directory in /tmp/ with the name
of the app in it.

What's the best way of adding my app directory to the PATH when installing?

How can I make an icon for the app and install that in the right place for the window manager?

Is there a way to automatically create a link on the desktop to my app when it is installed?
It's much easier to install application binaries in /usr/bin or /usr/local/bin.
You should create a desktop file in /usr/share/applications and a debian menu file in /usr/share/menu. This way you can call your app from the LXDE applications menu and also from a Debian menu (OpenBox, Awesome and other window managers).
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Pablo Walters
Posts: 20
Joined: Sun Nov 27, 2016 6:21 am

Re: How can I package an application for distribution?

Wed Nov 30, 2016 3:38 pm

If I install my application binaries in /usr/bin or /usr/local/bin, where
is a good place to install bitmap images and other resources the app
needs?

Should I compile all that data into the app, or can I install a directory
somewhere with the data?

Heater
Posts: 15838
Joined: Tue Jul 17, 2012 3:02 pm

Re: How can I package an application for distribution?

Wed Nov 30, 2016 3:51 pm

This is a good reason to keep it simple and put everything under a directory in /opt rather than cluttering up the OS directories.

If you are starting the app from a desktop menu or icon the path to execute is in the desktop file so no messing with PATH is required.
Memory in C++ is a leaky abstraction .

Pablo Walters
Posts: 20
Joined: Sun Nov 27, 2016 6:21 am

Re: How can I package an application for distribution?

Thu Dec 01, 2016 1:33 pm

Thanks for all the help! I got it all working fine. Here's a github

repository with the project.

https://github.com/PaulHaeberli/EnvMap3d-Raspberry-PI

I hope to make the source code for this available soon.

Also working on making it work with the desktop GL driver turned on.

Return to “General programming discussion”