poppler: Upgrade 24.05.0
[LibreOffice.git] / solenv / gbuild / gen-autoinstall.py
blobd55ab51d382256bcd2a0ec067d32dc04c558fe1b
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # generate AutoInstall files from gbuild data for further scp2 processing
12 import sys
14 module = sys.argv[1]
15 scp2componentcondition = sys.argv[2]
16 scp2libtemplate = sys.argv[3]
17 scp2exetemplate = sys.argv[4]
18 scp2jartemplate = sys.argv[5]
19 scp2pkgtemplate = sys.argv[6]
20 # use 'with open(file) as f:' to avoid 'ResourceWarning: unclosed file'
21 with open(sys.argv[7]) as f:
22 sdklibs = f.readline().split()
23 with open(sys.argv[8]) as f:
24 libs = f.readline().split()
25 with open(sys.argv[9]) as f:
26 exes = f.readline().split()
27 with open(sys.argv[10]) as f:
28 jars = f.readline().split()
29 with open(sys.argv[11]) as f:
30 pkgs = f.readline().split()
32 if len(scp2componentcondition) > 0:
33 scp2componentcondition = "," + scp2componentcondition
35 def escape(string):
36 return string.replace(".", "_").replace("-", "_").replace("/", "_")
38 def to_tuple(l):
39 ret = []
40 i = 0
41 while i < len(l):
42 ret.append((l[i], l[i+1]))
43 i += 2
44 return ret
46 def to_triple(l):
47 ret = []
48 i = 0
49 while i < len(l):
50 ret.append((l[i], l[i+1], l[i+2]))
51 i += 3
52 return ret
54 print("/* autogenerated installs for group " + module + " */")
55 print("#define auto_" + module + "_ALL \\")
57 autosdklibs = [("auto_" + module + "_link_" + escape(lib),link,target) for (lib,link,target) in to_triple(sdklibs)]
58 autolibs = [("auto_" + module + "_lib_" + escape(lib),libfile) for (lib,libfile) in to_tuple(libs)]
59 autoexes = [("auto_" + module + "_exe_" + escape(exe),exefile) for (exe,exefile) in to_tuple(exes)]
60 autojars = [("auto_" + module + "_jar_" + escape(jar),jar + ".jar") for jar in jars]
61 autopkgs = [("auto_" + module + "_pkg_" + escape(pkg),pkg + ".filelist") for pkg in pkgs]
63 allgids = [gid for (gid,_,_) in autosdklibs] + \
64 [gid for (gid,_) in autolibs] + \
65 [gid for (gid,_) in autoexes] + \
66 [gid for (gid,_) in autojars] + \
67 [gid for (gid,_) in autopkgs]
69 print(", \\\n".join([" " + gid for gid in allgids]))
71 for (gid, link, target) in autosdklibs:
72 print("SDK_LIBRARY_LINK(" + gid + "," + link + "," + target + ")")
74 scp2libtemplates = set([ "URE_PRIVATE_LIB", "LIBO_LIB_FILE", "LIBO_LIB_FILE_BINARYTABLE", "LIBO_LIB_FILE_COMPONENTCONDITION", "SHLXTHDL_LIB_FILE", "SHLXTHDL_X64_LIB_FILE_COMPONENTCONDITION" ])
75 for (gid, libfile) in autolibs:
76 if not(scp2libtemplate in scp2libtemplates):
77 raise Exception("invalid scp2libtemplate \"" + scp2libtemplate + "\"")
78 print(scp2libtemplate + "(" + gid + "," + libfile + scp2componentcondition + ")")
80 scp2exetemplates = set([ "URE_EXECUTABLE", "LIBO_EXECUTABLE", "LIBO_EXECUTABLE_COMPONENTCONDITION", "SDK_EXECUTABLE" ])
81 for (gid, exefile) in autoexes:
82 if not(scp2exetemplate in scp2exetemplates):
83 raise Exception("invalid scp2exetemplate \"" + scp2exetemplate + "\"")
84 print(scp2exetemplate + "(" + gid + "," + exefile + scp2componentcondition + ")")
86 scp2jartemplates = set([ "URE_JAR_FILE", "LIBO_JAR_FILE" ])
87 for (gid, jarfile) in autojars:
88 if not(scp2jartemplate in scp2jartemplates):
89 raise Exception("invalid scp2jartemplate \"" + scp2jartemplate + "\"")
90 print(scp2jartemplate + "(" + gid + "," + jarfile + scp2componentcondition + ")")
92 scp2pkgtemplates = set([ "PACKAGE_FILELIST", "PACKAGE_FILELIST_COMPONENTCONDITION","PACKAGE_FILELIST_FONT", "SDK_PACKAGE_FILELIST" ])
93 for (gid, pkgfilelist) in autopkgs:
94 if not(scp2pkgtemplate in scp2pkgtemplates):
95 raise Exception("invalid scp2pkgtemplate \"" + scp2pkgtemplate + "\"")
96 print(scp2pkgtemplate + "(" + gid + "," + pkgfilelist + scp2componentcondition + ")")
98 # vim:set shiftwidth=4 softtabstop=4 expandtab: