JDunphy-CompileZimbraScript

   KB 24615        Last updated on 2024-04-8  




1.00
(one vote)

Helper Script to Compile Zimbra FOSS

It will install the development environment on any of the supported platforms and allow one to build a zimbra release for Version 8.8.15, 9, and 10. Script can be found here: https://raw.githubusercontent.com/JimDunphy/ZimbraScripts/master/src/build_zimbra.sh. To use this script, you must have previously setup your github account (free) and imported your ssh keys to be able to git clone the repositories and have zm-build/build.pl work. If unsure, see this link as Ian's script will be installing the dependencies. The script builds upon these two repositories from github.


Building zimbra amounts to creating a tarball which this script does. Installing this tarball amounts to understanding two parts.

  • you will extract the tar ball and issue install.sh - See zimbra wiki documentation
  • during the above installation, third party components are supplied by pre-built zimbra repositories. (nginx, ldap, etc)


Note: If you use this script and an official patch is released, you will need to repeat the above process. Be extra careful to grab the latest tags. One way is to create a new directory and start clean; otherwise use the tag option for your version. Hint: always do a --clean and view the tags as a sanity check that will be used before building.

Step 1

Install development environment for any supported Zimbra platforms. This will prompt for root via sudo to allow all software and components to be installed.

% ./build_zimbra --init

Step 2

Build the release you want.

% ./build_zimbra --version 10

Useful Commands

% ./build_zimbra --help


        ./build_zimbra.sh
        --init			#first time to setup envioroment (only once)
        --version [10|9|8]      #build release 8.8.15 or 9.0.0 or 10.0.0
        --clean                 #remove everything but BUILDS
        --tags			#create tags for version 10
        --tags8			#create tags for version 8
        --tags9			#create tags for version 9
        -V                      #version of this program
        --dry-run               #show what we would do
        --help

       Example usage:
       ./build_zimbra.sh --init               # first time only
       ./build_zimbra.sh --version 10         # build version 10

       ./build_zimbra.sh --clean; ./build_zimbra.sh --version 9  #build version 9 leaving version 10 around
       ./build_zimbra.sh --clean; ./build_zimbra.sh --version 8  #build version 8 leaving version 9, 10 around
       ./build_zimbra.sh --clean; ./build_zimbra.sh --version 10 --dry-run  #see how to build version 10
       ./build_zimbra.sh --clean; ./build_zimbra.sh --version 10 --dry-run | sh  #build version 10
              or
       ./build_zimbra.sh --clean; ./build_zimbra.sh --version 10  #build version 10

See how it will build version 10.0:

% ./build_zimbra.sh --version 10 --dry-run
#!/bin/sh

git clone --depth 1 --branch "10.0.6" "git@github.com:Zimbra/zm-build.git"
cd zm-build
ENV_CACHE_CLEAR_FLAG=true ./build.pl --ant-options -DskipTests=true --git-default-tag="10.0.7,10.0.6,10.0.5,10.0.4,10.0.2,10.0.1,10.0.0-GA,10.0.0" --build-release-no="10.0.7" --build-type=FOSS --build-release="DAFFODIL" --build-thirdparty-server=files.zimbra.com --no-interactive --build-release-candidate=GA

Now build version 10.0.0 patch 7:

% ./build_zimbra.sh --version 10
Attempting to clone branch 10.0.7...
Cloning into 'zm-build'...
warning: Could not find remote branch 10.0.7 to clone.
fatal: Remote branch 10.0.7 not found in upstream origin
Failed to clone branch 10.0.7. Trying the next tag...
Attempting to clone branch 10.0.6...
Cloning into 'zm-build'...
remote: Enumerating objects: 186, done.
remote: Counting objects: 100% (186/186), done.
remote: Compressing objects: 100% (154/154), done.
remote: Total 186 (delta 43), reused 93 (delta 18), pack-reused 0
Receiving objects: 100% (186/186), 213.70 KiB | 1.22 MiB/s, done.
Resolving deltas: 100% (43/43), done.
Note: switching to '63dacdd96e958c4c3a0493cbbae7ae113d3bb858'.
...
...
...sudo bash -s <<"EOM_SCRIPT"
[ -f /etc/redhat-release ] && ( yum install -y epel-release && yum install -y nginx && service nginx start )
[ -f /etc/redhat-release ] || ( apt-get -y install nginx && service nginx start )
tee /etc/nginx/conf.d/zimbra-pkg-archives-host.conf <<EOM
server {
  listen 8008;
  location / {
     root /home/jad/build-zimbra/zmbuild/my-automated-build/BUILDS;
     autoindex on;
  }
}
EOM
service httpd stop 2>/dev/null
service nginx restart
service nginx status
EOM_SCRIPT


