diff options
author | Chris Wilson <chris+github@qwirx.com> | 2015-12-06 12:02:21 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2015-12-06 12:02:21 +0000 |
commit | 2db3e7a096f6748410c56626ca50e5c69ad1119f (patch) | |
tree | 3f3ee34aef59c2d3cfe2aea82ec4563709d58d8b /infrastructure | |
parent | d56384422843c37b51920c39b272d424f7e4c34a (diff) |
Fix version generation from pure-Git checkouts.
Fix calls to Uname on platforms that don't have it, such as MSVC.
Diffstat (limited to 'infrastructure')
-rw-r--r-- | infrastructure/BoxPlatform.pm.in | 48 | ||||
-rw-r--r-- | infrastructure/cmake/CMakeLists.txt | 83 |
2 files changed, 91 insertions, 40 deletions
diff --git a/infrastructure/BoxPlatform.pm.in b/infrastructure/BoxPlatform.pm.in index 78675325..660be5e5 100644 --- a/infrastructure/BoxPlatform.pm.in +++ b/infrastructure/BoxPlatform.pm.in @@ -17,19 +17,21 @@ BEGIN if ($^O eq "MSWin32" and not -x "/usr/bin/uname") { $build_os = "winnt"; + use Win32; + $build_os_ver = Win32::GetOSName(); } else { $build_os = `uname`; + $build_os_ver = `uname -r`; chomp $build_os; + chomp $build_os_ver; } # Cygwin Builds usually something like CYGWIN_NT-5.0, CYGWIN_NT-5.1 # Box Backup tried on Win2000,XP only :) $build_os = 'CYGWIN' if $build_os =~ m/CYGWIN/; $build_os = 'MINGW32' if $build_os =~ m/MINGW32/; - $build_os_ver = `uname -r`; - chomp $build_os_ver; if ($build_os eq 'Darwin') { $xcode_ver = `xcodebuild -version | awk '/^Xcode/ {print \$2}'` @@ -81,44 +83,10 @@ BEGIN if($product_version =~ /USE_SVN_VERSION/) { - # for developers, use SVN version - my $svnversion = 'unknown'; - my $svnurl = 'unknown'; - - if(-d '.svn') - { - my $svnversion = `svnversion .`; - chomp $svnversion; - $svnversion =~ tr/0-9A-Za-z/_/c; - open INFO,'svn info . |'; - while(<INFO>) - { - if(m/^URL: (.+?)[\n\r]+/) - { - $svnurl = $1 - } - } - close INFO; - } - elsif(-d '.git') - { - $svnversion = `git svn info | grep '^Revision:' | cut -d' ' -f2`; - chomp $svnversion; - $svnurl = `git svn info --url`; - } - - my $svndir; - if ($svnurl =~ m!/box/(.+)$!) - { - $svndir = $1; - } - elsif ($svnurl =~ m'/(boxi/.+)/boxi/boxbackup') - { - $svndir = $1; - } - - $svndir =~ tr/0-9A-Za-z/_/c; - $product_version =~ s/USE_SVN_VERSION/$svndir.'_'.$svnversion/e; + # for developers, use Git version (SVN is no more): + my $gitversion = `git rev-parse HEAD`; + chomp $gitversion; + $product_version =~ s/USE_SVN_VERSION/git_$gitversion/; } # where to put the files diff --git a/infrastructure/cmake/CMakeLists.txt b/infrastructure/cmake/CMakeLists.txt new file mode 100644 index 00000000..f1a02252 --- /dev/null +++ b/infrastructure/cmake/CMakeLists.txt @@ -0,0 +1,83 @@ +cmake_minimum_required(VERSION 2.6) +project(BoxBackup) + +set(base_dir ../..) + +set(files_to_configure + infrastructure/BoxPlatform.pm + contrib/mac_osx/org.boxbackup.bbackupd.plist + contrib/mac_osx/org.boxbackup.bbstored.plist + contrib/solaris/bbackupd-manifest.xml + contrib/solaris/bbstored-manifest.xml + lib/common/BoxPortsAndFiles.h + test/bbackupd/testfiles/bbackupd.conf + test/bbackupd/testfiles/bbackupd-exclude.conf + test/bbackupd/testfiles/bbackupd-snapshot.conf + test/bbackupd/testfiles/bbackupd-symlink.conf + test/bbackupd/testfiles/bbackupd-temploc.conf + bin/bbackupd/bbackupd-config + bin/bbackupquery/makedocumentation.pl + bin/bbstored/bbstored-certs + bin/bbstored/bbstored-config + contrib/debian/bbackupd + contrib/debian/bbstored + contrib/redhat/bbackupd + contrib/redhat/bbstored + contrib/suse/bbackupd + contrib/suse/bbstored + contrib/solaris/bbackupd-smf-method + contrib/solaris/bbstored-smf-method + contrib/windows/installer/boxbackup.mpi + infrastructure/makebuildenv.pl + infrastructure/makeparcels.pl + infrastructure/makedistribution.pl + lib/common/makeexception.pl + lib/raidfile/raidfile-config + lib/server/makeprotocol.pl + runtest.pl + test/backupstorefix/testfiles/testbackupstorefix.pl + test/bbackupd/testfiles/extcheck1.pl + test/bbackupd/testfiles/extcheck2.pl + test/bbackupd/testfiles/notifyscript.pl + test/bbackupd/testfiles/syncallowscript.pl +) + +foreach(file_to_configure ${files_to_configure}) + configure_file("${base_dir}/${file_to_configure}.in" "${base_dir}/${file_to_configure}" @ONLY) +endforeach() + +file(STRINGS ${base_dir}/modules.txt module_deps REGEX "^[^#]") +foreach(module_dep ${module_deps}) + string(REGEX MATCH "([^ ]+)[ ]*(.*)" valid_module_line ${module_dep}) + if(valid_module_line) + if(DEBUG) + message(STATUS "found module: ${CMAKE_MATCH_1} -> ${CMAKE_MATCH_2}") + endif() + + set(module_dir ${base_dir}/${CMAKE_MATCH_1}) + string(REPLACE "/" "_" module_name ${CMAKE_MATCH_1}) + string(REPLACE "/" "_" dependencies "${CMAKE_MATCH_2}") + string(REGEX REPLACE "^ " "" dependencies "${dependencies}") + string(REGEX REPLACE " $" "" dependencies "${dependencies}") + file(GLOB module_files ${module_dir}/*.c ${module_dir}/*.cpp) + + if(module_name MATCHES "^(bin|test)_") + if(DEBUG) + message(STATUS "add executable '${module_name}': '${module_files}'") + endif() + add_executable(${module_name} ${module_files}) + elseif(module_name MATCHES "^lib_") + if(DEBUG) + message(STATUS "add library '${module_name}': '${module_files}'") + endif() + add_library(${module_name} STATIC ${module_files}) + else() + message(FATAL_ERROR "Unsupported module type: " ${module_dir}) + endif() + + if(DEBUG) + message(STATUS "add dependencies to '${module_name}': '${dependencies}'") + endif() + target_link_libraries(${module_name} ${dependencies}) + endif() +endforeach() |