Skip to content

Commit

Permalink
add an 8.4 dir
Browse files Browse the repository at this point in the history
  • Loading branch information
jcupitt committed Aug 18, 2016
1 parent b905561 commit 6f54fee
Show file tree
Hide file tree
Showing 13 changed files with 1,397 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 8.3/vips.modules
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@
<autotools id="libvips-web"
autogen-sh="configure"
autogenargs="--enable-debug=no --without-OpenEXR --without-matio --without-ppm --without-analyze --without-radiance --disable-introspection "
makeargs="CFLAGS=-O3 CXXFLAGS=-O3"
makeargs="CFLAGS=-g CXXFLAGS=-g"
>

<branch
Expand Down
80 changes: 80 additions & 0 deletions 8.4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
## build-win64

This set of scripts build a 64-bit vips binary for Windows. They won't
make a 64-bit nip2, see `build-win32` for that.

You don't need to follow these instructions to make a Windows binary,
instead, see the README in the parent directory to make a binary using
a Docker container. Only keep reading if you want to work on the build
scripts.

On Ubuntu, follow these steps:

### Install mingw

You need the mingw cross-compiler to generate 64-bit Windows binaries.

sudo apt-get install mingw-w64 mingw-w64-tools

The `tools` package provides `gendef`, which we use to generate .def files for
our DLLs.

### Install `jhbuild`

I installed from git, but the packaged `jhbuild` might work.

Follow these instructions:

https://developer.gnome.org/jhbuild/3.12/getting-started.html.en

Briefly:

sudo apt-get install yelp-tools
git clone git://git.gnome.org/jhbuild
cd jhbuild
./autogen.sh
make
make install

add `~/.local/bin` to your `PATH`.

### Check the build variables

Have a look in `variables.sh` and make sure the version numbers and other
settings are right.

### Fetch binary dependencies

We use some binary zips for basic things like `libz` and `gettext`. Run:

./get-win64-packages.sh

To fetch the zips. Run:

./unpack.sh

To wipe `inst/` and reinitialize it from the zips.

### Build

Run:

export BASEDIR=$(pwd)
jhbuild --file=jhbuildrc build --nodeps libvips-all

BASEDIR is needed by vips.modules to pass the toolchain file to cmake.
It will take a while.

You can use libvips-web and libvips-transform as targets too.

## Package

Run:

./package-vipsdev.sh

To make a nice `vips-dev.zip` package.

## TODO

* more testing
19 changes: 19 additions & 0 deletions 8.4/Toolchain-x86_64-w64-mingw32.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)

# which compilers to use for C and C++
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
SET(CMAKE_AR x86_64-w64-mingw32-ar)
SET(CMAKE_RANLIB x86_64-w64-mingw32-ranlib)

# target environment location
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 /home/john/GIT/build-win64/8.2/inst)

# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
34 changes: 34 additions & 0 deletions 8.4/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# the whole build process

. variables.sh

# export this to vips.modules ... cmake needs it
export BASEDIR=$basedir

vips_site=http://www.vips.ecs.soton.ac.uk/supported/$vips_version

# basic setup ... must do this before the native build, since it'll wipe the
# install area
./get-win64-packages.sh && \
./unpack.sh &&

# we need to do a native linux build to generate a typelib --
# the gobject-introspection machinery won't work in a cross-compiler
if [ ! -d $linux_install ]; then
( mkdir native-linux-build; cd native-linux-build; \
vips_name=$vips_package-$vips_version.$vips_minor_version
wget $vips_site/${vips_name}.tar.gz &&
tar xf ${vips_name}.tar.gz &&
cd $vips_name &&
CFLAGS="-g" CXXFLAGS="-g" ./configure --prefix=$basedir/vips &&
make &&
make install )
fi

# do the win64 build and package
if [ -d $linux_install ]; then
jhbuild --file=jhbuildrc build --nodeps libvips-$DEPS && \
./package-vipsdev.sh
fi
36 changes: 36 additions & 0 deletions 8.4/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

. variables.sh

echo wiping native build

rm -rf $linux_install
rm -rf native-linux-build

echo wiping install area $installdir

rm -rf $installdir
mkdir $installdir

echo cleaning checkout area $checkoutdir

