aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Kubaj <pkubaj@FreeBSD.org>2023-09-27 06:40:47 +0000
committerPiotr Kubaj <pkubaj@FreeBSD.org>2023-09-27 13:43:04 +0000
commitedff56235598162920b98775d8d2445eaa35defe (patch)
treeade19f43f528329d2def90bd3bff03967eb44888
parent41d81a86e060f6144a54600660a59ee3b7981d14 (diff)
downloadports-edff56235598162920b98775d8d2445eaa35defe.tar.gz
ports-edff56235598162920b98775d8d2445eaa35defe.zip
devel/blueprint-compiler: fix runtime on big-endian
-rw-r--r--devel/blueprint-compiler/Makefile1
-rw-r--r--devel/blueprint-compiler/files/patch-blueprintcompiler_gir.py13
-rw-r--r--devel/blueprint-compiler/files/patch-blueprintcompiler_typelib.py38
3 files changed, 52 insertions, 0 deletions
diff --git a/devel/blueprint-compiler/Makefile b/devel/blueprint-compiler/Makefile
index 1ad9b062b1b6..7084d92106e3 100644
--- a/devel/blueprint-compiler/Makefile
+++ b/devel/blueprint-compiler/Makefile
@@ -1,6 +1,7 @@
PORTNAME= blueprint-compiler
DISTVERSIONPREFIX= v
DISTVERSION= 0.10.0
+PORTREVISION= 1
CATEGORIES= devel
MAINTAINER= jbeich@FreeBSD.org
diff --git a/devel/blueprint-compiler/files/patch-blueprintcompiler_gir.py b/devel/blueprint-compiler/files/patch-blueprintcompiler_gir.py
new file mode 100644
index 000000000000..48471f4d9a05
--- /dev/null
+++ b/devel/blueprint-compiler/files/patch-blueprintcompiler_gir.py
@@ -0,0 +1,13 @@
+--- blueprintcompiler/gir.py.orig 2023-09-26 21:07:04 UTC
++++ blueprintcompiler/gir.py
+@@ -888,8 +888,8 @@ class Repository(GirNode):
+ return self.lookup_namespace(ns).get_type(dir_entry.DIR_ENTRY_NAME)
+
+ def _resolve_type_id(self, type_id: int) -> GirType:
+- if type_id & 0xFFFFFF == 0:
+- type_id = (type_id >> 27) & 0x1F
++ if type_id & (0xFFFFFF if sys.byteorder == "little" else 0xFFFFFF00) == 0:
++ type_id = ((type_id >> 27) if sys.byteorder == "little" else type_id) & 0x1F
+ # simple type
+ if type_id == typelib.TYPE_BOOLEAN:
+ return BoolType()
diff --git a/devel/blueprint-compiler/files/patch-blueprintcompiler_typelib.py b/devel/blueprint-compiler/files/patch-blueprintcompiler_typelib.py
new file mode 100644
index 000000000000..4953a57016ef
--- /dev/null
+++ b/devel/blueprint-compiler/files/patch-blueprintcompiler_typelib.py
@@ -0,0 +1,38 @@
+--- blueprintcompiler/typelib.py.orig 2023-07-21 20:06:18 UTC
++++ blueprintcompiler/typelib.py
+@@ -61,7 +61,14 @@ class Field:
+ def __init__(self, offset: int, type: str, shift=0, mask=None):
+ self._offset = offset
+ self._type = type
+- self._shift = shift
++ if not mask or sys.byteorder == "little":
++ self._shift = shift
++ elif self._type == "u8" or self._type == "i8":
++ self._shift = 8 - (shift + mask)
++ elif self._type == "u16" or self._type == "i16":
++ self._shift = 16 - (shift + mask)
++ else:
++ self._shift = 32 - (shift + mask)
+ self._mask = (1 << mask) - 1 if mask else None
+ self._name = f"{offset}__{type}__{shift}__{mask}"
+
+@@ -170,7 +177,7 @@ class Typelib:
+ OBJ_FINAL = Field(0x02, "u16", 3, 1)
+ OBJ_GTYPE_NAME = Field(0x08, "string")
+ OBJ_PARENT = Field(0x10, "dir_entry")
+- OBJ_GTYPE_STRUCT = Field(0x14, "string")
++ OBJ_GTYPE_STRUCT = Field(0x12, "string")
+ OBJ_N_INTERFACES = Field(0x14, "u16")
+ OBJ_N_FIELDS = Field(0x16, "u16")
+ OBJ_N_PROPERTIES = Field(0x18, "u16")
+@@ -255,7 +262,9 @@ class Typelib:
+
+ def _int(self, size, signed) -> int:
+ return int.from_bytes(
+- self._typelib_file[self._offset : self._offset + size], sys.byteorder
++ self._typelib_file[self._offset : self._offset + size],
++ sys.byteorder,
++ signed=signed,
+ )
+
+