|
Revision 19827, 1.5 kB
(checked in by tokuhirom, 5 years ago)
|
|
better detect
|
| Line | |
|---|
| 1 | import platform |
|---|
| 2 | from distutils import sysconfig |
|---|
| 3 | |
|---|
| 4 | Import("env") |
|---|
| 5 | Import("conf") |
|---|
| 6 | |
|---|
| 7 | def GuessOS(): |
|---|
| 8 | id = platform.system() |
|---|
| 9 | if id == 'Linux': |
|---|
| 10 | return 'linux' |
|---|
| 11 | elif id == 'Darwin': |
|---|
| 12 | return 'macos' |
|---|
| 13 | elif id == 'Windows': |
|---|
| 14 | return 'win32' |
|---|
| 15 | else: |
|---|
| 16 | return None |
|---|
| 17 | |
|---|
| 18 | OS_GUESS = GuessOS() |
|---|
| 19 | |
|---|
| 20 | env.Append( |
|---|
| 21 | CCFLAGS = ['-DUSING_V8_SHARED'], |
|---|
| 22 | CPPPATH = ['../../v8/include/', '../src/', '/opt/local/include/', sysconfig.get_python_inc()], |
|---|
| 23 | LIBPATH = ['../../v8/'], |
|---|
| 24 | ) |
|---|
| 25 | |
|---|
| 26 | if conf.CheckCHeader("Python.h"): |
|---|
| 27 | env.SharedLibrary( |
|---|
| 28 | "python", |
|---|
| 29 | ['python.cc'], |
|---|
| 30 | LIBS=['v8', 'python' + sysconfig.get_config_var('VERSION')], |
|---|
| 31 | ) |
|---|
| 32 | |
|---|
| 33 | # libmemcached |
|---|
| 34 | if conf.CheckLib('memcached'): |
|---|
| 35 | env.SharedLibrary( |
|---|
| 36 | "libmemcached", |
|---|
| 37 | ['libmemcached.cc'], |
|---|
| 38 | LIBS=['v8', 'memcached'], |
|---|
| 39 | ) |
|---|
| 40 | elif OS_GUESS == 'win32': |
|---|
| 41 | env.SharedLibrary( |
|---|
| 42 | "memcached", |
|---|
| 43 | ['libmemcached-win32.cc'], |
|---|
| 44 | LIBS=['v8', 'ws2_32'], |
|---|
| 45 | ) |
|---|
| 46 | |
|---|
| 47 | if OS_GUESS == 'linux' or OS_GUESS == 'macos': |
|---|
| 48 | env.SharedLibrary( |
|---|
| 49 | "posix", |
|---|
| 50 | ['posix.cc'], |
|---|
| 51 | LIBS=['v8'], |
|---|
| 52 | ) |
|---|
| 53 | |
|---|
| 54 | # curl |
|---|
| 55 | if conf.CheckLib('curl'): |
|---|
| 56 | libs = ['v8', 'curl'] |
|---|
| 57 | if conf.CheckLib('iconv') or OS_GUESS == 'macos': |
|---|
| 58 | libs.append('iconv') |
|---|
| 59 | env.SharedLibrary( |
|---|
| 60 | "curl", |
|---|
| 61 | ['curl.cc'], |
|---|
| 62 | LIBS=libs, |
|---|
| 63 | ) |
|---|
| 64 | |
|---|
| 65 | # fcgi |
|---|
| 66 | if conf.CheckLib('fcgi'): |
|---|
| 67 | env.SharedLibrary( |
|---|
| 68 | "fcgi", |
|---|
| 69 | ['fcgi.cc'], |
|---|
| 70 | LIBS=['v8', 'fcgi'], |
|---|
| 71 | ) |
|---|
| 72 | |
|---|
| 73 | # sqlite3 |
|---|
| 74 | env.SharedLibrary( |
|---|
| 75 | "sqlite3", |
|---|
| 76 | ["sqlite3-amalgamination.c", 'sqlite3.cc'], |
|---|
| 77 | LIBS=['v8'], |
|---|
| 78 | ) |
|---|