[CLUE-Tech] If I want to install a program to extract "rar" files?

mgushee at havenrock.com mgushee at havenrock.com
Mon Mar 3 19:07:17 MST 2003


On 3 Mar 2003 at 15:15, Joe Linux wrote:

> The instructions (?) are as follows:

I guess you could call them instructions. To be more precise, we're 
looking at the contents of a Makefile. So, what do you do with a 
Makefile (don't everybody yell at once)?

Make! Or, to be more precise,

  $ make

Even if you've never done that, you probably know that 'make' is most 
often used to compile software packages. But it can also be used to 
install binaries; that appears to be what this Makefile is intended 
for.

> ###################################################################
> # Installing RAR executables, configuration files and SFX modules #
> # to appropriate directories                                      #
> ###################################################################
> 
> PREFIX=/usr/local

PREFIX tells make where to install things. So your executables will 
presumably go to /usr/local/bin, config files to /usr/local/etc, and 
so on.

> install:
>     cp rar unrar $(PREFIX)/bin
>     cp rarfiles.lst /etc
>     cp default.sfx $(PREFIX)/lib

The above is a *make target*. You can invoke 'make' followed by the 
name of any target that is defined in the Makefile, so in this case:

  $ make install

The simple command

  $ make

Invokes make with the default target. Now, I can't recall offhand how 
the default target is specified, but if 'install' is the only one 
defined, then I suppose it will be the default.

> In all honesty, I really don't know exactly what to do. Presently I have 
> a folder in "/apps" (a directory I created) called "rar"
> 
> So I guess it's in /apps/rar

And from the looks of things, you could just run the program directly 
from there if /apps/rar were on your path ... but I bet it isn't. And 
since it's your personal system, you can install things in whatever 
weird directories you feel like. Me, I like to do things in at least 
semi-standard fashion. What I would probably do in your shoes is:

 1. Unpack the rar package in /var/tmp:
     $ cd /var/tmp
     $ tar zxvf rar.tar.gz    # or whatever its name is -- I trust  
                                    # you get the idea
     $ cd rar
 2. Edit the Makefile, changing PREFIX to /opt/rar.
 3. Become root
 4. # mkdir /opt/rar
 5. # make install
 6. Exit from root shell
 7. $ cd ..
 8. $ rm -rf rar   # Everything's installed, don't need this  
                        # temporary directory any more.
 9. Symlink the executables to a standard executable directory 
     $ ln -s /opt/rar/bin/rar /usr/local/bin/rar
     $ ln -s /opt/rar/bin/unrar /usr/local/bin/unrar

The reason I don't use the default prefix of /usr/local is that I 
install a *lot* of third-party packages, and if their components are 
all jumbled together in /usr/local/bin, /usr/local/lib, etc., it 
becomes a nightmare to try to uninstall anything. By installing each 
package in its own subdirectory under /opt, uninstallation becomes a 
simple matter of blowing away the package directory. I use the 
'symlinks' program periodically to clear away the dangling links that 
are left behind.

With that said, there are different schools of thought as to the best 
way to handle third-party packages. Some people like to add a new 
entry to their PATH for each new package; others just throw caution 
to the winds and toss it all into /usr/local, hoping that that won't 
create conflicts in the future. For what it's worth, I think my 
method is quite similar to how Solaris normally installs optional 
packages.

> [jl at user-10cm429 jl]$ cd /apps/rar
> [jl at user-10cm429 rar]$ ls
> default.sfx*  Makefile   rar_faq.txt   rar_static*  register.txt  unrar*
> file_id.diz   order.txt  rarfiles.lst  rar.txt      rereg.txt     
> whatsnew.txt
> license.txt   rar*       rar_site.txt  readme.txt   technote.txt

Typical binary package. It's pretty clear there are no source code 
files here, and the asterisked files are executables (though I'm not 
sure default.sfx should be ... it's supposed to go in $PREFIX/lib).

Hope this helps.

--
Matt Gushee
Englewood, CO USA



More information about the clue-tech mailing list