[Asterisk-Dev] PATCH: Add DESTDIR support to makefiles

Jake Morrison jake at newnetlogic.com
Sun Aug 31 22:50:15 MST 2003


On Monday 01 September 2003 08:18, Ben Klang wrote:
> Thank you for noting this... I had just seen this behavior myself.
>
> I believe the 'proper' thing to do is respect the given prefix and put
> it in /usr/local/etc, not /etc.

I think /usr/local/etc is a little wierd, I prefer /etc. Though I like
the binaries and other stuff to go under /usr/local or a dedicated
directory, e.g. /usr/local/asterisk. And each distro has its own rules...

autoconf uses the following structure:

  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [same as prefix]
  --bindir=DIR            user executables in DIR [EPREFIX/bin]
  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
  --datadir=DIR           read-only architecture-independent data in DIR
                          [PREFIX/share]
  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
                          [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
  --includedir=DIR        C header files in DIR [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
  --infodir=DIR           info documentation in DIR [PREFIX/info]
  --mandir=DIR            man documentation in DIR [PREFIX/man]

I think this works pretty well in practice, while giving flexibility for
easy distro customization and some things like sharing binaries over NFS. 

Following is a description of how things might work with autoconf 
or an autoconf-like structure. By default, things would end up in the 
same place, except we might make the following changes:

    Change ASTVARLIBDIR to PREFIX/share/asterisk instead of 
        PREFIX/var/asterisk.  
    Change AGI_DIR to EPREFIX/lib/asterisk/agi-bin instead of 
        ASTVARLIBDIR/agi-bin
    Put CGI files in a directory under ASTLIBDIR/cgi-bin and have 
        a symbolic link to the directory from the HTTPDIR/cgi-bin 
        directory.

ASTLIBDIR
	Currently $(INSTALL_PREFIX)/usr/lib/asterisk
	Now used for libs
	This would be --libdir, which defaults to EPREFIX/lib
	We would want a default to EPREFIX/lib/asterisk
	This is the same as the current situation.

ASTVARLIBDIR
	Currently $(INSTALL_PREFIX)/var/lib/asterisk
	Now used for sound and image files
	Under the GNU structure, these would go under 
	--datadir, which defaults to PREFIX/share
	We could default to PREFIX/share/asterisk
	or stick with PREFIX/var/asterisk.  

	This is a potential change from the current situation.

ASTETCDIR
	Currently $(INSTALL_PREFIX)/etc/asterisk
	Used for config files
	This would be --sysconfdir, which defaults to EPREFIX/etc
	We would default to EPREFIX/etc/asterisk

ASTSPOOLDIR
	Currently $(INSTALL_PREFIX)/var/spool/asterisk
	Used for voicemail
        This would be --localstatedir, which defaults to PREFIX/var
	We would default to PREFIX/var/spool/asterisk
	
ASTLOGDIR
	Currently $(INSTALL_PREFIX)/var/log/asterisk
	Used for logfiles and CDRs
        This would be --localstatedir=, which defaults to PREFIX/var
	We would default to PREFIX/var/spool/asterisk

ASTHEADERDIR
	Currently $(INSTALL_PREFIX)/usr/include/asterisk
	Used for headers for Asterisk API
        This would be --includedir, which defaults to PREFIX/include
	We would default to PREFIX/include/asterisk

ASTCONFPATH
	Currently $(ASTETCDIR)/asterisk.conf
	This stays the same

ASTBINDIR
	Currently $(INSTALL_PREFIX)/usr/bin
	Used for end user executables
        This would be --bindir, which defaults to EPREFIX/bin

ASTSBINDIR
	Currently $(INSTALL_PREFIX)/usr/sbin
	Used for system executables
        This would be --sbindir, which defaults to EPREFIX/sbin

ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
	Used for runtime files, e.g. pid files
        This would be --localstatedir=, which defaults to PREFIX/var
	We would default to PREFIX/var/run

MODULES_DIR
	Currently $(ASTLIBDIR)/modules
	Used for runtime loaded libraries
	This stays the same, though I have seen some packages use --libexec. 

AGI_DIR
	Currently $(ASTVARLIBDIR)/agi-bin
	Used for AGI binaries
	I am not sure why this is VARLIB not VAR. Is it likely to be different
	for different machines? 
	This would be a separate configuration variable, with default to
	ASTLIBDIR/agi-bin

	This is a change from the current situation.

HTTPDIR
	Currently either /var/www or /home/httpd
	I prefer to put CGI files in a directory under the package directory,
	e.g. ASTLIBDIR/cgi-bin, and have a symbolic link to the directory from 
	under the web server. That makes it easier to maintain multiple versions. 
	This would be a separate configuration variable, with default to
	ASTLIBDIR/cgi-bin
 
	This would be a change from the current situation. 

>
> -BAK

>
> On Sat, 2003-08-30 at 10:05, Alastair Maw wrote:
> > As noted by other posters, please don't hit reply in your e-mail client
> > when starting a new thread - it breaks threading in clueful clients by
> > adding an In-Reply-To header which shouldn't be there. Thanks. :)

Sorry, started a reply in that thread, but changed in midstream. 

Regards,
Jake

> >
> > > It is different from INSTALL_PREFIX, which specifies
> > > a prefix for the final location of the installed files.
> >
> > Talking of which, INSTALL_PREFIX doesn't seem to behave properly. I'd
> > expect the following...
> >
> >    make INSTALL_PREFIX=/usr/local install
> >
> > ...to install Asterisk into:
> >    /usr/local/lib/asterisk/
> >    /usr/local/sbin/asterisk/
> >    /usr/local/include/asterisk/
> >    etc.
> >
> > But it doesn't. It puts things in /usr/local/usr/lib/asterisk/ etc.
> > libpri is the same. If we patch the makefiles for libpri and asterisk,
> > should they still put things in /etc/ and /var/ or should they go in
> > /usr/local/etc/ and /usr/local/var/ ?





More information about the asterisk-dev mailing list