import from svn
[unitool.git] / db / StoreLibtool.java
blob180cdbca805f330b0e0350bd6166198c7963ccc4
2 package org.de.metux.unitool.db;
4 import org.de.metux.unitool.base.*;
5 import org.de.metux.unitool.db.*;
6 import org.de.metux.util.*;
8 // FIXME: move this to sub-package
9 public class StoreLibtool
11 private static String _fixstr(String str)
13 if (str==null)
14 return "";
15 else
16 return str;
19 private static String _fixstr(String[] str)
21 if (str==null)
22 return "";
24 String res = null;
25 for (int x=0; x<str.length; x++)
27 if (res==null)
28 res = str[x];
29 else
30 res += " "+str[x];
32 return res;
35 public static void store(ObjectInfo inf, String lo_file)
37 String text =
38 "# "+lo_file+" - a libtool object file\n"+
39 "# Generated by ltmain.sh - GNU libtool 1.5.0a\n"+
40 "#\n"+
41 "# Well, in fact it is generated by unitool's libtool emulation\n"+
42 "\n"+
43 "# Name of the PIC object\n"+
44 "pic_object='"+inf.object_pic+"'\n"+
45 "\n"+
46 "# Name of the non-PIC object\n"+
47 "non_pic_object='"+inf.object_nonpic+"'\n"+
48 "\n";
50 StoreFile.store(lo_file,text);
53 public static void store(ObjectInfo inf)
55 store(inf,inf.lo_file);
58 public static void store(LibraryInfo inf, String la_file)
60 String fn_short = PathNormalizer.basename(la_file);
62 // compute dependencies
63 String depnames = "";
65 if (inf.dependency_names!=null)
66 for (int x=0; x<inf.dependency_names.length; x++)
67 depnames += " "+inf.dependency_names[x];
69 String text =
70 "# "+fn_short+" - a libbtool library file\n"+
71 "# Generated by ltmain.sh - GNU libtool 1.5.0a\n"+
72 "#\n"+
73 "# Well, in fact generated by unitool \n"+
74 "#\n"+
75 "\n"+
76 "# The name that we can dlopen(3).\n"+
77 "dlname='"+_fixstr(inf.dlname)+"'\n"+
78 "\n"+
79 "# Names of this library.\n"+
80 "library_names='"+_fixstr(inf.dynamic_libnames)+"'\n"+
81 "\n"+
82 "# The name of the static archive.\n"+
83 "old_library='"+_fixstr(inf.arname)+"'\n"+
84 "\n"+
85 "dependency_libs='"+depnames+"'\n"+
86 "\n"+
87 "# Version information for "+inf.name+".\n"+
88 "current="+inf.version_current+"\n"+
89 "age="+inf.version_age+"\n"+
90 "revision="+inf.version_revision+"\n"+
91 "\n"+
92 "release='"+_fixstr(inf.release)+"'\n"+
93 "\n"+
94 "# Is this an already installed library ?\n"+
95 "installed="+(inf.installed ? "yes" : "no")+"\n"+
96 "\n"+
97 "# Files to dlopen/dlpreopen\n"+
98 "dlopen='"+_fixstr(inf.param_dlopen)+"'\n"+
99 "dlpreopen='"+_fixstr(inf.param_dlpreopen)+"'\n"+
100 "\n"+
101 "# Directory that library needs to be installed in\n"+
102 "libdir='"+_fixstr(inf.libdir)+"'\n"+
103 "\n";
105 StoreFile.store(la_file, text);