9dc9833dcee901c6d0e6720b689daade0d1abc2c
[platform/upstream/iotivity.git] / extlibs / wksxmppxep / SConscript
1 ######################################################################
2 # Ref. libstrophe library build script
3 #
4 ######################################################################
5 import os
6 import commands
7
8 Import('env')
9
10 base_dir = env.get('SRC_DIR')
11 target_os = env.get('TARGET_OS')
12 target_arch = env.get('TARGET_ARCH')
13
14 with_ra_ibb = env.get('WITH_RA_IBB')
15
16 SRC_NAME = 'wks_xep0047'
17 EXT_NAME = 'wksxmppxep'
18 EXT_BASE = 'extlibs/' + EXT_NAME
19 EXT_PATH = EXT_BASE + '/' + SRC_NAME
20 SRC_PATH = base_dir + '/' + EXT_PATH
21 INC_PATH = SRC_PATH + '/include'
22 LIB_PATH = SRC_PATH
23
24 if with_ra_ibb:
25         env.SConscript(base_dir + '/extlibs/libstrophe/SConscript')
26         if not os.path.exists(SRC_NAME):
27                 raxmpp_env = Environment(ENV = os.environ)
28                 c = raxmpp_env.Action(['git clone https://github.com/WorksSystems/wks_xep0047.git ' + SRC_NAME,
29                         'cd ' + SRC_NAME + ' && git checkout b95f22064241d1319c4dc967878706b4a446d186'
30         ])
31
32                 print 'Downloading', SRC_NAME ,'library ...'
33                 if raxmpp_env.Execute(c):
34                         print '''
35         *********************************** Error: ***********************************************
36         * Please download ra_xmpp as following:
37         *     $ git clone https://github.com/WorksSystems/wksxmpp_chat.git extlibs/wksxmppxep/wksxmpp_chat
38         *     $ cd extlibs/wksxmppxep/wksxmpp_chat
39         *     $ git checkout 9f5d726df9779bec5d3036acfbca70c97958921d
40         ******************************************************************************************
41         '''
42                         Exit(1)
43                 else:
44                         print 'Download', SRC_NAME, 'library complete'
45
46         os.chdir(SRC_NAME)
47         if not os.path.exists(SRC_NAME + '/libwksxmppxep.so') :
48                 LIBSTROPHE_BASE=base_dir + '/extlibs/libstrophe/libstrophe'
49                 foo=commands.getoutput('make LIBSTROPHE_BASE=' + LIBSTROPHE_BASE + ' libraries')
50                 #print foo
51         env.PrependUnique(CPPPATH = [INC_PATH], RALIBS = ['wksxmppxep', 'm', 'crypto'], RALIBPATH = [LIB_PATH], RARPATH = [LIB_PATH])
52
53 if env.GetOption('clean') :
54         act = env.Action(['cd ' + SRC_PATH, 'make clean'])
55         env.Execute(act)