summaryrefslogtreecommitdiffstats
path: root/solenv/gbuild/gen-autoinstall.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /solenv/gbuild/gen-autoinstall.py
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'solenv/gbuild/gen-autoinstall.py')
-rw-r--r--solenv/gbuild/gen-autoinstall.py98
1 files changed, 98 insertions, 0 deletions
diff --git a/solenv/gbuild/gen-autoinstall.py b/solenv/gbuild/gen-autoinstall.py
new file mode 100644
index 000000000..d55ab51d3
--- /dev/null
+++ b/solenv/gbuild/gen-autoinstall.py
@@ -0,0 +1,98 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+# generate AutoInstall files from gbuild data for further scp2 processing
+
+import sys
+
+module = sys.argv[1]
+scp2componentcondition = sys.argv[2]
+scp2libtemplate = sys.argv[3]
+scp2exetemplate = sys.argv[4]
+scp2jartemplate = sys.argv[5]
+scp2pkgtemplate = sys.argv[6]
+# use 'with open(file) as f:' to avoid 'ResourceWarning: unclosed file'
+with open(sys.argv[7]) as f:
+ sdklibs = f.readline().split()
+with open(sys.argv[8]) as f:
+ libs = f.readline().split()
+with open(sys.argv[9]) as f:
+ exes = f.readline().split()
+with open(sys.argv[10]) as f:
+ jars = f.readline().split()
+with open(sys.argv[11]) as f:
+ pkgs = f.readline().split()
+
+if len(scp2componentcondition) > 0:
+ scp2componentcondition = "," + scp2componentcondition
+
+def escape(string):
+ return string.replace(".", "_").replace("-", "_").replace("/", "_")
+
+def to_tuple(l):
+ ret = []
+ i = 0
+ while i < len(l):
+ ret.append((l[i], l[i+1]))
+ i += 2
+ return ret
+
+def to_triple(l):
+ ret = []
+ i = 0
+ while i < len(l):
+ ret.append((l[i], l[i+1], l[i+2]))
+ i += 3
+ return ret
+
+print("/* autogenerated installs for group " + module + " */")
+print("#define auto_" + module + "_ALL \\")
+
+autosdklibs = [("auto_" + module + "_link_" + escape(lib),link,target) for (lib,link,target) in to_triple(sdklibs)]
+autolibs = [("auto_" + module + "_lib_" + escape(lib),libfile) for (lib,libfile) in to_tuple(libs)]
+autoexes = [("auto_" + module + "_exe_" + escape(exe),exefile) for (exe,exefile) in to_tuple(exes)]
+autojars = [("auto_" + module + "_jar_" + escape(jar),jar + ".jar") for jar in jars]
+autopkgs = [("auto_" + module + "_pkg_" + escape(pkg),pkg + ".filelist") for pkg in pkgs]
+
+allgids = [gid for (gid,_,_) in autosdklibs] + \
+ [gid for (gid,_) in autolibs] + \
+ [gid for (gid,_) in autoexes] + \
+ [gid for (gid,_) in autojars] + \
+ [gid for (gid,_) in autopkgs]
+
+print(", \\\n".join([" " + gid for gid in allgids]))
+
+for (gid, link, target) in autosdklibs:
+ print("SDK_LIBRARY_LINK(" + gid + "," + link + "," + target + ")")
+
+scp2libtemplates = set([ "URE_PRIVATE_LIB", "LIBO_LIB_FILE", "LIBO_LIB_FILE_BINARYTABLE", "LIBO_LIB_FILE_COMPONENTCONDITION", "SHLXTHDL_LIB_FILE", "SHLXTHDL_X64_LIB_FILE_COMPONENTCONDITION" ])
+for (gid, libfile) in autolibs:
+ if not(scp2libtemplate in scp2libtemplates):
+ raise Exception("invalid scp2libtemplate \"" + scp2libtemplate + "\"")
+ print(scp2libtemplate + "(" + gid + "," + libfile + scp2componentcondition + ")")
+
+scp2exetemplates = set([ "URE_EXECUTABLE", "LIBO_EXECUTABLE", "LIBO_EXECUTABLE_COMPONENTCONDITION", "SDK_EXECUTABLE" ])
+for (gid, exefile) in autoexes:
+ if not(scp2exetemplate in scp2exetemplates):
+ raise Exception("invalid scp2exetemplate \"" + scp2exetemplate + "\"")
+ print(scp2exetemplate + "(" + gid + "," + exefile + scp2componentcondition + ")")
+
+scp2jartemplates = set([ "URE_JAR_FILE", "LIBO_JAR_FILE" ])
+for (gid, jarfile) in autojars:
+ if not(scp2jartemplate in scp2jartemplates):
+ raise Exception("invalid scp2jartemplate \"" + scp2jartemplate + "\"")
+ print(scp2jartemplate + "(" + gid + "," + jarfile + scp2componentcondition + ")")
+
+scp2pkgtemplates = set([ "PACKAGE_FILELIST", "PACKAGE_FILELIST_COMPONENTCONDITION","PACKAGE_FILELIST_FONT", "SDK_PACKAGE_FILELIST" ])
+for (gid, pkgfilelist) in autopkgs:
+ if not(scp2pkgtemplate in scp2pkgtemplates):
+ raise Exception("invalid scp2pkgtemplate \"" + scp2pkgtemplate + "\"")
+ print(scp2pkgtemplate + "(" + gid + "," + pkgfilelist + scp2componentcondition + ")")
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab: