3131 }
3232
3333
34- def build_android_xlog_static_libs (_path = "mars_xlog_sdk" , _arch = "" ):
34+ def build_android_xlog_static_libs (_path = "mars_xlog_sdk" , _arch = "armeabi " ):
3535 libs_save_path = _path + "/mars_libs"
3636 src_save_path = _path + "/"
3737
@@ -186,10 +186,15 @@ def choose_android_mars_jni_arch():
186186 platforms = ['armeabi' , 'x86' , 'mips' , 'armeabi-v7a' , 'arm64-v8a' , 'x86_64' , 'mips64' ]
187187 archnum = raw_input ("Enter the architecture which would like to build:\n 1. armeabi.\n 2. x86.\n 3. mips.\n 4. armeabi-v7a.\n 5. arm64-v8a.\n 6. x86_64.\n 7. mips64.\n 8. exit.\n " )
188188
189- if archnum >= "1" and archnum <= str (len (platforms )):
190- return platforms [int (archnum )- 1 ]
191- else :
192- return None
189+ arr = []
190+
191+ archs = archnum .split (',' )
192+ for i in range (0 , len (archs )):
193+ if archs [i ] >= "1" and archs [i ] <= str (len (platforms )):
194+ arr .append (platforms [int (archs [i ])- 1 ])
195+
196+ return arr
197+
193198
194199
195200def main ():
@@ -198,7 +203,7 @@ def main():
198203
199204 while True :
200205 flag = 0
201- arch = []
206+ archs = []
202207 if len (sys .argv ) >= 2 and len (sys .argv [1 ])== 1 and sys .argv [1 ] >= "1" and sys .argv [1 ] <= "5" :
203208 num = sys .argv [1 ]
204209 platforms = ['x86' , 'x86_64' , 'armeabi' , 'arm64-v8a' , 'armeabi-v7a' , 'mips' , 'mips64' ]
@@ -208,10 +213,10 @@ def main():
208213 flag = 1
209214 else :
210215 num = raw_input ("Enter menu:\n 1. build mars static libs.\n 2. build mars shared libs.\n 3. build xlog static libs.\n 4. build xlog shared libs.\n 5. exit.\n " )
211- arch = choose_android_mars_jni_arch ()
212- if not arch :
216+ archs = choose_android_mars_jni_arch ()
217+ if len ( archs ) == 0 :
213218 return
214-
219+
215220 if flag == 1 :
216221 if "1" == num :
217222 return build_android_mars_static_libs ()
@@ -226,20 +231,65 @@ def main():
226231 else :
227232 pass
228233 else :
229- if "1" == num :
230- return build_android_mars_static_libs (MARS_LIBS_PATH , arch )
231- elif "2" == num :
232- return build_android_mars_shared_libs (MARS_LIBS_PATH , arch )
233234
234- elif "3" == num :
235- return build_android_xlog_static_libs (XLOG_LIBS_PATH , arch )
236- elif "4" == num :
237- return build_android_xlog_shared_libs (XLOG_LIBS_PATH , arch )
235+
236+ if "1" == num or "2" == num :
237+ sdk_path = MARS_LIBS_PATH
238+ elif "3" == num or "4" == num :
239+ sdk_path = XLOG_LIBS_PATH
240+ else :
241+ continue
242+
243+ SO_CACHE_DIR = sdk_path + "/so_cache/"
244+ SO_SYMBOL_CACHE_DIR = sdk_path + "/so_cache/symbol/"
245+ SO_DES_DIR = sdk_path + "/libs/"
246+ SO_SYMBOL_DES_IR = sdk_path + "/obj/local/"
247+
248+
249+ for i in range (0 , len (archs )):
250+ print "build %s" % (archs [i ])
251+
252+ arch = archs [i ]
253+
254+ if "1" == num :
255+ build_android_mars_static_libs (MARS_LIBS_PATH , arch )
256+ elif "2" == num :
257+ build_android_mars_shared_libs (MARS_LIBS_PATH , arch )
258+ elif "3" == num :
259+ build_android_xlog_static_libs (XLOG_LIBS_PATH , arch )
260+ elif "4" == num :
261+ build_android_xlog_shared_libs (XLOG_LIBS_PATH , arch )
262+
263+ elif "5" == num :
264+ return 0
265+ else :
266+ return 0
267+
268+ libs_cache_dir = SO_CACHE_DIR + arch
269+ symbols_cache_dir = SO_SYMBOL_CACHE_DIR + arch
270+ libs_des_dir = SO_DES_DIR + arch
271+ symbols_des_dir = SO_SYMBOL_DES_IR + arch
272+
273+ if not os .path .exists (libs_cache_dir ):
274+ os .makedirs (libs_cache_dir )
275+ if not os .path .exists (symbols_cache_dir ):
276+ os .makedirs (symbols_cache_dir )
277+
278+ for lib in glob .glob (libs_des_dir + "/*.so" ):
279+ shutil .copy (lib , libs_cache_dir )
280+ for lib in glob .glob (symbols_des_dir + "/*.so" ):
281+ shutil .copy (lib , symbols_cache_dir )
282+
283+
284+ shutil .rmtree (SO_DES_DIR )
285+ shutil .rmtree (SO_SYMBOL_DES_IR )
286+ for i in range (0 , len (archs )):
287+ shutil .copytree (SO_CACHE_DIR + archs [i ], SO_DES_DIR + archs [i ])
288+ shutil .copytree (SO_SYMBOL_CACHE_DIR + archs [i ], SO_SYMBOL_DES_IR + archs [i ])
289+
290+ return
291+
238292
239- elif "5" == num :
240- return 0
241- else :
242- pass
243293
244294if __name__ == "__main__" :
245295 main ()
0 commit comments