Skip to content

Commit

Permalink
Merge rewritten build system.
Browse files Browse the repository at this point in the history
Add a new CMake build system, based on the one used to build for AppVeyor (Windows) and made to work with Linux and fully tested by Travis CI.

Rewrite the old autoconf-based Makefile generator build system to solve performance and correctness problems caused by highly parallelised recursive Make, which was causing Travis builds to fail. Now uses a single monolithic generated Makefile instead of recursive Make. Should also be faster, both for initial builds (with parallelism) and for rebuilds.

Remove the old outdated Visual Studio project files, since it should now be possible to generate these with CMake.

Add a CMake project that builds Box Backup and its dependencies, particularly useful for getting started as a developer on Windows.
  • Loading branch information
qris authored Oct 1, 2016
2 parents 8718a10 + 65a8cf6 commit 80adfe9
Show file tree
Hide file tree
Showing 97 changed files with 1,814 additions and 7,544 deletions.
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://help.github.com/articles/dealing-with-line-endings/
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
*.vcxproj.user text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ contrib/solaris/bbstored-manifest.xml
contrib/solaris/bbstored-smf-method
contrib/windows/installer/boxbackup.mpi
infrastructure/BoxPlatform.pm
infrastructure/cmake/build
infrastructure/makebuildenv.pl
infrastructure/makedistribution.pl
infrastructure/makeparcels.pl
lib/bbackupquery/makedocumentation.pl
lib/common/BoxConfig.h
lib/common/BoxConfig.h.in
lib/common/BoxConfig.cmake.h
lib/common/BoxPortsAndFiles.h
lib/common/BoxVersion.h
lib/common/makeexception.pl
Expand Down
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ sudo: false

addons:
apt:
# We need cmake > 2.8.7
# https://github.com/travis-ci/travis-ci/issues/4631#issuecomment-191153634
sources:
- george-edison55-precise-backports # cmake 3.2.3 / doxygen 1.8.3
packages:
- cmake
- cmake-data
- libdb-dev
- libreadline-dev
- libssl-dev
- libwww-perl
- xsltproc
- zlib1g-dev

before_script:
- ccache -s
- ./bootstrap
- ./configure CC="ccache $CC" CXX="ccache $CXX"
- grep CXX config.status
- make

env:
- TEST_TARGET=debug
- TEST_TARGET=release
- BUILD=cmake TEST_TARGET=debug
- BUILD=cmake TEST_TARGET=release

script:
- ./runtest.pl ALL $TEST_TARGET
- ccache -s
- ./infrastructure/travis-build.sh
91 changes: 24 additions & 67 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,80 +40,37 @@ init:

build:
parallel: true
project: infrastructure/cmake/build/BoxBackup.sln
project: ..\cmake\BoxBackup_Windows.sln
verbosity: quiet

install:
# Show compiled files restored from cache
- dir %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build
- dir %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build\bin_bbackupd.dir
- dir %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build\bin_bbackupd.dir\%CONFIGURATION%
- dir %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build\%PLATFORM%
- dir %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build\%PLATFORM%\%CONFIGURATION%
- dir %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build\%PLATFORM%\%CONFIGURATION%\ALL_BUILD

- cinst strawberryperl 7zip.commandline cmake

# - dir "C:\Program Files\Microsoft SDKs\Windows"
# - dir "C:\Program Files\Microsoft SDKs\Windows\v7.1"
# - dir "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin"
# test_bbackupd needs 7zip (or cmake -E tar) to extract tar archives on Windows:
- cinst -y --limit-output 7zip.commandline
# Install cmake.portable instead of cmake, to get it on the path again:
# http://disq.us/p/xdknrt
- dir "c:\Program Files"
- dir "c:\Program Files (x86)"
# We don't need strawberryperl on AppVeyor because there is already a Perl in c:\Perl.
# If you are doing this on a fresh box for development, you would probably want to
# install Chocolatey and then run:
# cinst -y cmake strawberryperl git vim visualstudio2012wdx

- '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86'

- cd %APPVEYOR_BUILD_FOLDER%\..
- if not exist zlib128.zip appveyor DownloadFile "http://zlib.net/zlib128.zip"
- 7za x -aoa zlib128.zip
- cd zlib-1.2.8
- cmake -G "%Generator%" -A %PLATFORM% -DCMAKE_INSTALL_PREFIX="..\zlib-%PLATFORM%" .
# We need to build both versions, debug and release, because cmake requires both to be
# present to generate its multi-configuration project files for Visual Studio/MSBuild.
- msbuild INSTALL.vcxproj /m /p:Configuration=Debug /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- msbuild INSTALL.vcxproj /m /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"

- cd %APPVEYOR_BUILD_FOLDER%\..
- if not exist openssl-%OPENSSL_VERSION%.tar.gz appveyor DownloadFile "https://www.openssl.org/source/openssl-%OPENSSL_VERSION%.tar.gz"
- 7za x -aoa openssl-%OPENSSL_VERSION%.tar.gz
- 7za x -aoa openssl-%OPENSSL_VERSION%.tar
- cd openssl-%OPENSSL_VERSION%
- perl Configure debug-VC-WIN32 no-asm --prefix="%APPVEYOR_BUILD_FOLDER%\..\openssl-%PLATFORM%"
- ms\do_ms
- nmake /s /f ms\nt.mak
- nmake /s /f ms\nt.mak install

- cd %APPVEYOR_BUILD_FOLDER%\..
- if not exist pcre-%PCRE_VERSION%.zip appveyor DownloadFile "http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-%PCRE_VERSION%.zip"
- 7za x -aoa pcre-%PCRE_VERSION%.zip
- cd %APPVEYOR_BUILD_FOLDER%\..
- cd pcre-%PCRE_VERSION%
- cmake -G "%Generator%" -A %PLATFORM% -DCMAKE_INSTALL_PREFIX="..\pcre-%PLATFORM%" .
- dir
# We need to build both versions, debug and release, because cmake requires both to be
# present to generate its multi-configuration project files for Visual Studio/MSBuild.
- msbuild INSTALL.vcxproj /m /p:Configuration=Debug /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- msbuild INSTALL.vcxproj /m /p:Configuration=Release /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- cd %APPVEYOR_BUILD_FOLDER%\..
- dir
- dir pcre-%PLATFORM%
- dir pcre-%PLATFORM%\bin
- dir pcre-%PLATFORM%\lib

- cd %APPVEYOR_BUILD_FOLDER%
- cd infrastructure\cmake\build
- cmake -G "%Generator%" -A %PLATFORM% ..
- cd %APPVEYOR_BUILD_FOLDER%
- if not exist cmake md cmake
- cd cmake
# We need to specify the generator here, in case the user has more than one installed.
# CMake always seems to default to the latest version of Visual Studio, not the one on
# the current PATH.
- cmake -G "%Generator%" -A %PLATFORM% %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\windows

# Show files after build
- dir %APPVEYOR_BUILD_FOLDER%\..\zlib-1.2.8
- dir %APPVEYOR_BUILD_FOLDER%\..\zlib-%PLATFORM%
- dir %APPVEYOR_BUILD_FOLDER%\..\openssl-%OPENSSL_VERSION%
- dir %APPVEYOR_BUILD_FOLDER%\..\openssl-%PLATFORM%
- dir %APPVEYOR_BUILD_FOLDER%\..\pcre-%PCRE_VERSION%
- dir %APPVEYOR_BUILD_FOLDER%\..\pcre-%PLATFORM%
- dir %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build
- dir %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build\bin_bbackupd.dir
- dir %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build\%PLATFORM%
- dir %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build\%PLATFORM%\%CONFIGURATION%
# Leave the current directory in the correct place to find the solution file using its relative path above.

test_script:
- cd %APPVEYOR_BUILD_FOLDER%\infrastructure\cmake\build
- cd %APPVEYOR_BUILD_FOLDER%\..\cmake\src\boxbackup-build
# - dir
# - dir bin_bbackupd.dir
# - dir %PLATFORM%
# - dir %PLATFORM%\%CONFIGURATION%
- ctest -C %CONFIGURATION% -V

1 change: 0 additions & 1 deletion bin/bbstoreaccounts/bbstoreaccounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "BoxPortsAndFiles.h"
#include "HousekeepStoreAccount.h"
#include "MainHelper.h"
#include "NamedLock.h"
#include "RaidFileController.h"
#include "StoreStructure.h"
#include "UnixUser.h"
Expand Down
4 changes: 1 addition & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ AX_CONFIG_SCRIPTS([bin/bbackupd/bbackupd-config
contrib/solaris/bbstored-smf-method
contrib/windows/installer/boxbackup.mpi
infrastructure/makebuildenv.pl
infrastructure/makeparcels.pl
infrastructure/makedistribution.pl
lib/bbackupquery/makedocumentation.pl
lib/common/makeexception.pl
Expand All @@ -124,8 +123,7 @@ AC_OUTPUT

# Configure the Box build system
echo
if ! $PERL ./infrastructure/makebuildenv.pl \
|| ! $PERL ./infrastructure/makeparcels.pl; then
if ! $PERL ./infrastructure/makebuildenv.pl; then
echo "Making infrastructure failed!"
exit 1
fi
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/BoxPlatform.pm.in
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ BEGIN
$platform_link_line_extra = '-L/sw/lib ';
}
}

if ($target_windows)
{
$platform_exe_ext = '.exe';
}
}

sub make_flag
Expand Down
Loading

0 comments on commit 80adfe9

Please sign in to comment.