=========================================================================================================

BUILDS/RHEL8_64-DAFFODIL-1007-20240319140057-FOSS-1000/zcs-10.0.7_GA_1000.RHEL8_64.20240319140057.tgz
BUILDS/RHEL8_64-KEPLER-900-20240319113455-FOSS-1000/zcs-9.0.0_GA_P39_1000.RHEL8_64.20240319113455.tgz
BUILDS/RHEL8_64-JOULE-8815-20240319111605-FOSS-1000/zcs-8.8.15_GA_P46_1000.RHEL8_64.20240319111605.tgz

See what it takes to build Zimbra version 8:

./build_zimbra.sh --version 8 --dry-run
#!/bin/sh

git clone --depth 1 --branch "8.8.15.p45" "git@github.com:Zimbra/zm-build.git"
cd zm-build
ENV_CACHE_CLEAR_FLAG=true ./build.pl --ant-options -DskipTests=true --git-default-tag="8.8.15.p46,8.8.15.p45,8.8.15.p44,8.8.15.p43,8.8.15.p41,8.8.15.p40,8.8.15.P40,8.8.15.p39.1,8.8.15.p39,8.8.15.p37,8.8.15.p36,8.8.15.p35,8.8.15.p34,8.8.15.p33,8.8.15.p32,8.8.15.p31.1,8.8.15.p31,8.8.15.p30,8.8.15.p29,8.8.15.p28,8.8.15.p27,8.8.15.p26,8.8.15.p25,8.8.15.p24,8.8.15.p17,8.8.15.p23,8.8.15.p22,8.8.15.p21,8.8.15.p20,8.8.15.p19,8.8.15.p18,8.8.15.p15.nysa,8.8.15.p16,8.8.15.p15,8.8.15.p14,8.8.15.p13,8.8.15.p12,8.8.15.p11,8.8.15.p10,8.8.15.p9,8.8.15.p8,8.8.15.p7,8.8.15.p6.1,8.8.15.p6,8.8.15.p5,8.8.15.p4,8.8.15.p3,8.8.15.p2,8.8.15.p1,8.8.15.0,8.8.15" --build-release-no="8.8.15" --build-type=FOSS --build-release="JOULE" --build-thirdparty-server=files.zimbra.com --no-interactive --build-release-candidate=GA_P46

Now Version 9.

./build_zimbra.sh --version 9 --dry-run
#!/bin/sh

git clone --depth 1 --branch "9.0.0.p38" "git@github.com:Zimbra/zm-build.git"
cd zm-build
ENV_CACHE_CLEAR_FLAG=true ./build.pl --ant-options -DskipTests=true --git-default-tag="9.0.0.p39,9.0.0.p38,9.0.0.p37,9.0.0.p36,9.0.0.p34,9.0.0.p33,9.0.0.P33,9.0.0.p32.1,9.0.0.p32,9.0.0.p30,9.0.0.p29,9.0.0.p28,9.0.0.p27,9.0.0.p26,9.0.0.p25,9.0.0.p24.1,9.0.0.p24,9.0.0.p23,9.0.0.p22,9.0.0.p21,9.0.0.p20,9.0.0.p19,9.0.0.p18,9.0.0.p17,9.0.0.p16,9.0.0.p15,9.0.0.p14,9.0.0.p13,9.0.0.p12,9.0.0.p11,9.0.0.p10,9.0.0.p9,9.0.0.p8,9.0.0.p7,9.0.0.p6,9.0.0.p5,9.0.0.p4,9.0.0.p3,9.0.0.p2,9.0.0.p1,9.0.0" --build-release-no="9.0.0" --build-type=FOSS --build-release="KEPLER" --build-thirdparty-server=files.zimbra.com --no-interactive --build-release-candidate=GA_P39

Limitations

This script attempts to build it's releases based on the available tags at the time of compile. It will walk through attempting to guess at the tags used as Zimbra NETWORK builds are not based on the public git tree that we have access to.

FOSS Builds and Projects

More articles written by me, https://wiki.zimbra.com/wiki/JDunphy-Notes

Jump to: navigation, search