Building GNR on FreeBSD 8

Revision as of 17:37, 24 March 2015 by Jorge de la Cruz (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developer Article

Article Information

This article applies to the following ZCS versions.

ZCS 6.0 Article ZCS 6.0

General information

Please, read GNR_on_FreeBSD_7 for all the details.

This guide describes building GNR-606 on FreeBSD-8_amd64. If you happen to use i386, please, substitute every amd64 found with i386.

At this point it's good to note that everything should be run as root unless stated otherwise.

Getting the source via Perforce

You need to install Perforce either from /usr/ports:

cd /usr/ports/devel/perforce && make install distclean

or fetch perforce package and its dependency from zimbra.imladris.sk:

cd /tmp && \
    fetch http://zimbra.imladris.sk/download/packages/GNR-606/FreeBSD-8/amd64/perforce/compat6x-amd64-6.4.604000.200810_3.tbz && \
        fetch http://zimbra.imladris.sk/download/packages/GNR-606/FreeBSD-8/amd64/perforce/perforce-08.2_5,1.tbz && \
            pkg_add perforce-08.2_5,1.tbz && rm -f *.tbz

If you are using a csh derivate shell, which is the FreeBSD default, run:

rehash

Setup the perforce enviroment:

setenv P4PORT codes.zimbra.com:2666
setenv P4USER public
setenv P4CLIENT public-view 
setenv P4PASSWD public1234

Fire up the workspace editor:

p4 client

which may look like this:

# A Perforce Client Specification.
#
#  Client:      The client name.
#  Update:      The date this specification was last modified.
#  Access:      The date this client was last used in any way.
#  Owner:       The user who created this client.
#  Host:        If set, restricts access to the named host.
#  Description: A short description of the client (optional).
#  Root:        The base directory of the client workspace.
#  AltRoots:    Up to two alternate client workspace roots.
#  Options:     Client options:
#                      [no]allwrite [no]clobber [no]compress
#                      [un]locked [no]modtime [no]rmdir
#  SubmitOptions:
#                      submitunchanged/submitunchanged+reopen
#                      revertunchanged/revertunchanged+reopen
#                      leaveunchanged/leaveunchanged+reopen
#  LineEnd:     Text file line endings on client: local/unix/mac/win/share.
#  View:        Lines to map depot files into the client workspace.
#
# Use 'p4 help client' to see more about client views and options.

Client: public-view

Update: 2010/04/22 12:13:19

Access: 2010/04/22 12:13:31

Owner:  public

Description:
               Leave host field blank so others may use.

Root:   /home/zimbra-src

AltRoots:
        /Users/public/p4/
        e:\public\p4\

Options:        noallwrite noclobber nocompress locked modtime normdir

SubmitOptions:  submitunchanged

LineEnd:        local

View:
        //depot/... //public-view/...

and change Root: some_path to Root: /home/zimbra-src.

Run the sync:

p4 sync -f //depot/zcs/GNR-606/...
cd /home/zimbra-src/zcs

which should be now downloaded to /home/zimbra-src/zcs/GNR-606.

Getting the source from zimbra.imladris.sk

GNR-606-src.tar.gz

mkdir -p /home/zimbra-src/zcs && \
    cd /home/zimbra-src/zcs && \
        fetch http://zimbra.imladris.sk/download/src/GNR-606-src.tar.gz && \
            tar xzf GNR-606-src.tar.gz

Initial pre-build steps

Let's check our system:

uname -a
FreeBSD zimbra-src-amd64.solko.sk 8.0-STABLE FreeBSD 8.0-STABLE #0: Fri Apr 16 21:23:49 CEST 2010     root@zimbra-src-amd64.solko.sk:/usr/obj/usr/src/sys/GENERIC  amd64

We love some optimizations:

cat /etc/make.conf
COPTFLAGS= -O2 -pipe
CFLAGS= -O2 -fno-strict-aliasing -pipe

Preparing build enviroment via /usr/ports

I created simple "meta" ports which will take care of everything. Since I am a very very creative person I named those: mail/zimbra-rundeps and mail/zimbra-builddeps.

The first installs all dependencies needed to run GNR-606 while the second installs all dependencies needed to build GNR-606. For reasons vastly uknown the second requires the first one.

cd /usr/ports/mail
fetch http://zimbra.imladris.sk/download/ports/usrports_zimbra-rundeps-6.0.6.tgz && \
    tar xzf usrports_zimbra-rundeps-6.0.6.tgz && \
        rm -f usrports_zimbra-rundeps-6.0.6.tgz
fetch http://zimbra.imladris.sk/download/ports/usrports_zimbra-builddeps-6.0.6.tgz && \
    tar xzf usrports_zimbra-builddeps-6.0.6.tgz && \
        rm -f usrports_zimbra-builddeps-6.0.6.tgz
cd /usr/ports/mail/zimbra-builddeps && make -DWITHOUT_X11 -DWITHOUT_XPM -DWITH_XS config-recursive install

followed by an optional:

make distclean

to completely clean the build mess including source files.


If you are able to use /usr/ports you should be able to figure out the configure options (not that it matters much, mostly unimportant stuff). Be warned that GNR-606 requires jdk15 to build while apache-ant requires jdk16 to run so you will end up having both. Building diablo-jdk requires downloading java stuff. How boring!

There are also those 109 Perl modules..


If you are using a csh derivate shell, which is the FreeBSD default, run:

rehash

Preparing build enviroment via zimbra.imladris.sk

Since some people like to compile and others like to install-only I built all the necessary zimbra-builddeps packages.

cd /tmp && \
    fetch http://zimbra.imladris.sk/download/packages/GNR-606/FreeBSD-8/amd64/zimbra-builddeps-8_amd64-6.0.6.tgz && \
        tar xzf zimbra-builddeps-8_amd64-6.0.6.tgz && \
            cd zimbra-builddeps-8_amd64-6.0.6 && \
                pkg_add zimbra-builddeps-6.0.6.tbz && cd /tmp && rm -rf zimbra-builddeps-8_amd64-6.0.6

You need to accept diablo-jdk license twice (jdk15+jdk16).


If you are using a csh derivate shell, which is the FreeBSD default, run:

rehash

Grats, you just saved yourself a lot of time.

Quick-hacks for a better day

Since Zimbra is a Linux lover by nature everything is /bin/bash but guess what.. we have /usr/local/bin/bash:

ln -s /usr/local/bin/bash /bin/bash

Since Zimbra uses gmake and since some ThirdParty (specifically snmp install script) does not honor ${MAKE} macro we have to replace make with gmake globally, otherwise some stuff just won't make (it) with weird errors:

cp -p /usr/bin/make /usr/bin/make.orig && cp /usr/local/bin/gmake /usr/bin/make

We need to compile with jdk15 so tell java about it:

setenv JAVA_VERSION 1.5

You should now get something like this:

java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build diablo-1.5.0-b01)
Java HotSpot(TM) 64-Bit Server VM (build diablo-1.5.0_07-b01, mixed mode)

Patching GNR-606 to comply with FreeBSD

Download the GNR-606 FreeBSD patch and patch the source tree:

cd /home/zimbra-src/zcs && \
    fetch http://zimbra.imladris.sk/download/patches/GNR-606.FreeBSD.patch && \
        cd GNR-606 && patch -p1 -s < ../GNR-606.FreeBSD.patch

Remove unnecessary files:

find . -name "*.orig" | xargs -n1 rm -f

Change modes of our new build/install scripts else the build will fail:

chmod 0755 ZimbraBuild/rpmconf/Spec/Scripts/FreeBSD/*

Rest is handled by libexec/zmfixperms after installation.

Putting diablo-jdk16 into ThirdPartyBuilds

Zimbra requires you to supply jdk16 so we are happy to oblige by using installed version of diablo-jdk16:

mkdir -p ThirdPartyBuilds/FreeBSD_amd64/java && cd ThirdPartyBuilds/FreeBSD_amd64/java && \
    cp -pr /usr/local/diablo-jdk1.6.0 diablo-jdk1.6.0_07 &&\
        tar zcf diablo-jdk1.6.0_07.tgz diablo-jdk1.6.0_07 && \
            rm -rf diablo-jdk1.6.0_07 && cd ../../../

The destination tarball version must match with ZimbraBuild/defs/ThirdParty/FreeBSD_amd64.def!

Building Zimbra Collaboration Suite: GNR-606

Now that's the part where real Zimbra developer's magic kicks in:

cd ZimbraBuild
./buildZCS.sh -t

Let's clean up after the build:

cp -p /usr/bin/make.orig /usr/bin/make && rm -f /usr/bin/make.orig

You should have a fresh build inside:

cd zcs-6.*

Installing Zimbra Collaboration Suite: GNR-606 after a successful build

./install.sh

Further reading

GNR_on_FreeBSD_7

--Solko 19:59, 22 April 2010 (UTC)


Verified Against: GNR-606 on FreeBSD-8-_amd64 Date Created: 4/22/2010
Article ID: https://wiki.zimbra.com/index.php?title=Building_GNR_on_FreeBSD_8 Date Modified: 2015-03-24



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search