4

I use Slackware Linux and I install most applications from the source. I would like to know how to manage the source files, specially the header files, so they are available to other applications.

Zelda
  • 6,262
  • 1
  • 23
  • 28
fdisk
  • 155
  • 1
    I'm not a Slackware user, but generally headers go under /usr/include or /usr/local/include. There should also be a /usr/src and /usr/local/src where you can put the source code. – Bakuriu Nov 22 '12 at 19:30
  • Thanks, I knew about the folders /usr/src and /usr/local/src but I didnt know about the include folders. It seems that the system does not have those folders in the PATH thus I thought the .h files where no installed. – fdisk Nov 22 '12 at 19:45
  • The PATH variable is only used to search for executables. Libraries are searched in a different set of directories and headers in yet an other set. If you use gcc there is an option -print-search-dirs that prints the default paths. – Bakuriu Nov 22 '12 at 23:29
  • @Bakuriu: Thanks, I have to read more about gcc. In the first instance it worked when I included those dirs in the PATH. From now I will follow your advice and include them in the LIBRARY_PATH. – fdisk Nov 23 '12 at 18:02
  • The actual environmental variable for header files is: CPATH – fdisk Dec 31 '12 at 18:26

1 Answers1

1

Best way to get an idea is taking look at the Slackware build scripts (located in sources/*/* in the distribution trees). There are also some additional Slackware package repositories, which contain lots of packages not found in Slackware proper, so you might not necessarily need to build everything yourself. Two of the well-known are Eric Hameleers' slackbuilds repo and slackbuilds.

That said, the install part of the application build system usually puts these files (headers) in the appropriate place, i.e. /usr/include or /usr/local/include, depending whether you are installing into /usr or /usr/local (the latter being usually default).

As for the sources - generally speaking you should not need anything else than headers once you compile the application (apart from any header files you need when you want to compile another piece of code against it). Unless you want to actually develop the software, you discard the sources right after compilation. And if you want to develop you usually keep a separate tree somewhere under version control and do not build your packages from this devel tree, rather from a more stable one.

Last but not the least, you really want to make a package first and only install that (i.e. not running make install as root directly), since it makes system maintenance easier (and you don't have to keep the sources to be able to run make uninstall).

peterph
  • 30,838