WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: DESTDIR vs installing directly to /usr/local  (Read 8111 times)

Offline Jason W

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 9730
DESTDIR vs installing directly to /usr/local
« on: April 27, 2009, 10:05:22 PM »
Most modern sources support the use of DESTDIR to install packages into a specific location.  However, I have been burned quite a few times by relying on DESTDIR to install files in a desired location.  Mainly .la files and .so symlinks are not set right when using the DESTDIR approach.  If you "make install DESTDIR=/mnt/hda2/app" then there is a chance your .so symlinks are going to point to /mnt/hda2/app/usr/local/lib/somelib.so.1.2 rather than /usr/local/lib/somelib.so.1.2.  As well as the directory paths mentioned in your .la files.  I have found it more reliable to use the method mentioned in the wiki that goes something like this:

./configure --prefix=/usr/local
make
touch /tmp/mark
make install
find /usr/local -newer /tmp/mark -not -type d > /tmp/list
tar -T /tmp/list -czvf /home/tc/someapp.tce

Then untar someapp.tce somewhere to finish the making of the extension.

If DESTDIR is an option you feel you cannot do without, then looking at the port files of Arch linux or Crux will be helpful as they deal exclusively with the DESTDIR type of option and have the file and symlink modifications to correct any error of the DESTDIR approach. Hopefully this can save some time and troubleshooting.  Our new ldconfig is more sensitive to missing .so symlink targets.  That is not a bad thing but it does require more attention to detail in packaging.

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: DESTDIR vs installing directly to /usr/local
« Reply #1 on: April 27, 2009, 11:55:25 PM »
Most modern sources support the use of DESTDIR to install packages into a specific location.  However, I have been burned quite a few times by relying on DESTDIR to install files in a desired location.  Mainly .la files and .so symlinks are not set right when using the DESTDIR approach.  If you "make install DESTDIR=/mnt/hda2/app" then there is a chance your .so symlinks are going to point to /mnt/hda2/app/usr/local/lib/somelib.so.1.2 rather than /usr/local/lib/somelib.so.1.2.  As well as the directory paths mentioned in your .la files.  I have found it more reliable to use the method mentioned in the wiki that goes something like this:

./configure --prefix=/usr/local
make
touch /tmp/mark
make install
find /usr/local -newer /tmp/mark -not -type d > /tmp/list
tar -T /tmp/list -czvf /home/tc/someapp.tce

Then untar someapp.tce somewhere to finish the making of the extension.

If DESTDIR is an option you feel you cannot do without, then looking at the port files of Arch linux or Crux will be helpful as they deal exclusively with the DESTDIR type of option and have the file and symlink modifications to correct any error of the DESTDIR approach. Hopefully this can save some time and troubleshooting.  Our new ldconfig is more sensitive to missing .so symlink targets.  That is not a bad thing but it does require more attention to detail in packaging.

..and to remove files: 
Code: [Select]
find /usr/local -newer /tmp/mark -not -type d  | xargs rm

Offline ^thehatsrule^

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 1726
Re: DESTDIR vs installing directly to /usr/local
« Reply #2 on: April 28, 2009, 11:40:06 PM »
Code: [Select]
find /usr/local -newer /tmp/mark -not -type d  | xargs rm
Side note: passing -exec to find might be faster