Browse Source

add support for CentOS 7 target

Only 64-bit binaries are supported (similar to upstream). The only
supported OS for the build host is now Ubuntu 14.10 due to the
dependency on rinse >= 3.0.1, which added support for CentOS 7.

Fixes #1992
Ashish Kulkarni 10 years ago
parent
commit
0037e0ead8
2 changed files with 32 additions and 2 deletions
  1. 2 1
      INSTALL.md
  2. 30 1
      scripts/build.py

+ 2 - 1
INSTALL.md

@@ -33,7 +33,7 @@ and [non standard home directories](https://github.com/wkhtmltopdf/wkhtmltopdf/i
 (i.e. not located in `/home`) are not supported -- you are advised to
 use a VM instead to build wkhtmltopdf.
 
-Building is supported only on the latest stable Debian/Ubuntu releases, and
+Building is supported only on the current Ubuntu release (14.10), and
 the binaries are produced in a self-contained chroot environment for the
 target distribution -- you will need to first setup the build environment
 and then only you can perform the build for a 32-bit or 64-bit binary.
@@ -44,6 +44,7 @@ Target         | Setup of Build Environment                    | Building 32-bit
 Debian Wheezy  | `sudo scripts/build.py setup-schroot-wheezy`  | `scripts/build.py wheezy-i386`           | `scripts/build.py wheezy-amd64`
 Ubuntu Trusty  | `sudo scripts/build.py setup-schroot-trusty`  | `scripts/build.py trusty-i386`           | `scripts/build.py trusty-amd64`
 Ubuntu Precise | `sudo scripts/build.py setup-schroot-precise` | `scripts/build.py precise-i386`          | `scripts/build.py precise-amd64`
+CentOS 7       | `sudo scripts/build.py setup-schroot-centos7` | not available                            | `scripts/build.py centos7-amd64`
 CentOS 6       | `sudo scripts/build.py setup-schroot-centos6` | `scripts/build.py centos6-i386`          | `scripts/build.py centos6-amd64`
 CentOS 5       | `sudo scripts/build.py setup-schroot-centos5` | `scripts/build.py centos5-i386`          | `scripts/build.py centos5-amd64`
 MinGW-w64      | `sudo scripts/build.py setup-mingw-w64`       | `scripts/build.py mingw-w64-cross-win32` | `scripts/build.py mingw-w64-cross-win64`

+ 30 - 1
scripts/build.py

@@ -34,6 +34,7 @@ BUILDERS = {
     'setup-mingw-w64':       'setup_mingw64',
     'setup-schroot-centos5': 'setup_schroot',
     'setup-schroot-centos6': 'setup_schroot',
+    'setup-schroot-centos7': 'setup_schroot',
     'setup-schroot-wheezy':  'setup_schroot',
     'setup-schroot-trusty':  'setup_schroot',
     'setup-schroot-precise': 'setup_schroot',
@@ -42,6 +43,7 @@ BUILDERS = {
     'centos5-amd64':         'linux_schroot',
     'centos6-i386':          'linux_schroot',
     'centos6-amd64':         'linux_schroot',
+    'centos7-amd64':         'linux_schroot',
     'wheezy-i386':           'linux_schroot',
     'wheezy-amd64':          'linux_schroot',
     'trusty-i386':           'linux_schroot',
@@ -221,6 +223,13 @@ FPM_SETUP = {
         '--depends':         ['fontconfig', 'freetype', 'libpng', 'zlib', 'libjpeg', 'openssl',
                               'libX11', 'libXext', 'libXrender', 'libstdc++', 'glibc']
     },
+    'centos7': {
+        '-t':                'rpm',
+        '--epoch':           '1',
+        '--rpm-compression': 'xz',
+        '--depends':         ['fontconfig', 'freetype', 'libpng', 'zlib', 'libjpeg-turbo', 'openssl',
+                              'libX11', 'libXext', 'libXrender', 'libstdc++', 'glibc']
+    },
     'osx': {
         '-t':                         'osxpkg',
         '-C':                         'pkg',
@@ -304,6 +313,19 @@ deb http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe
         ('write_file', 'update.sh', 'yum update -y\n'),
         ('fpm_setup',  'fpm_package.sh'),
         ('schroot_conf', 'CentOS 6')
+    ],
+
+    'centos7:amd64': [
+        ('rinse', 'centos-7'),
+        ('shell', 'yum update -y'),
+        ('append_file', 'etc/yum.conf', 'exclude = *.i?86\n'),
+        ('shell', 'yum install -y gcc gcc-c++ make diffutils perl ruby-devel rubygems rpm-build libffi-devel'),
+        ('shell', 'yum install -y openssl-devel libX11-devel libXrender-devel libXext-devel fontconfig-devel freetype-devel libjpeg-turbo-devel libpng-devel zlib-devel'),
+        ('shell', 'yum reinstall -y binutils'), # binutils isn't properly installed (no /usr/bin/ld) hence reinstall it
+        ('shell', 'gem install fpm --no-ri --no-rdoc'),
+        ('write_file', 'update.sh', 'yum update -y\n'),
+        ('fpm_setup',  'fpm_package.sh'),
+        ('schroot_conf', 'CentOS 7')
     ]
 }
 
@@ -691,13 +713,20 @@ def build_setup_schroot(config, basedir):
 
     login  = os.environ.get('SUDO_USER') or get_output('logname')
     chroot = config[1+config.rindex('-'):]
+
+    command_list = CHROOT_SETUP.get(chroot)
+    if not command_list and ('%s:amd64' % chroot) in CHROOT_SETUP:
+        command_list = CHROOT_SETUP['%s:amd64' % chroot]
+        if 'i386' in ARCH:
+            del ARCH[ARCH.index('i386')]
+
     for arch in ARCH:
         message('******************* %s-%s\n' % (chroot, arch))
         base_dir = os.environ.get('WKHTMLTOX_CHROOT') or '/var/chroot'
         root_dir = os.path.join(base_dir, 'wkhtmltopdf-%s-%s' % (chroot, arch))
         rmdir(root_dir)
         mkdir_p(root_dir)
-        for command in CHROOT_SETUP[chroot]:
+        for command in command_list:
             # handle architecture-specific commands
             name = command[0]
             if ':' in name: