www.digitalmars.com         C & C++   DMDScript  

D.gnu - Installing GDC to home directory?

reply dsimcha <dsimcha yahoo.com> writes:
Is there an easy way to compile and install GDC + Phobos, druntime and a 
few custom libraries to your home directory on a machine that you don't 
have root access to?
Aug 14 2011
parent reply Johannes Pfau <spam example.com> writes:
dsimcha wrote:
Is there an easy way to compile and install GDC + Phobos, druntime and
a few custom libraries to your home directory on a machine that you
don't have root access to?
I think you could just change the "--prefix=/opt/gdc" to "--prefix=/home/dsimcha/gdc" and it should work. Or you could use --prefix="/usr" and 'DESTDIR="/home/dsimcha" make install', I never understood the difference between prefix and DESTDIR. -- Johannes Pfau
Aug 14 2011
next sibling parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
== Quote from Johannes Pfau (spam example.com)'s article
 dsimcha wrote:
Is there an easy way to compile and install GDC + Phobos, druntime and
a few custom libraries to your home directory on a machine that you
don't have root access to?
I think you could just change the "--prefix=/opt/gdc" to "--prefix=/home/dsimcha/gdc" and it should work. Or you could use --prefix="/usr" and 'DESTDIR="/home/dsimcha" make install', I never understood the difference between prefix and DESTDIR.
--prefix is hard coded into the application, DESTDIR is post installation (make installs ie: gdc to $(DESTDIR)$(prefix)/bin). If installing in your home directory, you can get away with configuring with --prefix=/gdc and installing with DESTDIR=$HOME/apps - alter as needed. Regards Iain
Aug 14 2011
parent dsimcha <dsimcha yahoo.com> writes:
== Quote from Iain Buclaw (ibuclaw ubuntu.com)'s article
 == Quote from Johannes Pfau (spam example.com)'s article
 dsimcha wrote:
Is there an easy way to compile and install GDC + Phobos, druntime and
a few custom libraries to your home directory on a machine that you
don't have root access to?
I think you could just change the "--prefix=/opt/gdc" to "--prefix=/home/dsimcha/gdc" and it should work. Or you could use --prefix="/usr" and 'DESTDIR="/home/dsimcha" make install', I never understood the difference between prefix and DESTDIR.
--prefix is hard coded into the application, DESTDIR is post installation (make installs ie: gdc to $(DESTDIR)$(prefix)/bin). If installing in your home directory, you can get away with configuring with --prefix=/gdc and installing with DESTDIR=$HOME/apps - alter as needed. Regards Iain
Works great, thanks.
Aug 15 2011
prev sibling parent reply Vijay Nayar <madric gmail.com> writes:
On Mon, 15 Aug 2011 07:23:02 +0200, Johannes Pfau wrote:

 dsimcha wrote:
Is there an easy way to compile and install GDC + Phobos, druntime and a
few custom libraries to your home directory on a machine that you don't
have root access to?
I think you could just change the "--prefix=/opt/gdc" to "--prefix=/home/dsimcha/gdc" and it should work. Or you could use --prefix="/usr" and 'DESTDIR="/home/dsimcha" make install', I never understood the difference between prefix and DESTDIR.
The '--prefix="/usr"' options tells the compiled program where it will search for libraries, other binaries, data files, and other information when it runs. The 'DESTDIR="/home/dsimcha"' option tells the compiler to dump the output files in the specified directory. Why is this useful? Mostly it is useful if you are compiling a binary for other people to use, but don't want to wreck your local environment. For example, if I am creating a binary .deb or .rpm, I can compile everything I want so that it expects to run in '/usr' (prefix), but dump the files in '/home/vnayar/myproject/rpm' (DESTDIR). After I run my command, I'll have stuff like: /home/vnayar/myproject/rpm/ + usr/bin/mybin + usr/share/mydata + usr/lib/libmine.so And after I wrap all that up in a .deb package, and someone else installs it, they will have binaries ready to go in /usr/bin, etc.
Aug 15 2011
parent reply Trass3r <un known.com> writes:
 For example, if I am creating a binary .deb or .rpm, I can compile
 everything I want so that it expects to run in '/usr' (prefix), but dump
 the files in '/home/vnayar/myproject/rpm' (DESTDIR).

 After I run my command, I'll have stuff like:
   /home/vnayar/myproject/rpm/
     + usr/bin/mybin
     + usr/share/mydata
     + usr/lib/libmine.so

 And after I wrap all that up in a .deb package, and someone else installs
 it, they will have binaries ready to go in /usr/bin, etc.
How would you configure it to create a dmd like package that can be extracted anywhere?
Aug 15 2011
next sibling parent Iain Buclaw <ibuclaw ubuntu.com> writes:
== Quote from Trass3r (un known.com)'s article
 For example, if I am creating a binary .deb or .rpm, I can compile
 everything I want so that it expects to run in '/usr' (prefix), but dump
 the files in '/home/vnayar/myproject/rpm' (DESTDIR).

 After I run my command, I'll have stuff like:
   /home/vnayar/myproject/rpm/
     + usr/bin/mybin
     + usr/share/mydata
     + usr/lib/libmine.so

 And after I wrap all that up in a .deb package, and someone else installs
 it, they will have binaries ready to go in /usr/bin, etc.
How would you configure it to create a dmd like package that can be extracted anywhere?
You can extract it anywhere. Just make sure that the gdc /bin directory is in your $PATH.
Aug 15 2011
prev sibling parent Vijay Nayar <madric gmail.com> writes:
On Tue, 16 Aug 2011 00:32:06 +0200, Trass3r wrote:

 For example, if I am creating a binary .deb or .rpm, I can compile
 everything I want so that it expects to run in '/usr' (prefix), but
 dump the files in '/home/vnayar/myproject/rpm' (DESTDIR).

 After I run my command, I'll have stuff like:
   /home/vnayar/myproject/rpm/
     + usr/bin/mybin
     + usr/share/mydata
     + usr/lib/libmine.so

 And after I wrap all that up in a .deb package, and someone else
 installs it, they will have binaries ready to go in /usr/bin, etc.
How would you configure it to create a dmd like package that can be extracted anywhere?
Sorry about the late reply. Traditionally, if you have a standard autotools project, and you do not have permissions to override system files, you create subdirectories that you use locally and put them in your path. I use a directory structure like this: /home/vnayar/bin /home/vnayar/lib /home/vnayar/share To install software to, and have it expect to run from, your local directory, compile it like so: $ cd my-program-0.1 $ ./configure --prefix=$HOME $ make ; make install To run these commands by default when you enter them in the prompt, you'll want to set up your PATH settings. For example, if you use Bash as your shell there is usually a file called ".bashrc" or ".profile" in your home directory that is read when the shell first loads. You can add an entry to the shell environment variable "PATH" by adding the following line to the bottom of the file: export PATH=$HOME/bin:$PATH The PATH environment variable is searched left to right, so this means, "Look for executables in $HOME/bin before looking in the normal places." So if you install your own personal 'gcc', it will be loaded instead of the one in /usr/bin/gcc. You can manually load your new changes using the command "source ~/.profile". To check what executable will be run for a particular command, use 'which', e.g. "which gcc" outputs "/usr/bin/gcc" for me. - Vijay
Aug 19 2011