2 package org
.de
.metux
.unitool
.libtool
;
6 import org
.de
.metux
.util
.Environment
;
7 import org
.de
.metux
.util
.StrReplace
;
8 import org
.de
.metux
.util
.FileOps
;
9 import org
.de
.metux
.util
.PathNormalizer
;
11 import org
.de
.metux
.propertylist
.IPropertylist
;
13 import org
.de
.metux
.unitool
.base
.ToolConfig
;
14 import org
.de
.metux
.unitool
.base
.ToolParam
;
15 import org
.de
.metux
.unitool
.base
.InstallerParam
;
16 import org
.de
.metux
.unitool
.base
.EParameterMissing
;
17 import org
.de
.metux
.unitool
.base
.EParameterInvalid
;
18 import org
.de
.metux
.unitool
.db
.LoadLibtoolArchive
;
19 import org
.de
.metux
.unitool
.tools
.LTLibraryInstaller
;
21 public class CmdInstall
27 CmdInstall(String
[] argv
, ToolConfig cf
) throws Exception
33 public String
[] stripfirst(String par
[])
35 String n
[] = new String
[par
.length
];
36 for (int x
=0; x
<(par
.length
-1); x
++)
42 throws EParameterMissing
, EParameterInvalid
44 if (args
[0].equals("-s"))
46 param
.setInstallStrip();
47 args
= stripfirst(args
);
52 if (args
[0].equals("-m"))
54 System
.err
.println("Ignoring Mode: "+args
[1]);
55 args
= stripfirst(stripfirst(args
));
60 if (args
[0].equals("-c"))
62 System
.err
.println("[LT-Install] Ignoring -c");
63 args
= stripfirst(args
);
68 if (args
[0].endsWith(".la") && args
[1].endsWith(".la"))
70 System
.out
.println("LTLibraryInstaller Param: "+param
);
71 param
.setInstallSource(args
[0]);
72 param
.setInstallTarget(args
[1]);
73 new LTLibraryInstaller().run(param
);
75 else if (args
[0].endsWith(".la"))
77 System
.out
.println("Assuming we wanna install .la to directory "+args
[1]);
78 param
.setInstallSource(args
[0]);
79 param
.setInstallTarget(args
[1]+"/"+PathNormalizer
.basename(args
[0]));
80 new LTLibraryInstaller().run(param
);
86 String src_dirname
= PathNormalizer
.dirname(src
);
87 String src_basename
= PathNormalizer
.basename(src
);
88 System
.out
.println("Assuming we wanna install an binary: "+src
);
91 ((src_dirname
.length()!=0) ?
(src_dirname
+"/") : "")+
92 LoadLibtoolArchive
.tmp_libdir
+
95 System
.out
.println("Try_copy: real_src="+real_src
);
96 System
.out
.println(" dst="+dst
);
98 if (new File(real_src
).exists())
100 System
.out
.println("OKAY; file exists. we can copy it.\n");
101 FileOps
.cp(real_src
,dst
);
104 throw new RuntimeException("Source file does not exist. Either build incomplete or parameter scheme not understood");
109 throws EParameterMissing
, EParameterInvalid
112 throw new RuntimeException("missing installer command set");
114 if (args
[1].equals("--finish"))
116 System
.out
.println("Installer: finishing -> nothing to do");
120 param
= new InstallerParam(config
);
122 param
.setSysroot(Environment
.getenv("SYSROOT"));
123 param
.setInstallerCommand(args
[1]);
124 param
.normalizer
.addSkip(Environment
.getenv("SRCDIR"));
126 System
.out
.println("Installer command: "+args
[1]);
128 args
= stripfirst(stripfirst(args
));
130 if (args
[0].endsWith("/install-sh"))
131 args
= stripfirst(args
);
133 if (args
[0].equals("-c"))
135 args
= stripfirst(args
);
139 throw new RuntimeException("this kind of parameter not (yet) understood: \""+
140 args
[2]+"\" \""+args
[3]+"\" \""+args
[4]+"\"" );