LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-04-2003, 06:36 AM   #1
mad_ady
Member
 
Registered: Jan 2003
Location: I'm all in your mind!
Distribution: Debian
Posts: 248

Rep: Reputation: 30
Where to install?


I have created an application (ok, it's still beta.... ) and I want to install it in a linux system. The user would issue a

make
make install

The thing is... I don't know where to copy the files...
The application has the following files:
1 executable
1 database (that I would prefer to be in a .../Dat/ folder)
some help files (html)
maybe an icon or two...

The executable currently searches for its database in Dat/database.dat. If I move the executable to something like /bin and the database somewhere else, it would be harder to find...

Where are the default install paths? And how can I make it run, even if the user doesn't install to the default path?

The code uses QT

Thanks in advance
 
Old 06-04-2003, 08:10 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
I've had the same problem with a little Qt based game, which I made as a learning project for programming in Linux to get to know g++, Qt, automake, autoconf, emacs, gdb, etc.

This game wants to find some pixmap files, which by default get installed in a subdir of /usr/local/share. But when the installing person changes the installation dir with "./configure --prefix=..." the pixmaps get installed in some other place. Also, I wanted the game to be able to find it's pixmaps even without being installed.

I solved it by making the program search for it's pixmaps in this order:

1) from an specific environment variable, if it is set.

2) from various paths relative to the source directory. (the dir where the program was compiled). This to make it possible to run the program from the source dir (not-installed). The source dir known through a string #defined by the configure script. (so this path is hardcoded into the executable.)

3) from the path relative to the path of the running executable. It tries to determine by reading the "_" env. var. which some shell set to the path of the current process. If that doesn't work it tries to find it through argv[0].

4) from the full path to the datadir as #defined by the configure script.

You can find this "learning project" at http://qleuren.sf.net/.
The source file that handles this searching for the pixmaps is src/tdir.cpp.
If you run ./configure this way:

bash$ CXXFLAGS=-DDBG ./configure

then the program will tell on stdout where it get the pixmap files from, and how it found them.

I still think this is not a very clean way. If anybody has a better idea to solve this, I would be interested.

Last edited by Hko; 06-04-2003 at 08:11 AM.
 
Old 06-04-2003, 09:34 AM   #3
mhearn
LQ Guru
 
Registered: Nov 2002
Location: Durham, England
Distribution: Fedora Core 4
Posts: 1,565

Rep: Reputation: 57
We are working on this at autopackage HQ - see the libprefixdb discussions.
 
Old 06-05-2003, 02:08 AM   #4
mad_ady
Member
 
Registered: Jan 2003
Location: I'm all in your mind!
Distribution: Debian
Posts: 248

Original Poster
Rep: Reputation: 30
Hko, thanks for your reply, but there's one problem... When compiling my program, the user doesn't issue a ./configure. I have programmed it entirely in qt and it automatically generates the necessary makefiles. So I only have to issue a make and make install.
This is why I think all the possible paths to the database will have to be hardcoded...
I'll take a look on your source files... Thanks loads
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
fc3 install doesnt install grub properly onto sata drive sabo Linux - Newbie 4 02-03-2007 04:04 PM
make install does not install daemons (clamd snortd). Is this a feature of tarball? Emmanuel_uk Linux - Newbie 3 11-15-2005 01:29 AM
Error: Unable to boot /install/2.6/linux when starting Etch Install BuckRogers01 Debian 4 08-06-2005 06:40 PM
How do I re-install an operatingsystem? Corrupted install. Yast wont load. URGENT.thx CrewXp SUSE / openSUSE 5 05-09-2005 12:07 AM
Ok, dumb question. If I install a Mandrake kernel RPM, where does it install to? Kramer Linux - General 6 01-13-2004 09:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration