You are not logged in.

#1 2009-11-03 19:51:52

jazz1303
Member
Registered: 2009-04-20
Posts: 7

Custom prefix for apache built

Hi, I am running into issue, when making the custom apache package
My aim is to compile the package with --prefix option ,which has different location, say --prefix=/services/apache.2.2.14
What I have done:
- added the appropriate prefix to PKGBUILD and commented out the --enable-layout=arch <--------- no effect;
- changed the file arch.layout paths <------- makepkg gives errors on matching this file after it been edited;
- added the new layout into arch.layout   <------- makepkg gives errors on matching this file after it been edited.

How can I create the package which uses custom location in --prefix option?
Please help.

Offline

#2 2009-11-04 18:28:04

jazz1303
Member
Registered: 2009-04-20
Posts: 7

Re: Custom prefix for apache built

Hey Guys, hasn't somebody tried to build the package with custom prefix?
Appreciate your help.

Offline

#3 2009-11-04 21:34:17

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,226
Website

Re: Custom prefix for apache built

Post the PKGBUILD that you're using would be a start so we can see exactly what's going on...

Offline

#4 2009-11-05 17:45:42

jazz1303
Member
Registered: 2009-04-20
Posts: 7

Re: Custom prefix for apache built

Thank you for reply!
Here is my PKGBUILD

# $Id: PKGBUILD 53936 2009-10-04 02:15:01Z andrea $
# Maintainer: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>

pkgname=apache
pkgver=2.2.14
pkgrel=1
pkgdesc='A high performance Unix-based HTTP server'
arch=('i686' 'x86_64')
options=('!libtool')
url='http://www.apache.org/dist/httpd'
license=('APACHE')
backup=(etc/httpd/conf/httpd.conf
        etc/httpd/conf/extra/httpd-{autoindex,dav,default,info,languages}.conf
        etc/httpd/conf/extra/httpd-{manual,mpm,multilang-errordoc}.conf
        etc/httpd/conf/extra/httpd-{ssl,userdir,vhosts}.conf
        etc/logrotate.d/httpd)
depends=('openssl' 'zlib' 'apr-util' 'pcre')
optdepends=('lynx: apachectl status')
source=("http://www.apache.org/dist/httpd/httpd-${pkgver}.tar.bz2"
        'httpd.logrotate' 'httpd' 'arch.layout')
md5sums=('a5226203aaf97e5b941c41a71c112704'
         'f4d627c64024c1b7b95efb5ffbaa625e'
         'bddd84dafa770d74df1dc1f96bd71823'
         '3d659d41276ba3bfcb20c231eb254e0c')

build() {
    cd ${srcdir}/httpd-${pkgver}

    # set default user
    sed -e 's#User daemon#User http#' \
        -e 's#Group daemon#Group http#' \
        -i docs/conf/httpd.conf.in

    cat ${srcdir}/arch.layout >> config.layout
    ./configure 
#        --enable-layout=Arch \
        --prefix=/services/apache.2.2.14 \
#        --enable-modules=all \
#        --enable-mods-shared=all \
        --enable-so \
        --enable-suexec \
        --with-suexec-caller=http \
        --with-suexec-docroot=/srv/http \
        --with-suexec-logfile=/var/log/httpd/suexec.log \
        --with-suexec-bin=/usr/sbin/suexec \
        --with-suexec-uidmin=99 --with-suexec-gidmin=99 \
#        --enable-ldap --enable-authnz-ldap \
#        --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache \
        --enable-ssl --with-ssl \
        --enable-deflate --enable-cgid \
        --enable-vhost-alias
#        --enable-proxy --enable-proxy-connect \
#        --enable-proxy-http --enable-proxy-ftp \
#        --enable-dbd \
        --with-apr=/usr/bin/apr-1-config \
        --with-apr-util=/usr/bin/apu-1-config \
        --with-pcre=/usr

    make || return 1

    make DESTDIR=${pkgdir} install
    echo ${pkgdir}
    echo ${srcdir}
    install -D -m755 ${srcdir}/httpd ${pkgdir}/etc/rc.d/httpd
    install -D -m644 ${srcdir}/httpd.logrotate ${pkgdir}/etc/logrotate.d/httpd

    # symlinks for /etc/httpd
    ln -fs /var/log/httpd ${pkgdir}/etc/httpd/logs
    ln -fs /var/run/httpd ${pkgdir}/etc/httpd/run
    ln -fs /usr/lib/httpd/modules ${pkgdir}/etc/httpd/modules
    ln -fs /usr/lib/httpd/build ${pkgdir}/etc/httpd/build

    # set sane defaults
    sed -e 's#/usr/lib/httpd/modules/#modules/#' \
        -e 's|#\(Include conf/extra/httpd-multilang-errordoc.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-autoindex.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-languages.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-userdir.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-default.conf\)|\1|' \
        -i ${pkgdir}/etc/httpd/conf/httpd.conf

    # cleanup
    rm -rf ${pkgdir}/usr/share/httpd/manual
    rm -rf ${pkgdir}/etc/httpd/conf/original
    rm -rf ${pkgdir}/srv/http
    rmdir ${pkgdir}/usr/bin
}

