summaryrefslogtreecommitdiff
path: root/infrastructure
diff options
context:
space:
mode:
authorChris Wilson <qris@users.noreply.github.com>2017-11-30 19:59:49 +0000
committerGitHub <noreply@github.com>2017-11-30 19:59:49 +0000
commita0fa0c4f5f338335034f172af290025d48d5a1d5 (patch)
tree286d456641f4b7e26e13eba452a41ba10a006eca /infrastructure
parent24aca3fc618e36e2feb448bd7b5c05b31a064bd3 (diff)
parented55e2b11107a04ad49950d5cf1b2ba7291d3344 (diff)
Merge pull request #20 from boxbackup/windows_binary_packages
Build Win32/64 binary packages automatically
Diffstat (limited to 'infrastructure')
-rw-r--r--infrastructure/cmake/CMakeLists.txt67
-rwxr-xr-xinfrastructure/cmake/getversion.pl2
-rw-r--r--infrastructure/cmake/windows/CMakeLists.txt12
3 files changed, 59 insertions, 22 deletions
diff --git a/infrastructure/cmake/CMakeLists.txt b/infrastructure/cmake/CMakeLists.txt
index cba7c739..25015452 100644
--- a/infrastructure/cmake/CMakeLists.txt
+++ b/infrastructure/cmake/CMakeLists.txt
@@ -78,25 +78,38 @@ foreach(file_to_configure ${files_to_configure})
"${base_dir}/${file_to_configure}.out")
endforeach()
-# Work out the current Box version (requires Perl) and update lib/common/BoxVersion.h,
-# but only if it has changed, to avoid unnecessary complete rebuilds due to timestamps.
-execute_process(
- COMMAND ${PERL_EXECUTABLE} ${base_dir}/infrastructure/cmake/getversion.pl
- WORKING_DIRECTORY ${base_dir}/infrastructure
- RESULT_VARIABLE status
- OUTPUT_VARIABLE new_version_define
- ERROR_VARIABLE command_output)
-if(NOT status EQUAL 0)
- message(FATAL_ERROR "Failed to execute: "
- "${PERL_EXECUTABLE} ${base_dir}/infrastructure/cmake/getversion.pl: "
- "status ${status}: ${command_output}")
+# If BOXBACKUP_VERSION is defined when running CMake (as the AppVeyor config does), use it
+# as-is, since it contains the full version number, branch, and platform (Win32/Win64):
+if(BOXBACKUP_VERSION)
+ set(boxbackup_version ${BOXBACKUP_VERSION})
+ # Remove CPACK_SYSTEM_NAME from the default CPACK_PACKAGE_NAME, because it's already
+ # included in the CPACK_PACKAGE_VERSION:
+ set(CPACK_PACKAGE_FILE_NAME ${CMAKE_PROJECT_NAME}-${boxbackup_version})
+else()
+ # Work out the current Box version (requires Perl) and update lib/common/BoxVersion.h,
+ # but only if it has changed, to avoid unnecessary complete rebuilds due to timestamps.
+ execute_process(
+ COMMAND ${PERL_EXECUTABLE} ${base_dir}/infrastructure/cmake/getversion.pl
+ WORKING_DIRECTORY ${base_dir}/infrastructure
+ RESULT_VARIABLE status
+ OUTPUT_VARIABLE boxbackup_version
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE command_output)
+ if(NOT status EQUAL 0)
+ message(FATAL_ERROR "Failed to execute: "
+ "${PERL_EXECUTABLE} ${base_dir}/infrastructure/cmake/getversion.pl: "
+ "status ${status}: ${command_output}")
+ endif()
endif()
-file(WRITE "${base_dir}/lib/common/BoxVersion.h.new" "${new_version_define}")
+
+file(WRITE "${base_dir}/lib/common/BoxVersion.h.new"
+ "#define BOX_VERSION \"${boxbackup_version}\"\n")
replace_file_if_different(
"${base_dir}/lib/common/BoxVersion.h"
"${base_dir}/lib/common/BoxVersion.h.new")
add_definitions(-DBOX_CMAKE -DNEED_BOX_VERSION_H)
+
if(WIN32)
add_definitions(-DWIN32)
endif()
@@ -331,6 +344,16 @@ foreach(module_dep ${module_deps})
endif()
endforeach()
+if(WIN32)
+ install(FILES ${base_dir}/bin/bbackupd/win32/NotifySysAdmin.vbs
+ DESTINATION "." COMPONENT Extras)
+ install(FILES ${base_dir}/bin/bbackupd/win32/bbackupd.conf
+ DESTINATION "." COMPONENT Extras)
+else()
+ install(FILES ${base_dir}/bin/bbackupd/bbackupd-config
+ DESTINATION "." COMPONENT Extras)
+endif()
+
# We can't do anything conditional on CMAKE_BUILD_TYPE because that's not valid for multi-configuration
# generators such as MSVC. We need to use a generator expression instead.
target_compile_definitions(lib_common PUBLIC $<$<CONFIG:Release>:BOX_RELEASE_BUILD>)
@@ -353,9 +376,6 @@ if(WIN32)
target_link_libraries(lib_common PUBLIC ws2_32 gdi32)
endif()
-# Link to ZLib
-# http://stackoverflow.com/a/6174604/648162
-include_directories(${base_dir}/../zlib-win32/include)
# On Windows we want to statically link zlib to make debugging and distribution easier,
# but FindZLIB.cmake doesn't offer that as an option, so we have to go through some
# contortions to "find" the correct library. ZLIB_ROOT is required in this case.
@@ -688,3 +708,18 @@ set_tests_properties(backupdiff PROPERTIES TIMEOUT 32)
set_tests_properties(bbackupd PROPERTIES TIMEOUT 1200)
set_tests_properties(s3store PROPERTIES TIMEOUT 20)
set_tests_properties(httpserver PROPERTIES TIMEOUT 40)
+
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Box Backup is an open source, completely automatic, on-line backup system")
+set(CPACK_PACKAGE_VENDOR "www.BoxBackup.org")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "${base_dir}/README.md")
+set(CPACK_RESOURCE_FILE_LICENSE "${base_dir}/LICENSE.txt")
+set(CPACK_PACKAGE_VERSION ${boxbackup_version})
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "Box Backup")
+set(CPACK_COMPONENTS_ALL Applications Extras)
+set(CPACK_GENERATOR "ZIP;NSIS")
+set(CPACK_NSIS_DISPLAY_NAME "Box Backup")
+set(CPACK_NSIS_HELP_LINK "http://www.boxbackup.org/")
+set(CPACK_NSIS_URL_INFO_ABOUT "http://www.boxbackup.org/")
+set(CPACK_NSIS_CONTACT "boxbackup@boxbackup.org")
+set(CPACK_NSIS_MODIFY_PATH ON)
+include(CPack)
diff --git a/infrastructure/cmake/getversion.pl b/infrastructure/cmake/getversion.pl
index 67e1f8a5..d7ca0333 100755
--- a/infrastructure/cmake/getversion.pl
+++ b/infrastructure/cmake/getversion.pl
@@ -8,6 +8,6 @@ chdir $basedir or die "Failed to change to base directory: $basedir: $!";
require "$basedir/infrastructure/BoxPlatform.pm.in";
-print "#define BOX_VERSION \"$BoxPlatform::product_version\"\n";
+print "$BoxPlatform::product_version\n";
exit 0;
diff --git a/infrastructure/cmake/windows/CMakeLists.txt b/infrastructure/cmake/windows/CMakeLists.txt
index a6d93ee8..80d1369b 100644
--- a/infrastructure/cmake/windows/CMakeLists.txt
+++ b/infrastructure/cmake/windows/CMakeLists.txt
@@ -35,7 +35,7 @@ ExternalProject_Add(zlib
URL "http://zlib.net/zlib-${ZLIB_VERSION}.tar.gz"
URL_HASH ${ZLIB_HASH}
DOWNLOAD_NO_PROGRESS 1
- CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${install_dir}
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${install_dir} ${SUB_CMAKE_EXTRA_ARGS}
# 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.
INSTALL_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target install --config Debug
@@ -86,7 +86,7 @@ ExternalProject_Add(pcre
SVN_REPOSITORY svn://vcs.exim.org/pcre/code/trunk
SVN_REVISION -r 1677
DOWNLOAD_NO_PROGRESS 1
- CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${install_dir}
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${install_dir} ${SUB_CMAKE_EXTRA_ARGS}
-DPCRE_SUPPORT_LIBREADLINE=OFF
-DPCRE_SUPPORT_LIBBZ2=OFF
# We need to build both versions, debug and release, because cmake requires both to be
@@ -100,9 +100,9 @@ ExternalProject_Add(boost
URL "http://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION}/boost_${BOOST_VERSION_UNDERSCORES}.tar.bz2"
URL_HASH ${BOOST_HASH}
# DOWNLOAD_NO_PROGRESS 1
- CONFIGURE_COMMAND "" # none needed
- BUILD_COMMAND ${CMAKE_COMMAND} -E echo "No build step needed" # none needed
- INSTALL_COMMAND "" # none needed
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -E echo "No configure step needed"
+ BUILD_COMMAND ${CMAKE_COMMAND} -E echo "No build step needed"
+ INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "No install step needed"
)
if(BOXBACKUP_VERSION)
@@ -119,8 +119,10 @@ ExternalProject_Add(boxbackup
-DPCRE_ROOT=${install_dir}
-DBOOST_ROOT=${CMAKE_BINARY_DIR}/Source/boost
-DBOX_SUPPORT_READLINE=OFF
+ -DCMAKE_INSTALL_PREFIX=${install_dir}
-DAPPVEYOR_MODE=1
-DDEBUG=${DEBUG}
${boxbackup_cmake_args}
+ ${SUB_CMAKE_EXTRA_ARGS}
STEP_TARGETS configure build install
)