c6bb6ce833737ab38fa426e287a4c50353fd8c4b
[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 8e9f42d02a0f416001065d1cddc1ab07974cef14'
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 8e9f42d02a0f416001065d1cddc1ab07974cef14
40         ******************************************************************************************
41         '''
42                         Exit(1)
43                 else:
44                         print 'Download', SRC_NAME, 'library complete'
45
46         print 'Building with ' + SRC_NAME
47         os.chdir(SRC_NAME)
48         if not os.path.exists('libwksxmppxep.so') :
49                 LIBSTROPHE_BASE=base_dir + '/extlibs/libstrophe/libstrophe'
50                 foo=commands.getoutput('make LIBSTROPHE_BASE=' + LIBSTROPHE_BASE + ' libraries')
51                 print foo
52
53         if not os.path.exists('libwksxmppxep.so') :
54                 print 'Building with ' + SRC_NAME + ' failed.'
55                 Exit(2)
56
57         print 'Building with ' + SRC_NAME + ' Completely.'
58
59         env.PrependUnique(CPPPATH = [INC_PATH], RALIBS = ['wksxmppxep', 'm', 'crypto'], RALIBPATH = [LIB_PATH], RARPATH = [LIB_PATH])
60
61 if env.GetOption('clean') :
62         act = env.Action(['cd ' + SRC_PATH, 'make clean'])
63         env.Execute(act)