Project

General

Profile

unexist.dev

Assorted tidbits and projects

installing to home directory

Added by Suraj Kurapati almost 14 years ago

Hello,

I tried installing subtle (from hg clone) to my home directory as follows:

rake config 
prefix=$HOME/app/subtle 
sysconfdir=$HOME/app/subtle/etc 
extdir=$HOME/app/subtle/ruby 
&& rake install

Then I set my RUBYLIB environment variable to the extdir value above:

export RUBYLIB=$HOME/app/subtle/ruby

Now when I run `sur`, it gives an error:

sur
>>> ERROR: Couldn't find the gem `subtle-sur-version'
>>>        Please install it with following command:
>>>        gem install subtle-sur-version

However, Ruby can see the installed Subtle libraries just fine:

irb                                
### ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
>> $:.first
"/home/sunny/app/subtle/ruby" 
>> require 'subtlext'
true
>> require 'sur/version'
true

Thanks for your consideration.


Replies (3)

RE: installing to home directory - Added by Christoph Kappel almost 14 years ago

Generally subtle uses the prefix etc. variables to install executable and shared files and uses the information ruby provides for the ruby related files. (site_ruby and libdir) When you run rake like this you install the files into your destination, but still the ruby destination paths are related to your actual ruby environment. Overriding this is a bad idea, since it would force every user to manually add the path to the ruby lib path.

So if you add the export it works right for your irb, but not for subtle or sur in this case. Easiest way to bypass that issue is to add that export to your shell startup files like .zshrc for zsh or .bashrc for bash. I don't think it is a good idea to make it easier to override systems default set by the environment, although I could do that in the rakefile.

I will check if that works as expected and post my results.

RE: installing to home directory - Added by Suraj Kurapati almost 14 years ago

Interesting, I will put the export in my ~/.profile file. For now, I gave up on this approach and just did a normal rake install as root.

However, I wonder: How do you test changes to subtle, Christoph? Is there a way to run subtle directly from the compilation directory, or do you have to run rake install every time?

RE: installing to home directory - Added by Christoph Kappel almost 14 years ago

I have some scripts that set the required path to work just from the builddir, subtle uses the XDG path and therefore it is really easy to change the whole thing just by changing some env variables. My scripts usually look like this one for sur:

sur.sh

#!/bin/zsh
export RUBYLIB="./data:./debug/ruby" 
export RUBYPATH="./data:./debug/ruby" 
export DLN_LIBRARY_PATH="./data:./debug/ruby" 
export XDG_DATA_HOME="./debug/data" 
export XDG_CONFIG_HOME="./debug/config" 
export XDG_CACHE_HOME="./debug/cache" 

ruby ./data/bin/sur $*
    (1-3/3)