for i in $checkoutdir/*; do
if [ -d $i ]; then
rm -rf $i
fi
done

echo cleaning misc files

rm -f $basedir/*.zip
rm -f $basedir/*.exe

rm -rf $vips_package-$vips_version
rm -rf $nip2_package-$nip2_version

rm -rf nsis/$nip2_package-$nip2_version
rm -f nsis/$nip2_package-$nip2_version-setup.exe
rm -f nsis/$nip2_package-$nip2_version-setup.zip
rm -f nsis/makensis.log

rm -rf $basedir/$vips_package-dev-$vips_version
37 changes: 37 additions & 0 deletions 8.4/gendeflibs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# this script makes .def and .lib files for all the dlls we've built

. variables.sh
dlltool=${mingw_prefix}dlltool

# set -x

cd $repackagedir

for dllfile in bin/*.dll; do
base=$(basename $dllfile .dll)

# dll names can have extra versioning in ... remove any trailing
# "-\d+" pattern
pure=$base
if [[ $pure =~ (.*)-[0-9]+$ ]]; then
pure=${BASH_REMATCH[1]}
fi

defname=$pure.def
libname=$pure.lib

if [ ! -f lib/$defname ]; then
echo generating lib/$defname file for $base
gendef - $dllfile > lib/$defname
fi

if [ ! -f lib/$libname ]; then
echo generating lib/$libname file for $base
$dlltool -d lib/$defname -l lib/$libname -D $dllfile
fi
done



34 changes: 34 additions & 0 deletions 8.4/get-win64-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

. variables.sh

mkdir -p $installdir
mkdir -p $packagedir
mkdir -p $checkoutdir

while read PACKAGE; do
if [[ $PACKAGE =~ [^/]*$ ]]; then
NAME=$BASH_REMATCH

# see if we need to download the package.
if [ ! -e "$packagedir/$NAME" ]; then
echo "fetching $NAME ..."
( cd $packagedir ; \
wget ftp://ftp.gnome.org/pub/GNOME/binaries/win64/$PACKAGE )
fi
else
echo "I don't know what to do with $PACKAGE as it doesn't match anything I am looking for."
fi
done << EOF
dependencies/expat_2.0.1-3_win64.zip
dependencies/expat-dev_2.0.1-3_win64.zip
dependencies/fontconfig_2.8.0-2_win64.zip
dependencies/fontconfig-dev_2.8.0-2_win64.zip
dependencies/freetype_2.4.4-1_win64.zip
dependencies/freetype-dev_2.4.4-1_win64.zip
dependencies/gettext-runtime-dev_0.18.1.1-2_win64.zip
dependencies/gettext-runtime_0.18.1.1-2_win64.zip
dependencies/win-iconv-dev_tml-20100912_win64.zip
dependencies/zlib_1.2.5-1_win64.zip
dependencies/zlib-dev_1.2.5-1_win64.zip
EOF
130 changes: 130 additions & 0 deletions 8.4/jhbuildrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# -*- mode: python -*-
# -*- coding: utf-8 -*-

# get the directory this source is in ... we assume we are always run in this
# directory
basedir = os.getcwd()

# checkoutroot: path to download packages elsewhere
# prefix: target path to install the compiled binaries
# jhbuild hates relative paths, sadly
checkoutroot = os.path.join(basedir, 'checkout')
prefix = os.path.join(basedir, 'inst')
os.environ['prefix'] = prefix

# what module set should be used. The default can be found in
# jhbuild/defaults.jhbuildrc, but can be any file in the modulesets directory
# or a URL of a module set file on a web server.
moduleset = 'vips.modules'

# HOST ... the thing that will run the executable we generate
# BUILD ... the thing doing the compiling
# TARGET ... complicated, but same as host
os.environ['BUILD'] = 'x86_64-pc-linux-gnu'
os.environ['HOST'] = 'x86_64-w64-mingw32'
os.environ['TARGET'] = 'x86_64-w64-mingw32'

# try to stop our enclosing pkg path getting in
# basedir/lib/pkgconfig is added for us later
os.environ['PKG_CONFIG_PATH'] = ''
addpath('PKG_CONFIG_PATH', os.path.join(prefix, 'lib', 'pkgconfig'))

# pkg-config will always look in PKG_CONFIG_LIBDIR (by default
# /usr/lib/pkgconfig) after searching PKG_CONFIG_PATH ... we need to stop this
# or it'll see host .pc files
os.environ['PKG_CONFIG_LIBDIR'] = os.path.join(prefix, 'lib', 'pkgconfig')

# .pc files from binary packages have something like
# prefix=c:/devel/target/f3002dbeeb43fd4ea5385fb6fa4de06f
# at the top ... we need to override this prefix with our own
# don't use "--define-variable=prefix=/poop", some pkg-config get confused
os.environ['PKG_CONFIG'] = '/usr/bin/pkg-config --define-variable prefix=' + prefix

# comment these two out or we get pkg-config errors, investigate
# pkg-config will always search $libdir, usually /usr/lib/pkgconfig -- we want
# to stop it seeing any host packages, so turn this off
#os.environ['PKG_CONFIG_LIBDIR'] = ''
#addpath('PKG_CONFIG_LIBDIR', os.path.join(prefix, 'lib', 'pkgconfig'))

# Prefix for all the tools
# mingw-w64 on debian uses this:
mingw_tool_prefix = 'x86_64-w64-mingw32-'

mingw_tools = {
'ADDR2LINE': 'addr2line',
'AS': 'as',
'CC': 'gcc-win32',
'CPP': 'cpp-win32',
'CPPFILT': 'c++filt',
'CXX': 'g++-win32',
'DLLTOOL': 'dlltool',
'DLLWRAP': 'dllwrap',
'GCOV': 'gcov-win32',
'LD': 'ld',
'NM': 'nm',
'OBJCOPY': 'objcopy',
'OBJDUMP': 'objdump',
'READELF': 'readelf',
'SIZE': 'size',
'STRINGS': 'strings',
'WINDRES': 'windres',
'AR': 'ar',
'RANLIB': 'ranlib',
'STRIP': 'strip'
}

# Exporting all as environment variables with its prefix
mingw_tools_args = str()
for tool in mingw_tools.keys():
fullpath_tool = mingw_tool_prefix + mingw_tools[tool]
os.environ[tool] = fullpath_tool

# Added another common env var name for windres
os.environ['RC'] = os.environ['WINDRES']

# Exporting tool flags enviroment variables
os.environ['LDFLAGS'] = '-L'+prefix+'/lib'
os.environ['CFLAGS'] = '-mms-bitfields -march=x86-64 -I'+prefix+'/include'
os.environ['CPPFLAGS'] = '-I'+prefix+'/include'
os.environ['CXXFLAGS'] = '-mms-bitfields -march=x86-64'
os.environ['ARFLAGS'] = '-ar rcs'
os.environ['INSTALL'] = os.path.expanduser('~/.local/bin/install-check')

# turn on the optimiser
os.environ['CFLAGS'] += ' -O2 '
os.environ['CXXFLAGS'] += ' -O2 '

# turn on debugging
#os.environ['CFLAGS'] += ' -g '
#os.environ['CXXFLAGS'] += ' -g '

# Populating autogenargs
autogenargs = ' --build='+os.environ['BUILD']
autogenargs += ' --host='+os.environ['HOST']
autogenargs += ' --target='+os.environ['TARGET']
autogenargs += ' --disable-debug'
autogenargs += ' --enable-all-warnings --enable-maintainer-mode'

for tool in ('AR', 'RANLIB', 'STRIP', 'AS',
'DLLTOOL', 'OBJDUMP', 'NM', 'WINDRES'):
autogenargs += ' '+tool+'="'+os.environ[tool]+'" '

# fetch modules from this dir ... in fact, we just use the 'vips.modules'
# file
modulesets_dir = basedir

# we just want the local ones
use_local_modulesets = True

# only rebuild on a change
build_policy = "updated-deps"

# Show a tray icon using zenity
notrayicon = True

# whether not to emit notifications through the notification daemon
nonotify = True

# trim jhbuild's default parallelisation down ... it uses 2x#cores jobs, which
# can actually melt some hardware
makeargs = '-j1'
Loading

0 comments on commit 6f54fee

Please sign in to comment.