From 7e44373f79ea9b7d94c2cd8d684253d0fbf14814 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 8 Aug 2016 22:23:27 +0200 Subject: [PATCH] [DEV] better isolation --- lutin/system.py | 10 ++++-- lutin/z_builder/lutinBuilder_binary.py | 8 +++++ lutin/z_system/lutinSystem_Linux_alsa.py | 10 ++++++ lutin/z_system/lutinSystem_Linux_arpa.py | 33 ++++++++++++++++++++ lutin/z_system/lutinSystem_Linux_c.py | 37 ++++++++++++++++++----- lutin/z_system/lutinSystem_Linux_cxx.py | 6 ++-- lutin/z_system/lutinSystem_Linux_jack.py | 8 +++++ lutin/z_system/lutinSystem_Linux_pulse.py | 28 ++++++++++++++++- lutin/z_system/lutinSystem_Linux_rpc.py | 33 ++++++++++++++++++++ lutin/z_system/lutinSystem_Linux_uuid.py | 34 +++++++++++++++++++++ 10 files changed, 194 insertions(+), 13 deletions(-) create mode 100644 lutin/z_system/lutinSystem_Linux_arpa.py create mode 100644 lutin/z_system/lutinSystem_Linux_rpc.py create mode 100644 lutin/z_system/lutinSystem_Linux_uuid.py diff --git a/lutin/system.py b/lutin/system.py index 841effc..96a178f 100644 --- a/lutin/system.py +++ b/lutin/system.py @@ -29,6 +29,7 @@ class System: self.export_path=[] self.action_on_state={} self.headers=[] + self.version=None def add_export_sources(self, list): tools.list_append_to(self.export_src, list) @@ -43,6 +44,9 @@ class System: def add_export_flag(self, type, list): tools.list_append_to_2(self.export_flags, type, list) + def set_version(self, version_list): + self.version = version_list + def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None): if name_of_state not in self.action_on_add_src_filestate: self.action_on_state[name_of_state] = [[level, name, action]] @@ -82,6 +86,8 @@ def create_module_from_system(target, dict): destination_path=elem["dst"], clip_path=elem["clip"], recursive=elem["recursive"]) + if dict["system"].version != None: + myModule.package_prop["VERSION"] = dict["system"].version return myModule @@ -158,8 +164,8 @@ def exist(lib_name, target_name, target) : debug.verbose("SYSTEM: request: " + data["name"]) data["system"] = theSystem.System(target) data["exist"] = data["system"].valid - except: - debug.warning("Not find: '" + data["name"] + "' ==> get exception") + except Exception as e: + debug.warning("Not find: '" + data["name"] + "' ==> get exception:" + str(e)) return data["exist"] return False diff --git a/lutin/z_builder/lutinBuilder_binary.py b/lutin/z_builder/lutinBuilder_binary.py index 12a22db..efd2470 100644 --- a/lutin/z_builder/lutinBuilder_binary.py +++ b/lutin/z_builder/lutinBuilder_binary.py @@ -145,12 +145,20 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False) for type in ["link-lib"]: if type in flags[view]: cmd.append([("-l" + sss).replace("-l/", "/") for sss in flags[view][type] ]) + for type in ["link-bin"]: + if type in flags[view]: + cmd.append(flags[view][type]) for type in ["link-lib"]: if type in depancy.flags: cmd.append([("-l" + sss).replace("-l/", "/") for sss in depancy.flags[type] ]) for type in ["link-lib"]: if type in target.global_flags: cmd.append([("-l" + sss).replace("-l/", "/") for sss in target.global_flags[type] ]) + for type in ["link-bin"]: + if type in target.global_flags: + cmd.append(target.global_flags[type]) + if type in depancy.flags: + cmd.append(depancy.flags[type]) cmd_line = tools.list_to_str(cmd) # check the dependency for this file : if depend.need_re_package(file_dst, file_src, True, file_cmd=file_cmd, cmd_line=cmd_line) == False \ diff --git a/lutin/z_system/lutinSystem_Linux_alsa.py b/lutin/z_system/lutinSystem_Linux_alsa.py index 3e3b689..30f5478 100644 --- a/lutin/z_system/lutinSystem_Linux_alsa.py +++ b/lutin/z_system/lutinSystem_Linux_alsa.py @@ -26,5 +26,15 @@ class System(system.System): self.valid = True # todo : create a searcher of the presence of the library: self.add_export_flag("link-lib", "asound") + self.add_header_file([ + "/usr/include/alsa/*", + ], + destination_path="alsa", + recursive=True) + self.add_header_file([ + "/usr/include/dssi/*", + ], + destination_path="dssi", + recursive=True) diff --git a/lutin/z_system/lutinSystem_Linux_arpa.py b/lutin/z_system/lutinSystem_Linux_arpa.py new file mode 100644 index 0000000..818f4d6 --- /dev/null +++ b/lutin/z_system/lutinSystem_Linux_arpa.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +## +## @author Edouard DUPIN +## +## @copyright 2012, Edouard DUPIN, all right reserved +## +## @license APACHE v2.0 (see license file) +## + +from lutin import debug +from lutin import system +from lutin import tools +import os + +class System(system.System): + def __init__(self, target): + system.System.__init__(self) + # create some HELP: + self.help="rpc : generic RPC library (developed by oracle)" + # No check ==> on the basic std libs: + self.valid = True + # todo : create a searcher of the presence of the library: + #self.add_export_flag("link-lib", "xns") + self.add_header_file([ + "/usr/include/arpa/*" + ], + destination_path="arpa", + recursive=True) + + + + diff --git a/lutin/z_system/lutinSystem_Linux_c.py b/lutin/z_system/lutinSystem_Linux_c.py index 4319a51..fe1c2f1 100644 --- a/lutin/z_system/lutinSystem_Linux_c.py +++ b/lutin/z_system/lutinSystem_Linux_c.py @@ -38,6 +38,7 @@ class System(system.System): "/usr/include/setjmp.h*", "/usr/include/signal.h*", "/usr/include/string.h*", + "/usr/include/strings.h*", "/usr/include/std*", "/usr/include/tgmath.h*", "/usr/include/time.h*", @@ -57,39 +58,59 @@ class System(system.System): "/usr/include/getopt.h*", "/usr/include/dirent.h*", "/usr/include/setjmp.h*", + "/usr/include/netdb.h*", + "/usr/include/syslog.h*", + "/usr/include/memory.h*", + "/usr/include/poll.h*", + "/usr/include/termios.h*", + "/usr/include/regex.h*", + "/usr/include/semaphore.h*", + "/usr/include/libgen.h*", + "/usr/include/ifaddrs.h*", + "/usr/include/stropts.h*", + "/usr/include/pwd.h*", ], recursive=False) self.add_header_file([ "/usr/include/sys/*", ], destination_path="sys", - recursive=False) + recursive=True) self.add_header_file([ "/usr/include/bits/*", ], destination_path="bits", - recursive=False) + recursive=True) self.add_header_file([ "/usr/include/gnu/*", ], destination_path="gnu", - recursive=False) + recursive=True) self.add_header_file([ "/usr/include/linux/*", ], destination_path="linux", - recursive=False) + recursive=True) self.add_header_file([ "/usr/include/asm/*", ], destination_path="asm", - recursive=False) + recursive=True) self.add_header_file([ "/usr/include/asm-generic/*", ], destination_path="asm-generic", - recursive=False) - self.add_export_flag("link-bin", "/usr/lib/crti.o") - self.add_export_flag("link-bin", "/usr/lib/crt1.o") + recursive=True) + self.add_header_file([ + "/usr/include/netinet/*", + ], + destination_path="netinet", + recursive=True) + self.add_header_file([ + "/usr/include/net/*", + ], + destination_path="net", + recursive=True) + self.add_export_flag("link", "-B/usr/lib") diff --git a/lutin/z_system/lutinSystem_Linux_cxx.py b/lutin/z_system/lutinSystem_Linux_cxx.py index 78c58d2..2403fc7 100644 --- a/lutin/z_system/lutinSystem_Linux_cxx.py +++ b/lutin/z_system/lutinSystem_Linux_cxx.py @@ -20,11 +20,13 @@ class System(system.System): self.help = "CXX: Generic C++ library" self.valid = True # no check needed ==> just add this: - self.add_module_depend(['c']) + self.add_module_depend([ + 'c' + ]) self.add_export_flag("c++", "-D__STDCPP_GNU__") #self.add_export_flag("c++-remove", "-nostdlib") #self.add_export_flag("need-libstdc++", True) - + self.add_export_flag("link-lib", "stdc++") self.add_header_file([ "/usr/include/c++/6.1.1/*" ], diff --git a/lutin/z_system/lutinSystem_Linux_jack.py b/lutin/z_system/lutinSystem_Linux_jack.py index 87112b2..b0405e2 100644 --- a/lutin/z_system/lutinSystem_Linux_jack.py +++ b/lutin/z_system/lutinSystem_Linux_jack.py @@ -25,5 +25,13 @@ class System(system.System): self.valid = True # todo : create a searcher of the presence of the library: self.add_export_flag("link-lib", "jack") + self.add_module_depend([ + 'uuid' + ]) + self.add_header_file([ + "/usr/include/jack/*", + ], + destination_path="jack", + recursive=True) diff --git a/lutin/z_system/lutinSystem_Linux_pulse.py b/lutin/z_system/lutinSystem_Linux_pulse.py index 2a68819..ece8283 100644 --- a/lutin/z_system/lutinSystem_Linux_pulse.py +++ b/lutin/z_system/lutinSystem_Linux_pulse.py @@ -22,8 +22,34 @@ class System(system.System): if not os.path.isfile("/usr/include/pulse/pulseaudio.h"): # we did not find the library reqiested (just return) (automaticly set at false) return; + dst_data = tools.file_read_data("/usr/include/pulse/version.h") + lines = dst_data.split("\n") + patern = "#define pa_get_headers_version() (\"" + version = None + for line in lines: + if line[:len(patern)] == patern: + #Find the version line + version = line[len(patern)] + version2 = line[len(patern)+2] + debug.verbose("detect version '" + version + "'") + break; + if version == None: + debug.warning("Can not det version of Pulseaudio ... ==> remove it") + return + self.set_version([int(version),int(version2)]) self.valid = True # todo : create a searcher of the presence of the library: - self.add_export_flag("link-lib", ["pulse-simple", "pulse"]) + self.add_export_flag("link-lib", [ + "pulsecommon-" + version + ".0", + "pulse-mainloop-glib", + "pulse-simple", + "pulse" + ]) + self.add_export_flag("link", "-L/usr/lib/pulseaudio") + self.add_header_file([ + "/usr/include/pulse/*", + ], + destination_path="pulse", + recursive=True) diff --git a/lutin/z_system/lutinSystem_Linux_rpc.py b/lutin/z_system/lutinSystem_Linux_rpc.py new file mode 100644 index 0000000..76350ee --- /dev/null +++ b/lutin/z_system/lutinSystem_Linux_rpc.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +## +## @author Edouard DUPIN +## +## @copyright 2012, Edouard DUPIN, all right reserved +## +## @license APACHE v2.0 (see license file) +## + +from lutin import debug +from lutin import system +from lutin import tools +import os + +class System(system.System): + def __init__(self, target): + system.System.__init__(self) + # create some HELP: + self.help="rpc : generic RPC library (developed by oracle)" + # No check ==> on the basic std libs: + self.valid = True + # todo : create a searcher of the presence of the library: + self.add_export_flag("link-lib", "rpcsvc") + self.add_header_file([ + "/usr/include/rpc/*" + ], + destination_path="rpc", + recursive=True) + + + + diff --git a/lutin/z_system/lutinSystem_Linux_uuid.py b/lutin/z_system/lutinSystem_Linux_uuid.py new file mode 100644 index 0000000..5320e1b --- /dev/null +++ b/lutin/z_system/lutinSystem_Linux_uuid.py @@ -0,0 +1,34 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +## +## @author Edouard DUPIN +## +## @copyright 2012, Edouard DUPIN, all right reserved +## +## @license APACHE v2.0 (see license file) +## + +from lutin import debug +from lutin import system +from lutin import tools +import os + +class System(system.System): + def __init__(self, target): + system.System.__init__(self) + # create some HELP: + self.help="uuid: Unique ID library" + # check if the library exist: + if not os.path.isfile("/usr/include/uuid/uuid.h"): + # we did not find the library reqiested (just return) (automaticly set at false) + return; + self.valid = True + # todo : create a searcher of the presence of the library: + self.add_export_flag("link-lib", "uuid") + self.add_header_file([ + "/usr/include/uuid/*", + ], + destination_path="uuid", + recursive=True) + +