[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mklibs.py cross patch



i patch mklibs.py to make it work in a crosscompile environment.
please review the patch and include it if you want.

bastian

-- 
Conquest is easy. Control is not.
		-- Kirk, "Mirror, Mirror", stardate unknown
--- mklibs.py.orig	Sat Jan 12 20:21:46 2002
+++ mklibs.py	Sat Jan 12 20:28:52 2002
@@ -199,6 +199,8 @@
 ##   -v, --verbose              Print additional progress information.
 ##   -V, --version              Print the version number and exit.
 ##   -h, --help                 Print this help and exit.
+##   --ldlib-name               Name of dynamic linker (overwrites environment variable ldlib)
+##   --libc-extras-dir          Directory for libc extra files
 ## 
 ##   -d, --dest-dir DIRECTORY   Create libraries in DIRECTORY.
 ## 
@@ -207,25 +209,35 @@
 # Argument parsing
 opts = "L:D:nvVhd:"
 longopts = ["no-default-lib", "dry-run", "verbose", "version", "help",
-            "dest-dir="]
+            "dest-dir=", "ldlib-name=", "libc-extras-dir="]
 optlist, proglist = getopt.getopt(sys.argv[1:], opts, longopts)
 
 # some global variables
 lib_path = "/lib/", "/usr/lib/", "/usr/X11R6/lib/"
 dest_path = "DEST"
+ldlib_name = "LDLIB"
+libc_extras_dir = "/usr/lib/libc_pic"
 so_pattern = re.compile("(.*)\.so(\.\d+)+")
 script_pattern = re.compile("^#!\s*/")
 
 for opt, arg in optlist:
-    if opt == "-v":
-        debuglevel = DEBUG_VERBOSE
+    if opt in ("-v", "--verbose"):
+        if debuglevel < DEBUG_SPAM:
+            debuglevel += 1
     elif opt == "-L":
         lib_path = string.split(arg, ":")
     elif opt in ("-d", "--dest-dir"):
         dest_path = arg
+    elif opt == "--ldlib-name":
+        ldlib_name = arg
+    elif opt == "--libc-extras-dir":
+        libc_extras_dir = arg
     else:
         print "WARNING: unknown option: " + opt + "\targ: " + arg
 
+if ldlib_name == "LDLIB":
+    ldlib_name = os.getenv("ldlib")
+
 objects = {}  # map from inode to filename
 for prog in proglist:
     inode = os.stat(prog)[ST_INO]
@@ -352,9 +364,9 @@
             base_name = so_pattern.match(library).group(1)
             # libc needs its soinit.o and sofini.o as well as the pic
             if base_name == "libc":
-                extra_flags = find_lib(os.getenv("ldlib"))
-                extra_pre_obj = "/usr/lib/libc_pic/soinit.o"
-                extra_post_obj = "/usr/lib/libc_pic/sofini.o"
+                extra_flags = find_lib(ldlib_name)
+                extra_pre_obj = libc_extras_dir + "/soinit.o"
+                extra_post_obj = libc_extras_dir + "/sofini.o"
             else:
                 extra_flags = ""
                 extra_pre_obj = ""
@@ -396,6 +408,6 @@
     os.remove(dest_path + "/" + lib)
 
 # Make the dynamic linker executable
-ld_file = find_lib(os.getenv("ldlib"))
+ld_file = find_lib(ldlib_name)
 ld_file_name = os.path.basename(ld_file)
 os.chmod(dest_path + "/" + ld_file_name, 0755)

Attachment: pgpuzuri9q6ai.pgp
Description: PGP signature


Reply to: