Merge branch 'master' into rebase-1-for-2015
Adds recursive build-from-source support for windows and linux (OS X still WIP). Travis (linux/mac, GitHub only), drone (any git), and AppVeyor (windows) CI configurations provided.master
commit
bc372f2bb1
|
@ -17,7 +17,8 @@ CTestTestfile.cmake
|
|||
libimagequant
|
||||
libimagequant-prefix
|
||||
src/deps.mk
|
||||
|
||||
deps
|
||||
Release_GD
|
||||
# Autotools related files.
|
||||
*.l[ao]
|
||||
.deps
|
||||
|
@ -45,19 +46,18 @@ Makefile.in
|
|||
/m4/ltsugar.m4
|
||||
/m4/ltversion.m4
|
||||
/m4/lt~obsolete.m4
|
||||
/src/config.h
|
||||
/src/config.hin
|
||||
/src/stamp-h1
|
||||
|
||||
# Common GD artifacts.
|
||||
/config/gdlib-config
|
||||
/config/gdlib.pc
|
||||
/src/config.h
|
||||
/src/annotate
|
||||
/src/circletexttest
|
||||
/src/fontconfigtest
|
||||
/src/fontsizetest
|
||||
/src/fontwheeltest
|
||||
/src/gd.h
|
||||
/src/gd2copypal
|
||||
/src/gd2time
|
||||
/src/gd2togif
|
||||
|
@ -218,3 +218,9 @@ Makefile.in
|
|||
# Doc artifacts
|
||||
/docs/naturaldocs/html/
|
||||
/docs/naturaldocs/project/Data/
|
||||
|
||||
gd-dotnet-bindings-generator
|
||||
build_msvc12_x86
|
||||
build_msvc12_x64
|
||||
build_mingw_x86
|
||||
build_mingw_x64
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
language: cpp
|
||||
|
||||
env:
|
||||
- tbs_arch=x86
|
||||
- tbs_arch=x64
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
before_install:
|
||||
- if [ "$TRAVIS_OS_NAME" = "linux" ];
|
||||
then
|
||||
sudo apt-get update -qq;
|
||||
sudo apt-get -y install nasm;
|
||||
if [ "$tbs_arch" = "x86" ];
|
||||
then
|
||||
sudo apt-get -y install gcc-multilib;
|
||||
sudo apt-get -y install g++-multilib;
|
||||
fi
|
||||
fi
|
||||
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ];
|
||||
then
|
||||
brew install nasm;
|
||||
fi
|
||||
|
||||
script:
|
||||
- ./thumbs.sh make
|
||||
- ./thumbs.sh check
|
|
@ -0,0 +1,207 @@
|
|||
version: 2.1.1.{build}
|
||||
shallow_clone: true
|
||||
|
||||
|
||||
environment:
|
||||
# settings
|
||||
min_build: 0 # if 1 overwrites tbs_gd_* flags to leave png and jpeg
|
||||
|
||||
tbs_gd_png: 1
|
||||
tbs_gd_jpeg: 1
|
||||
tbs_gd_freetype: 1
|
||||
tbs_gd_iconv: 0 # todo: add iconv thumbs
|
||||
tbs_gd_tiff: 1
|
||||
|
||||
build_bindings: 1 # build .net bidnings
|
||||
pack_dlls: 1 # pack dll with upx
|
||||
|
||||
|
||||
matrix:
|
||||
- tbs_arch: "x86"
|
||||
tbs_tools: "msvc12"
|
||||
tbs_static_runtime: 0
|
||||
|
||||
- tbs_arch: "x64"
|
||||
tbs_tools: "msvc12"
|
||||
tbs_static_runtime: 0
|
||||
|
||||
- tbs_arch: "x86"
|
||||
tbs_tools: "mingw"
|
||||
tbs_static_runtime: 1
|
||||
|
||||
- tbs_arch: "x64"
|
||||
tbs_tools: "mingw"
|
||||
tbs_static_runtime: 1
|
||||
|
||||
|
||||
|
||||
install:
|
||||
- if [%min_build%]==[1] (
|
||||
SET tbs_gd_png=1&&
|
||||
SET tbs_gd_jpeg=1&&
|
||||
SET tbs_gd_freetype=0&&
|
||||
SET tbs_gd_iconv=0&&
|
||||
SET tbs_gd_tiff=0)
|
||||
|
||||
- ps: if($env:build_platform -eq 'x64') {
|
||||
$env:vcvar_arg = 'x86_amd64';
|
||||
}
|
||||
else {
|
||||
$env:vcvar_arg = 'x86';
|
||||
}
|
||||
|
||||
- ps: 'function prepend($file, $line) { Set-Content (Resolve-Path $file) -value $line,(Get-Content (Resolve-Path $file)) }'
|
||||
|
||||
# get common functions
|
||||
- git clone https://github.com/imazen/gd-appveyor-helpers
|
||||
- ps: . .\gd-appveyor-helpers\appveyor_funcs.ps1
|
||||
|
||||
|
||||
# fetch deps
|
||||
- mkdir deps
|
||||
- ps: if($env:build_bindings -eq 1) { invoke 'git' 'clone https://github.com/imazen/gd-dotnet-bindings-generator.git --depth 1' }
|
||||
|
||||
- nuget install zlib-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/zlib-94hmpf3q011d
|
||||
- ps: move zlib*\* deps -force
|
||||
- if [%tbs_tools%]==[mingw] move deps\libzlibstatic.a deps\libz.a
|
||||
- if [%tbs_tools%]==[msvc12] move deps\zlibstatic.lib deps\zlib.lib
|
||||
- SET tbsd_zlib_built=1
|
||||
- SET tbsd_zlib_incdir=deps
|
||||
- SET tbsd_zlib_libdir=deps
|
||||
|
||||
- if [%tbs_gd_jpeg%]==[1] (
|
||||
nuget install libjpeg-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/libjpeg-turbo-t70qw53csfhj &&
|
||||
powershell -Command "move libjpeg*\* deps -force" &&
|
||||
(if [%tbs_tools%]==[msvc12] move deps\jpeg_static.lib deps\jpeg.lib) &&
|
||||
SET tbsd_libjpeg_turbo_built=1)
|
||||
|
||||
- if [%tbs_gd_png%]==[1] (
|
||||
nuget install libpng-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/libpng-7hwq4pmmrc48 &&
|
||||
powershell -Command "move libpng*\* deps -force" &&
|
||||
(if [%tbs_tools%]==[mingw] move deps\libpng16.a deps\libpng.a) &&
|
||||
(if [%tbs_tools%]==[msvc12] move deps\libpng16_static.lib deps\png.lib) &&
|
||||
SET tbsd_libpng_built=1)
|
||||
|
||||
- if [%tbs_gd_freetype%]==[1] (
|
||||
nuget install freetype-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/freetype-vf7bw7v5ec29 &&
|
||||
powershell -Command "move freetype*\* deps -force" &&
|
||||
(if [%tbs_tools%]==[msvc12] move deps\freetype_static.lib deps\freetype.lib) &&
|
||||
SET tbsd_freetype_built=1)
|
||||
|
||||
- if [%tbs_gd_tiff%]==[1] (
|
||||
nuget install libtiff-%tbs_tools%-%tbs_arch%-master -Source https://ci.appveyor.com/nuget/libtiff-i3h8tqqy7o7b &&
|
||||
powershell -Command "move libtiff*\* deps -force" &&
|
||||
(if [%tbs_tools%]==[msvc12] move deps\tiff_static.lib deps\tiff.lib) &&
|
||||
SET tbsd_libtiff_built=1)
|
||||
|
||||
# remove dyn libs
|
||||
- del deps\*.dll*
|
||||
|
||||
|
||||
|
||||
# get upx (cinst broken; gets dos ver)
|
||||
#- if [%pack_dlls%]==[1] cinst upx
|
||||
- if [%pack_dlls%]==[1] (
|
||||
curl -L -o upx.zip http://upx.sourceforge.net/download/upx391w.zip &&
|
||||
7z e upx.zip *.exe -r )
|
||||
|
||||
# get mingw-w64-dgn (C:\mingw64)
|
||||
- ps: if($env:tbs_tools -eq 'mingw' -and $env:tbs_arch -eq 'x64') {
|
||||
invoke 'curl' '-L -o mw64.7z "http://libgd.blob.core.windows.net/mingw/mingw-w64-dgn-x86_64-20141001.7z"';
|
||||
invoke '7z' 'x -oC:\ mw64.7z'; }
|
||||
|
||||
# get mingw-w64-32bit (C:\mingw32)
|
||||
- ps: if($env:tbs_tools -eq 'mingw' -and $env:tbs_arch -eq 'x86' -and $env:build_bindings -eq 1) {
|
||||
invoke 'curl' '-L -o mw64-32.7z "http://libgd.blob.core.windows.net/mingw/i686-4.9.1-release-posix-dwarf-rt_v3-rev1.7z"';
|
||||
invoke '7z' 'x -oC:\ mw64-32.7z'; }
|
||||
|
||||
|
||||
|
||||
|
||||
build_script:
|
||||
- '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall" %vcvar_arg%'
|
||||
- if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x86] SET PATH=C:\mingw\bin;%PATH%
|
||||
- if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x64] SET PATH=C:\mingw64\bin;%PATH%
|
||||
|
||||
- SET zip=libgd-%tbs_tools%-%tbs_arch%.zip
|
||||
- ps: $nupkg_b = "libgd-$($env:tbs_tools)-$($env:tbs_arch)-$($env:APPVEYOR_REPO_BRANCH)";
|
||||
- ps: $nupkg_c = "libgd-$($env:tbs_tools)-$($env:tbs_arch)-$($env:APPVEYOR_REPO_COMMIT)";
|
||||
|
||||
- if [%tbs_arch%]==[x86] SET dll_make=C:\mingw32\bin\mingw32-make.exe
|
||||
- if [%tbs_arch%]==[x64] SET dll_make=C:\mingw64\bin\mingw32-make.exe
|
||||
|
||||
- for /f "tokens=*" %%i in ('thumbs list_bin') do set dll_name=%%i
|
||||
- SET dll_name=%dll_name:/=\%
|
||||
- for /f %%i in ("%dll_name%") do set dll_basename=%%~nxi
|
||||
- SET dll_raw=%dll_name%.raw
|
||||
- if [%tbs_tools%]==[msvc12] SET cli_args=%dll_basename%
|
||||
- if [%tbs_tools%]==[mingw] SET cli_args=%dll_make% %dll_basename%
|
||||
|
||||
- thumbs make
|
||||
- for /f "tokens=*" %%i in ('thumbs list') do set files=%%i
|
||||
|
||||
- copy %dll_name% %dll_raw%
|
||||
- if [%pack_dlls%]==[1] (
|
||||
appveyor PushArtifact %dll_raw% &&
|
||||
del %dll_name% &&
|
||||
upx -o %dll_name% %dll_raw% )
|
||||
|
||||
- 7z a %zip% %files%
|
||||
- appveyor PushArtifact %zip%
|
||||
|
||||
- ps: if(Test-Path $env:zip) {
|
||||
zip2nuget $env:zip $nupkg_b;
|
||||
zip2nuget $env:zip $nupkg_c; }
|
||||
|
||||
|
||||
# build bindings
|
||||
|
||||
- ps: if($env:with_tiff -eq 0 -and $env:build_bindings -eq 1) {
|
||||
prepend 'gd-dotnet-bindings-generator\LibGD.CLI\LibGDExtensions.cs' '#define NO_TIFF';
|
||||
$env:test_defs += 'NO_TIFF;' }
|
||||
- ps: if($env:with_freetype -eq 0 -and $env:build_bindings -eq 1) {
|
||||
prepend 'gd-dotnet-bindings-generator\LibGD.CLI\LibGDExtensions.cs' '#define NO_FREETYPE';
|
||||
$env:test_defs += 'NO_FREETYPE;' }
|
||||
|
||||
- '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall"'
|
||||
- if [%build_bindings%]==[1] (
|
||||
cd gd-dotnet-bindings-generator &&
|
||||
msbuild LibGD.CLI\LibGD.CLI.csproj /p:Configuration=Debug /p:Platform=AnyCPU /v:m &&
|
||||
copy ..\%dll_raw% LibGD.CLI\bin\Debug\%dll_basename% &&
|
||||
cd LibGD.CLI\bin\Debug &&
|
||||
LibGD.CLI.exe %APPVEYOR_BUILD_FOLDER%\src %cli_args% &&
|
||||
cd ..\..\.. &&
|
||||
msbuild LibGD.Tests\LibGD.Tests.csproj /p:Configuration=Debug /p:Platform=AnyCPU /p:DefineConstants="%test_defs%" /v:m &&
|
||||
cd..)
|
||||
|
||||
- SET zip=LibGDSharp-%tbs_tools%-%tbs_arch%.zip
|
||||
- ps: if($env:build_bindings -eq 1) {
|
||||
invoke '7z' "a $($env:zip)
|
||||
.\$($env:dll_pack)
|
||||
.\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\_iobuf.cs
|
||||
.\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\LibGD.cs
|
||||
.\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\LibGDExtensions.cs
|
||||
.\gd-dotnet-bindings-generator\LibGD.CLI\bin\Debug\LibGDSharp.dll";
|
||||
Push-AppveyorArtifact $($env:zip); }
|
||||
|
||||
- appveyor PushArtifact src\config.h
|
||||
|
||||
|
||||
|
||||
|
||||
test_script:
|
||||
- SET fail=0
|
||||
- thumbs check || SET fail=1 & ver > nul
|
||||
- ps: Push-Ctest-Results 'build'
|
||||
- ps: Push-AppveyorArtifact build\Testing\Temporary\LastTest.log
|
||||
- exit %fail%
|
||||
|
||||
- if [%build_bindings%]==[1] (
|
||||
copy %dll_name% gd-dotnet-bindings-generator\LibGD.Tests\bin\Debug\%dll_basename% &&
|
||||
(if [%tbs_arch%]==[x86] (nunit-console-x86 gd-dotnet-bindings-generator\LibGD.Tests\bin\Debug\LibGD.Tests.dll)
|
||||
else if [%tbs_arch%]==[x64] (nunit-console gd-dotnet-bindings-generator\LibGD.Tests\bin\Debug\LibGD.Tests.dll)) &&
|
||||
appveyor PushArtifact TestResult.xml )
|
||||
|
||||
on_success:
|
||||
- ps: Push-AppveyorArtifact "$nupkg_b*.nupkg"
|
||||
- ps: Push-AppveyorArtifact "$nupkg_c*.nupkg"
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
mkdir out
|
||||
sudo apt-get update -qq > /dev/null
|
||||
sudo apt-get -y install nasm > /dev/null
|
||||
|
||||
./thumbs.sh make || exit 1
|
||||
./thumbs.sh check || exit 1
|
||||
objdump -f build/Bin/*.so | grep ^architecture
|
||||
ldd build/Bin/*.so
|
||||
tar -zcf out/libgd-x64.tar.gz --transform 's/.*\///' $(./thumbs.sh list)
|
||||
./thumbs.sh clean
|
||||
|
||||
sudo apt-get -y install gcc-multilib > /dev/null
|
||||
sudo apt-get -y install g++-multilib > /dev/null
|
||||
|
||||
export tbs_arch=x86
|
||||
./thumbs.sh make || exit 1
|
||||
./thumbs.sh check || exit 1
|
||||
objdump -f build/Bin/*.so | grep ^architecture
|
||||
ldd build/Bin/*.so
|
||||
tar -zcf out/libgd-x86.tar.gz --transform 's/.*\///' $(./thumbs.sh list)
|
||||
./thumbs.sh clean
|
|
@ -0,0 +1,37 @@
|
|||
@echo off
|
||||
rem thumbs wrapper for windows; see main file for details
|
||||
|
||||
|
||||
rem find bash from git
|
||||
rem assumes git is in [gitdir]\cmd
|
||||
rem and msys in [gitdir]\bin
|
||||
|
||||
for %%i in (git.exe) do set gitexe=%%~$PATH:i
|
||||
pushd "%gitexe%\..\..\bin"
|
||||
set bashdir=%cd%
|
||||
popd
|
||||
set path=%bashdir%;%path%
|
||||
|
||||
|
||||
rem copy all known env vars to bash
|
||||
|
||||
setlocal enableDelayedExpansion
|
||||
set exports=
|
||||
|
||||
for %%i in (tbs_conf tbs_arch tbs_tools tbs_static_runtime) do (
|
||||
if not [!%%i!]==[] (
|
||||
set exports=!exports!export %%i=!%%i!;
|
||||
)
|
||||
)
|
||||
|
||||
rem copy dep settings
|
||||
|
||||
for %%i in (zlib libjpeg_turbo libpng libtiff freetype libiconv) do (
|
||||
for %%j in (repo incdir libdir built) do (
|
||||
if not [!tbsd_%%i_%%j!]==[] (
|
||||
set exports=!exports!export tbsd_%%i_%%j=!tbsd_%%i_%%j!;
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
bash -c "%exports%./thumbs.sh %*"
|
|
@ -0,0 +1,320 @@
|
|||
#!/bin/bash
|
||||
|
||||
# THe Ultimate Make Bash Script
|
||||
# Used to wrap build scripts for easy dep
|
||||
# handling and multiplatform support
|
||||
|
||||
|
||||
# Basic usage on *nix:
|
||||
# export tbs_arch=x86
|
||||
# ./thumbs.sh make
|
||||
|
||||
|
||||
# On Win (msvc 2013):
|
||||
# C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall x86_amd64
|
||||
# SET tbs_tools=msvc12
|
||||
# thumbs make
|
||||
|
||||
# On Win (mingw32):
|
||||
# SET path=C:\mingw32\bin;%path%
|
||||
# SET tbs_tools=mingw
|
||||
# SET tbs_arch=x86
|
||||
# thumbs make
|
||||
|
||||
|
||||
# Global settings are stored in env vars
|
||||
# Should be inherited
|
||||
|
||||
[ $tbs_conf ] || export tbs_conf=Release
|
||||
[ $tbs_arch ] || export tbs_arch=x64
|
||||
[ $tbs_tools ] || export tbs_tools=gnu
|
||||
[ $tbs_static_runtime ] || export tbs_static_runtime=0
|
||||
|
||||
[ $tbs_gd_png ] || export tbs_gd_png=1
|
||||
[ $tbs_gd_jpeg ] || export tbs_gd_jpeg=1
|
||||
[ $tbs_gd_freetype ] || export tbs_gd_freetype=1
|
||||
[ $tbs_gd_tiff ] || export tbs_gd_tiff=1
|
||||
|
||||
|
||||
# tbsd_* contains dep related settings
|
||||
# tbsd_[name]_* contains settings specific to the dep
|
||||
# name should match the repo name
|
||||
|
||||
# deps contains a map of what should be built/used
|
||||
# keep the keys in sync ... no assoc arrays on msys :/
|
||||
# targ contains a target for each dep (default=empty str)
|
||||
# post is executed after each thumbs dep build
|
||||
# ^ used for copying/renaming any libs you need - uses eval
|
||||
|
||||
zname=zlib.lib
|
||||
jname=jpeg.lib
|
||||
pname=png.lib
|
||||
tname=tiff.lib
|
||||
fname=freetype.lib
|
||||
|
||||
if [ $tbs_tools = gnu -o $tbs_tools = mingw ]
|
||||
then
|
||||
zname=libz.a
|
||||
jname=libjpeg.a
|
||||
pname=libpng.a
|
||||
tname=libtiff.a
|
||||
fname=libfreetype.a
|
||||
fi
|
||||
|
||||
deps=()
|
||||
targ=()
|
||||
post=()
|
||||
|
||||
[ $tbsd_zlib_repo ] || export tbsd_zlib_repo="https://github.com/imazen/zlib"
|
||||
[ $tbsd_libpng_repo ] || export tbsd_libpng_repo="https://github.com/imazen/libpng"
|
||||
[ $tbsd_libjpeg_turbo_repo ] || export tbsd_libjpeg_turbo_repo="https://github.com/imazen/libjpeg-turbo libjpeg_turbo"
|
||||
[ $tbsd_libtiff_repo ] || export tbsd_libtiff_repo="https://github.com/imazen/libtiff"
|
||||
[ $tbsd_freetype_repo ] || export tbsd_freetype_repo="https://github.com/imazen/freetype"
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then cp="rsync"
|
||||
else cp="cp"
|
||||
fi
|
||||
|
||||
deps+=(zlib); targ+=(zlibstatic)
|
||||
post+=("$cp -u \$(./thumbs.sh list_slib) ../../deps/$zname")
|
||||
|
||||
if [ $tbs_gd_png -gt 0 ]; then
|
||||
deps+=(libpng); targ+=(png16_static)
|
||||
post+=("$cp -u \$(./scripts/thumbs.sh list_slib) ../../deps/$pname")
|
||||
fi
|
||||
|
||||
if [ $tbs_gd_jpeg -gt 0 ]; then
|
||||
deps+=(libjpeg_turbo); targ+=(jpeg_static)
|
||||
post+=("for lib in \$(./thumbs.sh list_slib); do [ -f \$lib ] && $cp -u \$lib ../../deps/$jname; done")
|
||||
fi
|
||||
|
||||
if [ $tbs_gd_tiff -gt 0 ]; then
|
||||
ttarg="libtiff/tiff_static"
|
||||
[ $tbs_tools = gnu -o $tbs_tools = mingw ] && ttarg=tiff_static
|
||||
deps+=(libtiff); targ+=($ttarg)
|
||||
post+=("$cp -u \$(./thumbs.sh list_slib) ../../deps/$tname")
|
||||
fi
|
||||
|
||||
if [ $tbs_gd_freetype -gt 0 ]; then
|
||||
deps+=(freetype); targ+=("freetype_static")
|
||||
post+=("$cp -u \$(./thumbs.sh list_slib) ../../deps/$fname")
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# -----------
|
||||
# dep processor
|
||||
|
||||
process_deps()
|
||||
{
|
||||
mkdir build_deps
|
||||
mkdir deps
|
||||
cd build_deps
|
||||
|
||||
for key in "${!deps[@]}"
|
||||
do
|
||||
dep=${deps[$key]}
|
||||
i_dep_repo="tbsd_${dep}_repo"
|
||||
i_dep_incdir="tbsd_${dep}_incdir"
|
||||
i_dep_libdir="tbsd_${dep}_libdir"
|
||||
i_dep_built="tbsd_${dep}_built"
|
||||
|
||||
[ ${!i_dep_built} ] || export "${i_dep_built}=0"
|
||||
|
||||
if [ ${!i_dep_built} -eq 0 ]
|
||||
then
|
||||
git clone ${!i_dep_repo} --depth 1
|
||||
cd $dep || exit 1
|
||||
|
||||
thumbs="./thumbs.sh"
|
||||
[ ! -f $thumbs ] && thumbs=$(find . -name thumbs.sh -maxdepth 2)
|
||||
|
||||
$thumbs make ${targ[$key]} || exit 1
|
||||
|
||||
# copy any includes and do poststep
|
||||
$cp -u -r $($thumbs list_inc) ../../deps
|
||||
eval ${post[$key]}
|
||||
|
||||
# look in both local and parent dep dirs
|
||||
export "${i_dep_incdir}=../../deps;deps"
|
||||
export "${i_dep_libdir}=../../deps;deps"
|
||||
export "${i_dep_built}=1"
|
||||
|
||||
cd ..
|
||||
fi
|
||||
done
|
||||
|
||||
export "${i_dep_incdir}=../../deps/freetype;deps/freetype"
|
||||
|
||||
cd ..
|
||||
}
|
||||
|
||||
# -----------
|
||||
# constructs dep dirs for cmake
|
||||
|
||||
postproc_deps()
|
||||
{
|
||||
cm_inc=
|
||||
cm_lib=
|
||||
|
||||
for dep in "${deps[@]}"
|
||||
do
|
||||
i_dep_incdir="tbsd_${dep}_incdir"
|
||||
i_dep_libdir="tbsd_${dep}_libdir"
|
||||
|
||||
cm_inc="${!i_dep_incdir};$cm_inc"
|
||||
cm_lib="${!i_dep_libdir};$cm_lib"
|
||||
done
|
||||
|
||||
cm_args+=(-DCMAKE_LIBRARY_PATH=$cm_lib)
|
||||
cm_args+=(-DCMAKE_INCLUDE_PATH=$cm_inc)
|
||||
}
|
||||
|
||||
# -----------
|
||||
|
||||
if [ $# -lt 1 ]
|
||||
then
|
||||
echo ""
|
||||
echo " Usage : ./thumbs [command]"
|
||||
echo ""
|
||||
echo " Commands:"
|
||||
echo " make - builds everything"
|
||||
echo " check - runs tests"
|
||||
echo " clean - removes build files"
|
||||
echo " list - echo paths to any interesting files"
|
||||
echo " space separated; relative"
|
||||
echo " list_bin - echo binary paths"
|
||||
echo " list_inc - echo lib include files"
|
||||
echo " list_slib - echo static lib path"
|
||||
echo " list_dlib - echo dynamic lib path"
|
||||
echo ""
|
||||
exit
|
||||
fi
|
||||
|
||||
# -----------
|
||||
|
||||
upper()
|
||||
{
|
||||
echo $1 | tr [:lower:] [:upper:]
|
||||
}
|
||||
|
||||
# Local settings
|
||||
|
||||
l_inc="./src/gd.h ./src/gd_io.h ./src/gdfx.h"
|
||||
l_slib=
|
||||
l_dlib=
|
||||
l_bin=
|
||||
list=
|
||||
|
||||
make=
|
||||
c_flags=
|
||||
cm_tools=
|
||||
cm_args=(-DCMAKE_BUILD_TYPE=$tbs_conf)
|
||||
cm_args+=(-DBUILD_TEST=1)
|
||||
cm_args+=(-DENABLE_PNG=$tbs_gd_png)
|
||||
cm_args+=(-DENABLE_JPEG=$tbs_gd_jpeg)
|
||||
cm_args+=(-DENABLE_FREETYPE=$tbs_gd_freetype)
|
||||
cm_args+=(-DENABLE_TIFF=$tbs_gd_tiff)
|
||||
|
||||
target=
|
||||
[ $2 ] && target=$2
|
||||
|
||||
# -----------
|
||||
|
||||
case "$tbs_tools" in
|
||||
msvc12)
|
||||
cm_tools="Visual Studio 12"
|
||||
[ "$target" = "" ] && mstrg="GD.sln" || mstrg="$target.vcxproj"
|
||||
make="msbuild.exe $mstrg //p:Configuration=$tbs_conf //v:m"
|
||||
|
||||
l_slib="./build/Bin/$tbs_conf/libgd_static.lib"
|
||||
l_dlib="./build/Bin/$tbs_conf/libgd.lib"
|
||||
l_bin="./build/Bin/$tbs_conf/libgd.dll"
|
||||
list="$l_bin $l_slib $l_dlib $l_inc" ;;
|
||||
gnu)
|
||||
cm_tools="Unix Makefiles"
|
||||
c_flags+=" -fPIC"
|
||||
make="make $target"
|
||||
l_slib="./build/Bin/libgd.a"
|
||||
l_dlib="./build/Bin/libgd.so"
|
||||
l_bin="$l_dlib"
|
||||
list="$l_slib $l_dlib $l_inc" ;;
|
||||
mingw)
|
||||
cm_tools="MinGW Makefiles"
|
||||
make="mingw32-make $target"
|
||||
c_flags+=" -fkeep-inline-functions"
|
||||
|
||||
# allow sh in path; some old cmake/mingw bug?
|
||||
cm_args+=(-DCMAKE_SH=)
|
||||
|
||||
l_slib="./build/Bin/liblibgd.a"
|
||||
l_dlib="./build/Bin/liblibgd.dll.a"
|
||||
l_bin="./build/Bin/liblibgd.dll"
|
||||
list="$l_bin $l_slib $l_dlib $l_inc" ;;
|
||||
|
||||
*) echo "Tool config not found for $tbs_tools"
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
||||
# -----------
|
||||
|
||||
case "$tbs_arch" in
|
||||
x64)
|
||||
[ $tbs_tools = msvc12 ] && cm_tools="$cm_tools Win64"
|
||||
[ $tbs_tools = gnu -o $tbs_tools = mingw ] && c_flags+=" -m64" ;;
|
||||
x86)
|
||||
[ $tbs_tools = gnu -o $tbs_tools = mingw ] && c_flags+=" -m32" ;;
|
||||
|
||||
*) echo "Arch config not found for $tbs_arch"
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
||||
# -----------
|
||||
|
||||
if [ $tbs_static_runtime -gt 0 ]
|
||||
then
|
||||
[ $tbs_tools = msvc12 ] && c_flags+=" /MT"
|
||||
[ $tbs_tools = gnu ] && cm_args+=(-DCMAKE_SHARED_LINKER_FLAGS="-static-libgcc -static-libstdc++")
|
||||
[ $tbs_tools = mingw ] && cm_args+=(-DCMAKE_SHARED_LINKER_FLAGS="-static")
|
||||
fi
|
||||
|
||||
# -----------
|
||||
|
||||
case "$1" in
|
||||
make)
|
||||
process_deps
|
||||
postproc_deps
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cm_args+=(-DCMAKE_C_FLAGS_$(upper $tbs_conf)="$c_flags")
|
||||
cm_args+=(-DCMAKE_CXX_FLAGS_$(upper $tbs_conf)="$c_flags")
|
||||
|
||||
cmake -G "$cm_tools" "${cm_args[@]}" .. || exit 1
|
||||
$make || exit 1
|
||||
|
||||
cd ..
|
||||
;;
|
||||
|
||||
check)
|
||||
cd build
|
||||
ctest -C $tbs_conf . || exit 1
|
||||
cd ..
|
||||
;;
|
||||
|
||||
clean)
|
||||
rm -rf deps
|
||||
rm -rf build_deps
|
||||
rm -rf build
|
||||
;;
|
||||
|
||||
list) echo $list;;
|
||||
list_bin) echo $l_bin;;
|
||||
list_inc) echo $l_inc;;
|
||||
list_slib) echo $l_slib;;
|
||||
list_dlib) echo $l_dlib;;
|
||||
|
||||
*) echo "Unknown command $1"
|
||||
exit 1;;
|
||||
esac
|
Loading…
Reference in New Issue