It seems to be that in the following lines I should change httpd to my prefix name:

install -D -m755 ${srcdir}/httpd ${pkgdir}/etc/rc.d/httpd
    install -D -m644 ${srcdir}/httpd.logrotate ${pkgdir}/etc/logrotate.d/httpd

What do you think?

Offline

#5 2009-11-05 21:37:40

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,226
Website

Re: Custom prefix for apache built

1) You're missing the backslash ('\') after ./configure to tell bash that the line is continued.
2) Yes, you will need to edit the rc init script to point to the new location.
3) After you edit any of the files listed in the source() array, you will need to regenerate the md5sum() array. Delete the existing one and run:

makepkg -g >> PKGBUILD

Don't forget the *double* '>' otherwise you will wipe out the whole PKGBUILD instead of appending to it!

Offline

#6 2009-11-15 05:54:07

jazz1303
Member
Registered: 2009-04-20
Posts: 7

Re: Custom prefix for apache built

Modified the PKGBUILD and arch.layoutm regenerated md5 sum as fukawi2  have advised.
Here is the Code of PKGBUILD:

# $Id: PKGBUILD 53936 2009-10-04 02:15:01Z andrea $
# Maintainer: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>

pkgname=apache
pkgver=2.2.14
pkgrel=1
pkgdesc='A high performance Unix-based HTTP server'
arch=('i686' 'x86_64')
options=('!libtool')
url='http://www.apache.org/dist/httpd'
license=('APACHE')
myprefix='/services/apache.2.2.14'
binaryname='apache2_custom'
backup=(etc/httpd/conf/httpd.conf
        etc/httpd/conf/extra/httpd-{autoindex,dav,default,info,languages}.conf
        etc/httpd/conf/extra/httpd-{manual,mpm,multilang-errordoc}.conf
        etc/httpd/conf/extra/httpd-{ssl,userdir,vhosts}.conf
        etc/logrotate.d/httpd)
depends=('openssl' 'zlib' 'apr-util' 'pcre')
optdepends=('lynx: apachectl status')
source=("http://www.apache.org/dist/httpd/httpd-${pkgver}.tar.bz2"
        'httpd.logrotate' 'httpd' 'arch.layout')
md5sums=('a5226203aaf97e5b941c41a71c112704'
         'f4d627c64024c1b7b95efb5ffbaa625e'
         'bddd84dafa770d74df1dc1f96bd71823'
         '3d659d41276ba3bfcb20c231eb254e0c')

build() {
    cd ${srcdir}/httpd-${pkgver}

    # set default user
    sed -e 's#User daemon#User http#' \
        -e 's#Group daemon#Group http#' \
        -i docs/conf/httpd.conf.in

    cat ${srcdir}/arch.layout >> config.layout
    ./configure --enable-layout=Arch \
        --with-program-name=${binaryname} \
        --enable-rewrite \
        --enable-vhost-alias \
        --enable-so \
        --enable-suexec \
        --with-suexec-caller=http \
        --with-suexec-docroot=/srv/http \
        --with-suexec-logfile=/var/log/httpd/suexec.log \
        --with-suexec-bin=/usr/sbin/suexec \
        --with-suexec-uidmin=99 --with-suexec-gidmin=99 \
        --enable-ssl --with-ssl \
        --enable-deflate --enable-cgid \
        --with-apr=/usr/bin/apr-1-config \
        --with-apr-util=/usr/bin/apu-1-config \
        --with-pcre=/usr

    make || return 1

    make DESTDIR=${pkgdir} install
    install -D -m755 ${srcdir}/httpd ${pkgdir}/$myprefix/etc/rc.d/httpd
    install -D -m644 ${srcdir}/httpd.logrotate ${pkgdir}/$myprefix/etc/logrotate.d/httpd

    # set sane defaults
    sed -e 's#/usr/lib/httpd/modules/#modules/#' \
        -e 's|#\(Include conf/extra/httpd-multilang-errordoc.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-autoindex.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-languages.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-userdir.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-default.conf\)|\1|' \
        -i ${pkgdir}/$myprefix/conf/${binaryname}.conf
}

md5sums=('a5226203aaf97e5b941c41a71c112704'
         'f4d627c64024c1b7b95efb5ffbaa625e'
         'bddd84dafa770d74df1dc1f96bd71823'
         '78b0a8fd3778bccebea2c420aceeb3c8')

and arch.layout

<Layout Arch>
    prefix:          /services/apache.2.2.14/
    exec_prefix:     /services/apache.2.2.14/bin
    bindir:          /services/apache.2.2.14/bin
    sbindir:         /services/apache.2.2.14/sbin
    libdir:          /services/apache.2.2.14/lib
    libexecdir:      /services/apache.2.2.14/modules
    mandir:          /services/apache.2.2.14/man
    sysconfdir:      /services/apache.2.2.14/conf
    datadir:         /services/apache.2.2.14/share/
    installbuilddir: /services/apache.2.2.14/build
    errordir:        /services/apache.2.2.14/error
    iconsdir:        /services/apache.2.2.14/icons
    htdocsdir:       /services/webpages
    manualdir:       /services/apache.2.2.14/manual
    cgidir:          /services/apache.2.2.14/htdocs/cgi-bin
    includedir:      /services/apache.2.2.14/include
    localstatedir:   /services/apache.2.2.14/var
    runtimedir:      /services/apache.2.2.14/var/run/httpd
    logfiledir:      /services/apache.2.2.14/log
    proxycachedir:   /services/apache.2.2.14/cache/httpd
</Layout>

Now it is compiled OK. However once I have installed this customized package and launching the apache binary, I am gettings the config is missing error:

sudo /services/apache.2.2.14/sbin/apache2_custom 
apache2_custom: Could not open configuration file /services/apache.2.2.14/etc/httpd.conf: No such file or directory

Somewhy apache looks  /services/apache.2.2.14/etc/ directory for the config file, and it is pointed to to be in /services/apache.2.2.14/conf/
Can you advise why is that? Which option have I not tirggered?
Thank you.

Offline

#7 2009-11-17 19:55:10

jazz1303
Member
Registered: 2009-04-20
Posts: 7

Re: Custom prefix for apache built

Resolved the config issue by adding symlink creation in the build section of PKGBUILD file

cat abs/apache/PKGBUILD
# $Id: PKGBUILD 53936 2009-10-04 02:15:01Z andrea $
# Maintainer: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>

pkgname=apache
pkgver=2.2.14
pkgrel=1
pkgdesc='A high performance Unix-based HTTP server'
arch=('i686' 'x86_64')
options=('!libtool')
url='http://www.apache.org/dist/httpd'
license=('APACHE')
myprefix='/services/apache.2.2.14'
binaryname='apache2_custom'
backup=(etc/httpd/conf/httpd.conf
        etc/httpd/conf/extra/httpd-{autoindex,dav,default,info,languages}.conf
        etc/httpd/conf/extra/httpd-{manual,mpm,multilang-errordoc}.conf
        etc/httpd/conf/extra/httpd-{ssl,userdir,vhosts}.conf
        etc/logrotate.d/httpd)
depends=('openssl' 'zlib' 'apr-util' 'pcre')
optdepends=('lynx: apachectl status')
source=("http://www.apache.org/dist/httpd/httpd-${pkgver}.tar.bz2"
        'httpd.logrotate' 'httpd' 'arch.layout')
md5sums=('a5226203aaf97e5b941c41a71c112704'
         'f4d627c64024c1b7b95efb5ffbaa625e'
         'bddd84dafa770d74df1dc1f96bd71823'
         '3d659d41276ba3bfcb20c231eb254e0c')

build() {
    cd ${srcdir}/httpd-${pkgver}

    # set default user
    sed -e 's#User daemon#User http#' \
        -e 's#Group daemon#Group http#' \
        -i docs/conf/httpd.conf.in

    cat ${srcdir}/arch.layout >> config.layout
    ./configure --enable-layout=Arch \
        --sysconfdir=${myprefix}/conf \
        --enable-rewrite \
        --enable-vhost-alias \
        --enable-so \
        --enable-suexec \
        --with-suexec-caller=http \
        --with-suexec-docroot=/srv/http \
        --with-suexec-logfile=/var/log/httpd/suexec.log \
        --with-suexec-bin=/usr/sbin/suexec \
        --with-suexec-uidmin=99 --with-suexec-gidmin=99 \
        --enable-ssl --with-ssl \
        --enable-deflate --enable-cgid \
        --with-apr=/usr/bin/apr-1-config \
        --with-apr-util=/usr/bin/apu-1-config \
        --with-pcre=/usr

    make || return 1

    make DESTDIR=${pkgdir} install
    install -D -m755 ${srcdir}/httpd ${pkgdir}/$myprefix/etc/rc.d/httpd
    install -D -m644 ${srcdir}/httpd.logrotate ${pkgdir}/$myprefix/etc/logrotate.d/httpd

    # set sane defaults
    sed -e 's#/usr/lib/httpd/modules/#modules/#' \
        -e 's|#\(Include conf/extra/httpd-multilang-errordoc.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-autoindex.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-languages.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-userdir.conf\)|\1|' \
        -e 's|#\(Include conf/extra/httpd-default.conf\)|\1|' \
        -i ${pkgdir}/$myprefix/conf/httpd.conf
#    mv ${pkgdir}/${myperfix}/sbin/httpd ${pkgdir}/${myprefix}/sbin/${binaryname}
    ln -s ${myprefix}/conf/httpd.conf ${pkgdir}/${myprefix}/etc/httpd.conf        #<------------------------ symlink
}

md5sums=('a5226203aaf97e5b941c41a71c112704'
         'f4d627c64024c1b7b95efb5ffbaa625e'
         'bddd84dafa770d74df1dc1f96bd71823'
         '78b0a8fd3778bccebea2c420aceeb3c8')
md5sums=('a5226203aaf97e5b941c41a71c112704'
         'f4d627c64024c1b7b95efb5ffbaa625e'
         'bddd84dafa770d74df1dc1f96bd71823'
         '78b0a8fd3778bccebea2c420aceeb3c8')

Offline

Board footer

Powered by FluxBB