Change to waf as the buildsystem Signed-off-by: Vicent Marti <tanoku@gmail.com>
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
diff --git a/waf b/waf
new file mode 100755
index 0000000..ff85ad3
Binary files /dev/null and b/waf differ
diff --git a/wscript b/wscript
new file mode 100644
index 0000000..0e514c8
--- /dev/null
+++ b/wscript
@@ -0,0 +1,70 @@
+CFLAGS = ["-g", "-O2", "-Wall", "-Wextra"]
+
+def options(opt):
+ opt.load('compiler_c')
+ opt.add_option('--sha1', action='store', default='builtin', help='TODO')
+
+def configure(conf):
+ conf.load('compiler_c')
+
+ if conf.options.sha1 not in ['openssh', 'ppc', 'builtin']:
+ ctx.fatal('Invalid SHA1 option')
+
+ conf.env.sha1 = conf.options.sha1
+
+
+def build(bld):
+ import glob, sys
+
+ sources = glob.glob('src/*.c')
+ flags = CFLAGS
+ defines = []
+ visibility = True
+ os = 'unix'
+
+ if sys.platform == 'win32':
+ # windows configuration
+ flags = flags + ['-TC', '-W4', '-RTC1', '-Zi']
+ defines = defines = ['WIN32', '_DEBUG', '_LIB']
+ visibility = False
+ os = 'win32'
+
+ elif sys.platform == 'cygwin':
+ visibility = False
+
+ elif sys.platform == 'mingw': # TODO
+ pass
+
+ if bld.env.sha1 == "openssh":
+ defines.append('OPENSSL_SHA1')
+
+ elif bld.env.sha1 == "ppc":
+ defines.append('PPC_SHA1')
+ sources.append('src/ppc/sha1.c')
+
+ else:
+ sources.append('src/block-sha1/sha1.c')
+
+ if not visibility:
+ flags.append('-fvisibility=hidden')
+
+ sources = sources + glob.glob('src/%s/*.c' % os)
+
+ bld.stlib(
+ source=sources,
+ target='git2',
+ includes='src',
+ cflags=flags,
+ defines=defines
+ )
+
+ bld.shlib(
+ source=sources,
+ target='git2',
+ includes='src',
+ cflags=flags,
+ defines=defines
+ )
+
+ bld.install_files('${PREFIX}/include/git', glob.glob('src/git/*.h'))
+