Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Remove dependency on dpkg |
| 2 | |
| 3 | Upstream-Status: Submitted |
| 4 | |
| 5 | Asking the host OS whether it supports multiarch is not useful |
| 6 | in a cross-compilation environment, or if the user has specified |
| 7 | a libdir explicitly. So this patch, based on the work of Mentor |
| 8 | Graphics, removes mklibs's dependency on dpkg package. |
| 9 | |
| 10 | Signed-off-by: Yuanjie Huang <Yuanjie.Huang@windriver.com> |
| 11 | src/mklibs | 30 +++++++++++++++++++----------- |
| 12 | 1 file changed, 19 insertions(+), 11 deletions(-) |
| 13 | |
| 14 | diff --git a/src/mklibs b/src/mklibs |
| 15 | index d9b784b..c5614ea 100755 |
| 16 | --- a/src/mklibs |
| 17 | +++ b/src/mklibs |
| 18 | @@ -261,6 +261,11 @@ def extract_soname(so_file): |
| 19 | return "" |
| 20 | |
| 21 | def multiarch(paths): |
| 22 | + # Asking the host OS whether it supports multiarch is not useful |
| 23 | + # in a cross-compilation environment, or if the user has specified |
| 24 | + # a libdir explicitly. |
| 25 | + if sysroot != "" or libdir != "": |
| 26 | + return paths |
| 27 | devnull = open('/dev/null', 'w') |
| 28 | dpkg_architecture = subprocess.Popen( |
| 29 | ['dpkg-architecture', '-qDEB_HOST_MULTIARCH'], |
| 30 | @@ -340,7 +345,7 @@ lib_path = [] |
| 31 | dest_path = "DEST" |
| 32 | ldlib = "LDLIB" |
| 33 | include_default_lib_path = "yes" |
| 34 | -default_lib_path = multiarch(["/lib/", "/usr/lib/", "/usr/X11R6/lib/"]) |
| 35 | +default_lib_path = ["/lib/", "/usr/lib/", "/usr/X11R6/lib/"] |
| 36 | libc_extras_dir = "/usr/lib/libc_pic" |
| 37 | libc_extras_dir_default = True |
| 38 | libdir = "lib" |
| 39 | @@ -386,7 +391,7 @@ for opt, arg in optlist: |
| 40 | elif opt == "--libdir": |
| 41 | libdir = arg |
| 42 | elif opt in ("--help", "-h"): |
| 43 | - usage(0) |
| 44 | + usage(0) |
| 45 | sys.exit(0) |
| 46 | elif opt in ("--version", "-V"): |
| 47 | version(vers) |
| 48 | @@ -395,6 +400,7 @@ for opt, arg in optlist: |
| 49 | print "WARNING: unknown option: " + opt + "\targ: " + arg |
| 50 | |
| 51 | if include_default_lib_path == "yes": |
| 52 | + default_lib_path = multiarch(default_lib_path) |
| 53 | lib_path.extend([a.replace("/lib/", "/" + libdir + "/") for a in default_lib_path]) |
| 54 | |
| 55 | if libc_extras_dir_default: |
| 56 | @@ -661,16 +669,16 @@ ld_path_name = os.path.dirname(ldlib) |
| 57 | ld_full_path = "../" + ldlib |
| 58 | ld_file = find_lib(ld_file_name) |
| 59 | |
| 60 | -if ld_path_name != "/lib": |
| 61 | - if os.access(dest_path + "/" + ld_file_name, os.F_OK): |
| 62 | - os.remove(dest_path + "/" + ld_file_name) |
| 63 | +#if ld_path_name != "/lib": |
| 64 | +# if os.access(dest_path + "/" + ld_file_name, os.F_OK): |
| 65 | +# os.remove(dest_path + "/" + ld_file_name) |
| 66 | |
| 67 | -if not os.path.exists(dest_path + "/../" + ld_path_name): |
| 68 | - os.mkdir(dest_path + "/../" + ld_path_name) |
| 69 | +#if not os.path.exists(dest_path + "/../" + ld_path_name): |
| 70 | +# os.mkdir(dest_path + "/../" + ld_path_name) |
| 71 | |
| 72 | -if not os.access(dest_path + "/" + ld_full_path, os.F_OK): |
| 73 | - debug(DEBUG_NORMAL, "I: stripping and copying dynamic linker to " + ld_full_path) |
| 74 | +if not os.access(dest_path + "/" + ld_file_name, os.F_OK): |
| 75 | + debug(DEBUG_NORMAL, "I: stripping and copying dynamic linker to " + ld_file_name) |
| 76 | command(target + "objcopy", "--strip-unneeded -R .note -R .comment", |
| 77 | - ld_file, dest_path + "/" + ld_full_path) |
| 78 | + ld_file, dest_path + "/" + ld_file_name) |
| 79 | |
| 80 | -os.chmod(dest_path + "/" + ld_full_path, 0755) |
| 81 | +os.chmod(dest_path + "/" + ld_file_name, 0755) |