Find the answer to your Linux question:
Results 1 to 9 of 9
I want to install a piece of software from source, which for convenience I will call "qf". As this process generates quite a lot of warnings and errors, I will ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Dec 2004
    Posts
    323

    Configure, make, make install and make uninstall


    I want to install a piece of software from source, which for convenience I will call "qf". As this process generates quite a lot of warnings and errors, I will need logfiles to read through it and correct the install scripts. I was wondering if I could therefore just run the following script:
    Code:
    #!/bin/bash
    
    ./configure > qf_log_configure
    make > qf_log_make
    make install > qf_log_make_install
    
    make uninstall 
    
    exit
    and after chmod 755 run this every time I install a new version. Would this be a good way of going about it? Any best practices I am overlooking?

    Thanks in advance


    Tech

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Running make uninstall at the end, asuming that "make uninstall" is a valid makefile target, would cause the newly installed application to be removed from the system.

  3. #3
    Linux User
    Join Date
    Dec 2004
    Posts
    323
    Precisely so! I just run the script whenever I feel there's something afoot and "make uninstall" is just another command I won't need to care about.

    Thanks for your info

    Tech

  4. #4
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    What? That makes no sense. This script will indeed install your program but then uninstall it five minutes later.

  5. #5
    Linux User
    Join Date
    Dec 2004
    Posts
    323
    lakerdonald, I need the logs to see what went wrong. As soon as I have an inkling all will go smoothly, I'll delete the line. Hope this clarifies

    Tech

  6. #6
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Just do:
    Code:
    make -n install
    Which goes through what would happen, but doesn't actually do it.
    So it would be:
    Code:
    #!/bin/sh
    ./configure > my_config.log.$$ 2>&1
    make > make.log.$$ 2>&1
    make install -n > install.log.$$ 2>&1
    This will create the normal config.log created by all runs of configure, and the logfiles my_config, make and install, all with unique suffixes.

  7. #7
    Linux User
    Join Date
    Dec 2004
    Posts
    323
    lakerdonald

    Thanks again for your prompt response and it works beautifully. Having 3 files is somewhat cumbersome though and I will make the appropriate changes. My remaining question is what the inner workings are of "$$"; eg it added the number 6645 to my files. Perhaps a part of a timestamp?

    Tech

  8. #8
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    $$ is a special shell variable that expands to the PID of the current process.
    To add to one file, you could do:
    Code:
    #!/bin/sh
    logfile="qf.log.$$"
    echo "Configuring qf..." > $logfile
    ./configure >> $logfile 2>&1
    echo >> $logfile
    echo "Compiling qf..." >> $logfile
    echo >> $logfile
    make >> $logfile 2>&1
    echo >> $logfile
    echo "Installing qf..." >> $logfile
    echo >> $logfile
    make install -n >> $logfile 2>&1

  9. #9
    Linux User
    Join Date
    Dec 2004
    Posts
    323
    Ok, thanks for your sample script and I'll keep plugging away at this.

    Best wishes


    Tech

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •