blob: e47ccd5a4216356ca0b4fc3a5648472903474275 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
cmake_minimum_required(VERSION 2.6)
project(BoxBackup)
set(base_dir ${CMAKE_SOURCE_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 "^[^#]")
# qdbm, lib/common and lib/win32 aren't listed in modules.txt, so hard-code them.
foreach(module_dep "qdbm" "lib/win32" "lib/common lib/win32" ${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}")
file(GLOB module_files ${module_dir}/*.c ${module_dir}/*.cpp)
# everything except lib/common and lib/win32 implicitly depend on
# lib/common, so express that dependency here.
if(module_name MATCHES "^lib_(common|win32)$")
else()
set(dependencies "${dependencies} lib_common")
endif()
string(REGEX REPLACE "^ " "" dependencies "${dependencies}")
string(REGEX REPLACE " $" "" dependencies "${dependencies}")
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_.*|qdbm)$")
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(dependencies MATCHES ".")
if(DEBUG)
message(STATUS "add dependencies to '${module_name}': '${dependencies}'")
endif()
string(REGEX REPLACE "[ ]+" ";" dependency_list "${dependencies}")
foreach(dependency ${dependency_list})
add_dependencies(${module_name} ${dependency})
if(dependency MATCHES "^lib_")
target_link_libraries(${module_name} PUBLIC ${dependency})
endif()
endforeach()
endif()
target_include_directories(${module_name} PUBLIC ${module_dir})
endif()
endforeach()
# Parsing Makefile.extra files in CMake script is a pain, so the relevant rules are
# hard-coded here.
set(exception_files
lib/backupclient/ClientException.txt
lib/backupstore/BackupStoreException.txt
lib/common/CommonException.txt
lib/common/ConversionException.txt
lib/compress/CompressException.txt
lib/crypto/CipherException.txt
lib/httpserver/HTTPException.txt
lib/raidfile/RaidFileException.txt
lib/server/ServerException.txt
lib/server/ConnectionException.txt
)
include(FindPerl)
execute_process(
COMMAND ${PERL_EXECUTABLE} ${base_dir}/infrastructure/msvc/getversion.pl
RESULT_VARIABLE status
OUTPUT_VARIABLE command_output
ERROR_VARIABLE command_output)
if(NOT status EQUAL 0)
message(FATAL_ERROR "Failed to execute: "
"${PERL_EXECUTABLE} ${base_dir}/infrastructure/msvc/getversion.pl: "
"status ${status}: ${command_output}")
endif()
foreach(exception_file ${exception_files})
string(REGEX MATCH "(.*)/(.*)" valid_exception_file ${exception_file})
if(NOT valid_exception_file)
message(FATAL_ERROR "invalid exception file: '${exception_file}'")
endif()
execute_process(
COMMAND ${PERL_EXECUTABLE} ${base_dir}/lib/common/makeexception.pl ${CMAKE_MATCH_2}
WORKING_DIRECTORY "${base_dir}/${CMAKE_MATCH_1}"
RESULT_VARIABLE status)
if(NOT status EQUAL 0)
message(FATAL_ERROR "Failed to execute: "
"${PERL_EXECUTABLE} ${base_dir}/lib/common/makeexception.pl ${CMAKE_MATCH_2}"
"(in ${CMAKE_MATCH_1}): ${status}")
endif()
endforeach()
|