build: Drop waf support Goodbye Waf. It's been a long ride.
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 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ace5a79..01911fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,13 +38,13 @@ SET(INSTALL_LIB lib CACHE PATH "Where to install libraries to.")
SET(INSTALL_INC include CACHE PATH "Where to install headers to.")
# Build options
-OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
+OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" OFF)
OPTION (BUILD_TESTS "Build Tests" ON)
OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF)
# Build Release by default
IF (NOT CMAKE_BUILD_TYPE)
- SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
+ SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF ()
IF (THREADSAFE)
@@ -81,7 +81,7 @@ ENDIF ()
# Compile and link libgit2
ADD_LIBRARY(git2 ${SRC} ${SRC_PLAT} ${SRC_SHA1} ${SRC_ZLIB})
-TARGET_LINK_LIBRARIES(git2 ${LIB_SHA1} ${CMAKE_THREAD_LIBS_INIT} ${SQLITE3_LIBRARIES})
+TARGET_LINK_LIBRARIES(git2 ${LIB_SHA1} ${CMAKE_THREAD_LIBS_INIT})
SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_VERSION_MAJOR})
@@ -95,17 +95,13 @@ INSTALL(DIRECTORY include/git2 DESTINATION ${INSTALL_INC} )
INSTALL(FILES include/git2.h DESTINATION ${INSTALL_INC} )
# Tests
-IF (BUILD_TESTS)
- SET(TEST_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
- ADD_DEFINITIONS(-DTEST_RESOURCES=\"${TEST_RESOURCES}\")
-
- ENABLE_TESTING()
- INCLUDE_DIRECTORIES(tests)
-
- FILE(GLOB SRC_TEST tests/t??-*.c)
-
- ADD_EXECUTABLE(libgit2_test tests/test_main.c tests/test_lib.c tests/test_helpers.c ${SRC} ${SRC_PLAT} ${SRC_SHA1} ${SRC_TEST} ${SRC_ZLIB})
- TARGET_LINK_LIBRARIES(libgit2_test ${LIB_SHA1} ${CMAKE_THREAD_LIBS_INIT} ${SQLITE3_LIBRARIES})
-
- ADD_TEST(libgit2_test libgit2_test)
-ENDIF ()
+#IF (BUILD_TESTS)
+# SET(TEST_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
+# ADD_DEFINITIONS(-DTEST_RESOURCES=\"${TEST_RESOURCES}\")
+#
+# INCLUDE_DIRECTORIES(tests)
+# ADD_EXECUTABLE(libgit2_test tests/libgit2_test.cpp)
+# TARGET_LINK_LIBRARIES(libgit2_test git2 ${LIB_SHA1} ${CMAKE_THREAD_LIBS_INIT})
+#
+# ADD_TEST(libgit2_test libgit2_test)
+#ENDIF ()
diff --git a/waf b/waf
deleted file mode 100755
index 18b9aa3..0000000
Binary files a/waf and /dev/null differ
diff --git a/wscript b/wscript
deleted file mode 100644
index 92f00da..0000000
--- a/wscript
+++ /dev/null
@@ -1,268 +0,0 @@
-from __future__ import with_statement
-from waflib.Context import Context
-from waflib.Build import BuildContext, CleanContext, \
- InstallContext, UninstallContext
-
-# Unix flags
-CFLAGS_UNIX = ["-O2", "-Wall", "-Wextra", "-fPIC"]
-CFLAGS_UNIX_DBG = ['-g', '-O0']
-
-# Windows MSVC flags
-CFLAGS_WIN32_COMMON = ['/TC', '/W4', '/WX', '/nologo', '/Zi']
-CFLAGS_WIN32_RELEASE = ['/O2', '/MD']
-
-# Note: /RTC* cannot be used with optimization on.
-CFLAGS_WIN32_DBG = ['/Od', '/RTC1', '/RTCc', '/DEBUG', '/MDd']
-CFLAGS_WIN32_L = ['/RELEASE'] # used for /both/ debug and release builds.
- # sets the module's checksum in the header.
-CFLAGS_WIN32_L_DBG = ['/DEBUG']
-
-ALL_LIBS = ['crypto', 'pthread']
-
-def options(opt):
- opt.load('compiler_c')
- opt.add_option('--sha1', action='store', default='builtin',
- help="Use the builtin SHA1 routines (builtin), the \
-PPC optimized version (ppc) or the SHA1 functions from OpenSSL (openssl)")
- opt.add_option('--debug', action='store_true', default=False,
- help='Compile with debug symbols')
- opt.add_option('--msvc', action='store', default=None,
- help='Force a specific MSVC++ version (7.1, 8.0, 9.0, 10.0), if more than one is installed')
- opt.add_option('--arch', action='store', default='x86',
- help='Select target architecture (ia64, x64, x86, x86_amd64, x86_ia64)')
- opt.add_option('--threadsafe', action='store_true', default=False,
- help='Make libgit2 thread-safe (requires pthreads)')
-
-def configure(conf):
-
- # load the MSVC configuration flags
- if conf.options.msvc:
- conf.env['MSVC_VERSIONS'] = ['msvc ' + conf.options.msvc]
-
- conf.env['MSVC_TARGETS'] = [conf.options.arch]
-
- # default configuration for C programs
- conf.load('compiler_c')
-
- dbg = conf.options.debug
-
- conf.env.CFLAGS += CFLAGS_UNIX + (CFLAGS_UNIX_DBG if dbg else [])
-
- if conf.env.DEST_OS == 'win32':
- conf.env.PLATFORM = 'win32'
-
- if conf.env.CC_NAME == 'msvc':
- conf.env.CFLAGS = CFLAGS_WIN32_COMMON + \
- (CFLAGS_WIN32_DBG if dbg else CFLAGS_WIN32_RELEASE)
- conf.env.LINKFLAGS += CFLAGS_WIN32_L + \
- (CFLAGS_WIN32_L_DBG if dbg else [])
- conf.env.DEFINES += ['WIN32', '_DEBUG', '_LIB']
-
- else:
- conf.env.PLATFORM = 'unix'
-
- if conf.env.DEST_OS == 'sunos':
- conf.env.DEFINES += ['NO_VIZ']
-
- if conf.options.threadsafe:
- if conf.env.PLATFORM == 'unix':
- conf.check_cc(lib='pthread', uselib_store='pthread')
- conf.env.DEFINES += ['GIT_THREADS']
-
- if conf.options.sha1 not in ['openssl', 'ppc', 'builtin']:
- conf.fatal('Invalid SHA1 option')
-
- # check for libcrypto (openssl) if we are using its SHA1 functions
- if conf.options.sha1 == 'openssl':
- conf.check_cfg(package='libcrypto', args=['--cflags', '--libs'], uselib_store='crypto')
- conf.env.DEFINES += ['OPENSSL_SHA1']
-
- elif conf.options.sha1 == 'ppc':
- conf.env.DEFINES += ['PPC_SHA1']
-
- conf.env.sha1 = conf.options.sha1
-
-def build(bld):
-
- # command '[build|clean|install|uninstall]-static'
- if bld.variant == 'static':
- build_library(bld, 'static')
-
- # command '[build|clean|install|uninstall]-shared'
- elif bld.variant == 'shared':
- build_library(bld, 'shared')
-
- # command '[build|clean]-tests'
- elif bld.variant == 'test':
- build_library(bld, 'objects')
- build_test(bld)
-
- # command 'build|clean|install|uninstall': by default, run
- # the same command for both the static and the shared lib
- else:
- from waflib import Options
- Options.commands = [bld.cmd + '-shared', bld.cmd + '-static'] + Options.commands
-
-def get_libgit2_version(git2_h):
- import re
- line = None
-
- with open(git2_h) as f:
- line = re.search(r'^#define LIBGIT2_VERSION "(\d+\.\d+\.\d+)"$', f.read(), re.MULTILINE)
-
- if line is None:
- raise Exception("Failed to detect libgit2 version")
-
- return line.group(1)
-
-
-def build_library(bld, build_type):
-
- BUILD = {
- 'shared' : bld.shlib,
- 'static' : bld.stlib,
- 'objects' : bld.objects
- }
-
- directory = bld.path
- sources = directory.ant_glob('src/*.c')
-
- # Find the version of the library, from our header file
- version = get_libgit2_version(directory.find_node("include/git2.h").abspath())
-
- # Compile platform-dependant code
- # E.g. src/unix/*.c
- # src/win32/*.c
- sources = sources + directory.ant_glob('src/%s/*.c' % bld.env.PLATFORM)
- sources = sources + directory.ant_glob('deps/zlib/*.c')
-
- # SHA1 methods source
- if bld.env.sha1 == "ppc":
- sources.append('src/ppc/sha1.c')
- else:
- sources.append('src/block-sha1/sha1.c')
- #------------------------------
- # Build the main library
- #------------------------------
-
- # either as static or shared;
- BUILD[build_type](
- source=sources,
- target='git2',
- includes=['src', 'include', 'deps/zlib'],
- install_path='${LIBDIR}',
- use=ALL_LIBS,
- vnum=version,
- )
-
- # On Unix systems, build the Pkg-config entry file
- if bld.env.PLATFORM == 'unix' and bld.is_install:
- bld(rule="""sed -e 's#@prefix@#${PREFIX}#' -e 's#@libdir@#${LIBDIR}#' -e 's#@version@#%s#' < ${SRC} > ${TGT}""" % version,
- source='libgit2.pc.in',
- target='libgit2.pc',
- install_path='${LIBDIR}/pkgconfig',
- )
-
- # Install headers
- bld.install_files('${PREFIX}/include', directory.find_node('include/git2.h'))
- bld.install_files('${PREFIX}/include/git2', directory.ant_glob('include/git2/*.h'))
-
- # On Unix systems, let them know about installation
- if bld.env.PLATFORM == 'unix' and bld.cmd == 'install-shared':
- bld.add_post_fun(call_ldconfig)
-
-def call_ldconfig(bld):
- import distutils.spawn as s
- ldconf = s.find_executable('ldconfig')
- if ldconf:
- bld.exec_command(ldconf)
-
-def build_test(bld):
- directory = bld.path
- resources_path = directory.find_node('tests/resources/').abspath().replace('\\', '/')
-
- sources = ['tests/test_lib.c', 'tests/test_helpers.c', 'tests/test_main.c']
- sources = sources + directory.ant_glob('tests/t??-*.c')
-
- bld.program(
- source=sources,
- target='libgit2_test',
- includes=['src', 'tests', 'include'],
- defines=['TEST_RESOURCES="%s"' % resources_path],
- use=['git2'] + ALL_LIBS
- )
-
-class _test(BuildContext):
- cmd = 'test'
- fun = 'test'
-
-def test(bld):
- from waflib import Options
- Options.commands = ['build-test', 'run-test'] + Options.commands
-
-class _build_doc(Context):
- cmd = 'doxygen'
- fun = 'build_docs'
-
-def build_docs(ctx):
- ctx.exec_command("doxygen api.doxygen")
- ctx.exec_command("git stash")
- ctx.exec_command("git checkout gh-pages")
- ctx.exec_command("cp -Rf apidocs/html/* .")
- ctx.exec_command("git add .")
- ctx.exec_command("git commit -am 'generated docs'")
- ctx.exec_command("git push origin gh-pages")
- ctx.exec_command("git checkout master")
-
-class _run_test(Context):
- cmd = 'run-test'
- fun = 'run_test'
-
-def run_test(ctx):
- import shutil, tempfile, sys
-
- failed = False
-
- test_path = 'build/test/libgit2_test'
- if sys.platform == 'win32':
- test_path += '.exe'
-
- test_folder = tempfile.mkdtemp()
- test = ctx.path.find_node(test_path)
-
- if not test or ctx.exec_command(test.abspath(), cwd=test_folder) != 0:
- failed = True
-
- shutil.rmtree(test_folder)
-
- if failed:
- ctx.fatal('Test run failed')
-
-
-CONTEXTS = {
- 'build' : BuildContext,
- 'clean' : CleanContext,
- 'install' : InstallContext,
- 'uninstall' : UninstallContext
-}
-
-def build_command(command):
- ctx, var = command.split('-')
- class _gen_command(CONTEXTS[ctx]):
- cmd = command
- variant = var
-
-build_command('build-static')
-build_command('build-shared')
-build_command('build-test')
-
-build_command('clean-static')
-build_command('clean-shared')
-build_command('clean-test')
-
-build_command('install-static')
-build_command('install-shared')
-
-build_command('uninstall-static')
-build_command('uninstall-shared')
-