SHARE
TWEET

Untitled

a guest Feb 19th, 2020 192 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. From 3d40c69515ea97c0996a5e4f99a893bdab803602 Mon Sep 17 00:00:00 2001
  2. From: Adam Duskett <Aduskett@gmail.com>
  3. Date: Wed, 19 Feb 2020 08:25:00 -0800
  4. Subject: [PATCH] gobject-introspection 2019.11.1
  5.  
  6. Signed-off-by: Adam Duskett <Aduskett@gmail.com>
  7. ---
  8.  package/Config.in                             |   1 +
  9.  package/Makefile.in                           |   3 +
  10.  package/gdb/gdb.mk                            |   4 +-
  11.  ...lete-upstream-attempt-at-cross-compi.patch |  33 ++++
  12.  ...d-cross-compilation-support-to-meson.patch | 163 ++++++++++++++++++
  13.  .../0003-disable-tests.patch                  |  29 ++++
  14.  ...canner-add-use-binary-wrapper-option.patch |  52 ++++++
  15.  ...scanner-add-a-use-ldd-wrapper-option.patch |  48 ++++++
  16.  ...scanner-add-a-lib-dirs-envvar-option.patch |  73 ++++++++
  17.  .../0007-Add-rpath-links-to-ccompiler.patch   |  29 ++++
  18.  ...-error-return-codes-from-ldd-wrapper.patch |  28 +++
  19.  package/gobject-introspection/Config.in       |  33 ++++
  20.  .../gobject-introspection/g-ir-compiler.in    |   3 +
  21.  .../g-ir-scanner-lddwrapper.in                |   3 +
  22.  .../g-ir-scanner-qemuwrapper.in               |  17 ++
  23.  package/gobject-introspection/g-ir-scanner.in |   8 +
  24.  .../gobject-introspection.hash                |   4 +
  25.  .../gobject-introspection.mk                  | 133 ++++++++++++++
  26.  package/libiberty/libiberty.hash              |   2 +
  27.  package/libiberty/libiberty.mk                |  27 +++
  28.  ...dist.py-import-lzma-only-when-needed.patch |  50 ------
  29.  ...onfig-add-pkg_config_libdir-property.patch | 102 +++++++++++
  30.  package/meson/cross-compilation.conf.in       |   4 +-
  31.  package/meson/meson.hash                      |   4 +-
  32.  package/meson/meson.mk                        |  10 +-
  33.  package/pkg-meson.mk                          |  47 +++--
  34.  package/pkg-python.mk                         |  22 +--
  35.  package/prelink-cross/prelink-cross.hash      |   3 +
  36.  package/prelink-cross/prelink-cross.mk        |  16 ++
  37.  .../0001-add-PYTHON_INCLUDES-override.patch   |  32 ----
  38.  package/python-gobject/Config.in              |  20 ++-
  39.  package/python-gobject/python-gobject.hash    |   5 +-
  40.  package/python-gobject/python-gobject.mk      |  39 ++---
  41.  package/python/python-wrapper.in              |  10 ++
  42.  package/python/python.mk                      |  17 +-
  43.  package/python3/python-wrapper.in             |  24 +++
  44.  package/python3/python3.mk                    |  17 +-
  45.  37 files changed, 936 insertions(+), 179 deletions(-)
  46.  create mode 100644 package/gobject-introspection/0001-Revert-an-incomplete-upstream-attempt-at-cross-compi.patch
  47.  create mode 100644 package/gobject-introspection/0002-add-cross-compilation-support-to-meson.patch
  48.  create mode 100644 package/gobject-introspection/0003-disable-tests.patch
  49.  create mode 100644 package/gobject-introspection/0004-giscanner-add-use-binary-wrapper-option.patch
  50.  create mode 100644 package/gobject-introspection/0005-giscanner-add-a-use-ldd-wrapper-option.patch
  51.  create mode 100644 package/gobject-introspection/0006-giscanner-add-a-lib-dirs-envvar-option.patch
  52.  create mode 100644 package/gobject-introspection/0007-Add-rpath-links-to-ccompiler.patch
  53.  create mode 100644 package/gobject-introspection/0008-ignore-error-return-codes-from-ldd-wrapper.patch
  54.  create mode 100644 package/gobject-introspection/Config.in
  55.  create mode 100644 package/gobject-introspection/g-ir-compiler.in
  56.  create mode 100644 package/gobject-introspection/g-ir-scanner-lddwrapper.in
  57.  create mode 100644 package/gobject-introspection/g-ir-scanner-qemuwrapper.in
  58.  create mode 100644 package/gobject-introspection/g-ir-scanner.in
  59.  create mode 100644 package/gobject-introspection/gobject-introspection.hash
  60.  create mode 100644 package/gobject-introspection/gobject-introspection.mk
  61.  create mode 100644 package/libiberty/libiberty.hash
  62.  create mode 100644 package/libiberty/libiberty.mk
  63.  delete mode 100644 package/meson/0002-mdist.py-import-lzma-only-when-needed.patch
  64.  create mode 100644 package/meson/0003-envconfig-add-pkg_config_libdir-property.patch
  65.  create mode 100644 package/prelink-cross/prelink-cross.hash
  66.  create mode 100644 package/prelink-cross/prelink-cross.mk
  67.  delete mode 100644 package/python-gobject/0001-add-PYTHON_INCLUDES-override.patch
  68.  create mode 100644 package/python/python-wrapper.in
  69.  create mode 100644 package/python3/python-wrapper.in
  70.  
  71. diff --git a/package/Config.in b/package/Config.in
  72. index f72c77b416..811f444b6b 100644
  73. --- a/package/Config.in
  74. +++ b/package/Config.in
  75. @@ -1720,6 +1720,7 @@ menu "Other"
  76.     source "package/glibmm/Config.in"
  77.     source "package/glm/Config.in"
  78.     source "package/gmp/Config.in"
  79. +   source "package/gobject-introspection/Config.in"
  80.     source "package/gsl/Config.in"
  81.     source "package/gtest/Config.in"
  82.     source "package/jemalloc/Config.in"
  83. diff --git a/package/Makefile.in b/package/Makefile.in
  84. index 285e2837ef..3c665f711d 100644
  85. --- a/package/Makefile.in
  86. +++ b/package/Makefile.in
  87. @@ -230,6 +230,9 @@ HOST_CFLAGS   += $(HOST_CPPFLAGS)
  88.  HOST_CXXFLAGS += $(HOST_CFLAGS)
  89.  HOST_LDFLAGS  += -L$(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib
  90.  
  91. +# Location of scripts/wrappers for cross-compilation
  92. +HOST_BIN_CROSS = $(HOST_DIR)/$(GNU_TARGET_NAME)/cross-bin
  93. +
  94.  # host-intltool should be executed with the system perl, so we save
  95.  # the path to the system perl, before a host-perl built by Buildroot
  96.  # might get installed into $(HOST_DIR)/bin and therefore appears
  97. diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
  98. index 46d745a897..01f7e14460 100644
  99. --- a/package/gdb/gdb.mk
  100. +++ b/package/gdb/gdb.mk
  101. @@ -35,7 +35,9 @@ endif
  102.  # For the host variant, we really want to build with XML support,
  103.  # which is needed to read XML descriptions of target architectures. We
  104.  # also need ncurses.
  105. -HOST_GDB_DEPENDENCIES = host-expat host-ncurses
  106. +# As for libiberty, gdb may use a system-installed one if present, so
  107. +# we must ensure ours is installed first.
  108. +HOST_GDB_DEPENDENCIES = host-expat host-libiberty host-ncurses
  109.  
  110.  # Disable building documentation
  111.  GDB_MAKE_OPTS += MAKEINFO=true
  112. diff --git a/package/gobject-introspection/0001-Revert-an-incomplete-upstream-attempt-at-cross-compi.patch b/package/gobject-introspection/0001-Revert-an-incomplete-upstream-attempt-at-cross-compi.patch
  113. new file mode 100644
  114. index 0000000000..1e8bd3518a
  115. --- /dev/null
  116. +++ b/package/gobject-introspection/0001-Revert-an-incomplete-upstream-attempt-at-cross-compi.patch
  117. @@ -0,0 +1,33 @@
  118. +From 3a9d1e5ee0aae56fafec0beba2014c19e4ff310c Mon Sep 17 00:00:00 2001
  119. +From: Alexander Kanavin <alex.kanavin@gmail.com>
  120. +Date: Wed, 23 Mar 2016 17:07:28 +0200
  121. +Subject: [PATCH] Revert an incomplete upstream attempt at cross-compile support
  122. +
  123. +Upstream-Status: Pending
  124. +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
  125. +Signed-off-by: Adam Duskett <aduskett@gmail.com>
  126. +---
  127. + common.mk                | 4 ----
  128. + giscanner/gdumpparser.py | 6 ------
  129. + 2 files changed, 10 deletions(-)
  130. +
  131. +diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py
  132. +index 1134f33..9bdc2bc 100644
  133. +--- a/giscanner/gdumpparser.py
  134. ++++ b/giscanner/gdumpparser.py
  135. +@@ -156,12 +156,6 @@ blob containing data gleaned from GObject's primitive introspection."""
  136. +         out_path = os.path.join(self._binary.tmpdir, 'dump.xml')
  137. +
  138. +         args = []
  139. +-
  140. +-        # Prepend the launcher command and arguments, if defined
  141. +-        launcher = os.environ.get('GI_CROSS_LAUNCHER')
  142. +-        if launcher:
  143. +-            args.extend(launcher.split())
  144. +-
  145. +         args.extend(self._binary.args)
  146. +         args.append('--introspect-dump=%s,%s' % (in_path, out_path))
  147. +
  148. +--
  149. +2.7.0
  150. +
  151. diff --git a/package/gobject-introspection/0002-add-cross-compilation-support-to-meson.patch b/package/gobject-introspection/0002-add-cross-compilation-support-to-meson.patch
  152. new file mode 100644
  153. index 0000000000..5e3ac59dd9
  154. --- /dev/null
  155. +++ b/package/gobject-introspection/0002-add-cross-compilation-support-to-meson.patch
  156. @@ -0,0 +1,163 @@
  157. +From 2b3bce1526b538dc2c7fa223eaf9808858aa1b06 Mon Sep 17 00:00:00 2001
  158. +From: Alexander Kanavin <alex.kanavin@gmail.com>
  159. +Date: Thu, 15 Nov 2018 15:10:05 +0100
  160. +Subject: [PATCH] add cross-compilation support to meson
  161. +
  162. +Upstream-Status: Pending
  163. +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
  164. +Signed-off-by: Adam Duskett <aduskett@gmail.com>
  165. +---
  166. + gir/meson.build   | 62 ++++++++++++++++++++++++++++++++++-------------
  167. + meson.build       |  4 ++-
  168. + meson_options.txt | 20 +++++++++++++++
  169. + 3 files changed, 68 insertions(+), 18 deletions(-)
  170. +
  171. +diff --git a/gir/meson.build b/gir/meson.build
  172. +index 85ae575..327c134 100644
  173. +--- a/gir/meson.build
  174. ++++ b/gir/meson.build
  175. +@@ -36,16 +36,29 @@ gir_files = [
  176. + typelibdir = join_paths(get_option('libdir'), 'girepository-1.0')
  177. + install_data(gir_files, install_dir: girdir)
  178. +
  179. +-scanner_command = [
  180. +-  python,
  181. +-  girscanner,
  182. +-  '--output=@OUTPUT@',
  183. +-  '--no-libtool',
  184. +-  '--quiet',
  185. +-  '--reparse-validate',
  186. +-  '--add-include-path', join_paths(meson.current_build_dir()),
  187. +-  '--add-include-path', join_paths(meson.current_source_dir()),
  188. +-]
  189. ++if get_option('enable-host-gi')
  190. ++    scanner_command = [
  191. ++      'g-ir-scanner',
  192. ++      '--output=@OUTPUT@',
  193. ++      '--no-libtool',
  194. ++      '--quiet',
  195. ++      '--reparse-validate',
  196. ++      '--add-include-path', join_paths(meson.current_build_dir()),
  197. ++      '--add-include-path', join_paths(meson.current_source_dir()),
  198. ++    ]
  199. ++else
  200. ++    scanner_command = [
  201. ++      python,
  202. ++      girscanner,
  203. ++      '--output=@OUTPUT@',
  204. ++      '--no-libtool',
  205. ++      '--quiet',
  206. ++      '--reparse-validate',
  207. ++      '--add-include-path', join_paths(meson.current_build_dir()),
  208. ++      '--add-include-path', join_paths(meson.current_source_dir()),
  209. ++    ]
  210. ++endif
  211. ++
  212. +
  213. + dep_type = glib_dep.type_name()
  214. + if dep_type == 'internal'
  215. +@@ -58,6 +71,12 @@ if dep_type == 'internal'
  216. +                       '--extra-library=glib-2.0', '--extra-library=gobject-2.0']
  217. + endif
  218. +
  219. ++if get_option('enable-gi-cross-wrapper') != ''
  220. ++  scanner_command += ['--use-binary-wrapper=' + get_option('enable-gi-cross-wrapper')]
  221. ++endif
  222. ++if get_option('enable-gi-ldd-wrapper') != ''
  223. ++  scanner_command += ['--use-ldd-wrapper=' + get_option('enable-gi-ldd-wrapper')]
  224. ++endif
  225. + # Take a glob and print to newlines
  226. + globber = '''
  227. + from glob import glob
  228. +@@ -84,8 +103,8 @@ glib_command = scanner_command + [
  229. +
  230. + if dep_type == 'pkgconfig'
  231. +   glib_command += ['--external-library', '--pkg=glib-2.0']
  232. +-  glib_libdir = glib_dep.get_pkgconfig_variable('libdir')
  233. +-  glib_incdir = join_paths(glib_dep.get_pkgconfig_variable('includedir'), 'glib-2.0')
  234. ++  glib_libdir = get_option('pkgconfig-sysroot-path') + glib_dep.get_pkgconfig_variable('libdir')
  235. ++  glib_incdir = get_option('pkgconfig-sysroot-path') + join_paths(glib_dep.get_pkgconfig_variable('includedir'), 'glib-2.0')
  236. +   glib_libincdir = join_paths(glib_libdir, 'glib-2.0', 'include')
  237. +   glib_files += join_paths(glib_incdir, 'gobject', 'glib-types.h')
  238. +   glib_files += join_paths(glib_libincdir, 'glibconfig.h')
  239. +@@ -339,7 +358,7 @@ endforeach
  240. + if giounix_dep.found()
  241. +   if dep_type == 'pkgconfig'
  242. +     gio_command += ['--pkg=gio-unix-2.0']
  243. +-    giounix_includedir = join_paths(giounix_dep.get_pkgconfig_variable('includedir'), 'gio-unix-2.0')
  244. ++    giounix_includedir = get_option('pkgconfig-sysroot-path') + join_paths(giounix_dep.get_pkgconfig_variable('includedir'), 'gio-unix-2.0')
  245. +     # Get the installed gio-unix header list
  246. +     ret = run_command(python, '-c', globber.format(join_paths(giounix_includedir, 'gio', '*.h')))
  247. +     if ret.returncode() != 0
  248. +@@ -422,15 +441,24 @@ gir_files += custom_target('gir-girepository',
  249. + )
  250. +
  251. + typelibs = []
  252. ++if get_option('enable-gi-cross-wrapper') != ''
  253. ++    gircompiler_command = [get_option('enable-gi-cross-wrapper'), gircompiler.full_path(), '-o', '@OUTPUT@', '@INPUT@',
  254. ++              '--includedir', meson.current_build_dir(),
  255. ++              '--includedir', meson.current_source_dir(),
  256. ++    ]
  257. ++else
  258. ++    gircompiler_command = [gircompiler, '-o', '@OUTPUT@', '@INPUT@',
  259. ++              '--includedir', meson.current_build_dir(),
  260. ++              '--includedir', meson.current_source_dir(),
  261. ++    ]
  262. ++endif
  263. ++
  264. + foreach gir : gir_files
  265. +   typelibs += custom_target('generate-typelib-@0@'.format(gir).underscorify(),
  266. +     input: gir,
  267. +     output: '@BASENAME@.typelib',
  268. +     depends: [gobject_gir, ],
  269. +-    command: [gircompiler, '-o', '@OUTPUT@', '@INPUT@',
  270. +-              '--includedir', meson.current_build_dir(),
  271. +-              '--includedir', meson.current_source_dir(),
  272. +-    ],
  273. ++    command: gircompiler_command,
  274. +     install: true,
  275. +     install_dir: typelibdir,
  276. +   )
  277. +diff --git a/meson.build b/meson.build
  278. +index 95bbd2b..f7baefd 100644
  279. +--- a/meson.build
  280. ++++ b/meson.build
  281. +@@ -163,7 +163,9 @@ endif
  282. + subdir('girepository')
  283. + subdir('tools')
  284. + subdir('giscanner')
  285. +-subdir('gir')
  286. ++if get_option('enable-introspection-data') == true
  287. ++    subdir('gir')
  288. ++endif
  289. + subdir('examples')
  290. + subdir('docs')
  291. + subdir('tests')
  292. +diff --git a/meson_options.txt b/meson_options.txt
  293. +index 445a68a..a325511 100644
  294. +--- a/meson_options.txt
  295. ++++ b/meson_options.txt
  296. +@@ -25,3 +25,23 @@ option('python', type: 'string', value: 'python3',
  297. + option('gir_dir_prefix', type: 'string',
  298. +   description: 'Intermediate prefix for gir installation under ${prefix}'
  299. + )
  300. ++
  301. ++option('enable-host-gi', type: 'boolean', value : false,
  302. ++  description: 'Use gobject introspection tools installed in the host system (useful when cross-compiling)'
  303. ++)
  304. ++
  305. ++option('enable-gi-cross-wrapper', type: 'string',
  306. ++  description: 'Use a wrapper to run gicompiler and binaries produced by giscanner (useful when cross-compiling)'
  307. ++)
  308. ++
  309. ++option('enable-gi-ldd-wrapper', type: 'string',
  310. ++  description: 'Use a ldd wrapper instead of system ldd command in giscanner (useful when cross-compiling)'
  311. ++)
  312. ++
  313. ++option('enable-introspection-data', type: 'boolean', value : true,
  314. ++  description: 'Build introspection data (.gir and .typelib files) in addition to library and tools'
  315. ++)
  316. ++
  317. ++option('pkgconfig-sysroot-path', type: 'string',
  318. ++  description: 'Specify a sysroot path to prepend to pkgconfig output (useful when cross-compiling)'
  319. ++)
  320. diff --git a/package/gobject-introspection/0003-disable-tests.patch b/package/gobject-introspection/0003-disable-tests.patch
  321. new file mode 100644
  322. index 0000000000..fcc5a794f3
  323. --- /dev/null
  324. +++ b/package/gobject-introspection/0003-disable-tests.patch
  325. @@ -0,0 +1,29 @@
  326. +From 473b4288d8f4e891d0d21f7b60ef8053c5cd7af9 Mon Sep 17 00:00:00 2001
  327. +From: Adam Duskett <aduskett@gmail.com>
  328. +Date: Mon, 3 Feb 2020 10:07:15 -0800
  329. +Subject: [PATCH] disable tests
  330. +
  331. +If introspection data on the host is not built, meson throws the error:
  332. +"Unknown variable "typelibs". Because tests are not required, removing
  333. +the subdir tests alltogether fixes this issue.
  334. +
  335. +Signed-off-by: Adam Duskett <aduskett@gmail.com>
  336. +---
  337. + meson.build | 1 -
  338. + 1 file changed, 1 deletion(-)
  339. +
  340. +diff --git a/meson.build b/meson.build
  341. +index a5e825f..981e936 100644
  342. +--- a/meson.build
  343. ++++ b/meson.build
  344. +@@ -171,7 +171,6 @@ subdir('giscanner')
  345. + subdir('gir')
  346. + subdir('examples')
  347. + subdir('docs')
  348. +-subdir('tests')
  349. +
  350. + install_data('Makefile.introspection', install_dir: join_paths(get_option('datadir'), 'gobject-introspection-1.0'))
  351. + install_data('m4/introspection.m4', install_dir: join_paths(get_option('datadir'), 'aclocal'))
  352. +--
  353. +2.24.1
  354. +
  355. diff --git a/package/gobject-introspection/0004-giscanner-add-use-binary-wrapper-option.patch b/package/gobject-introspection/0004-giscanner-add-use-binary-wrapper-option.patch
  356. new file mode 100644
  357. index 0000000000..cffc2d954d
  358. --- /dev/null
  359. +++ b/package/gobject-introspection/0004-giscanner-add-use-binary-wrapper-option.patch
  360. @@ -0,0 +1,52 @@
  361. +From 704b888d0abfb01067352c40156f49f655691c7c Mon Sep 17 00:00:00 2001
  362. +From: Alexander Kanavin <alex.kanavin@gmail.com>
  363. +Date: Mon, 19 Oct 2015 18:26:40 +0300
  364. +Subject: [PATCH] giscanner: add --use-binary-wrapper option
  365. +
  366. +With this option, giscanner will use a wrapper executable to run
  367. +binaries it's producing, instead of running them directly. This
  368. +is useful when binaries are cross-compiled and cannot be run directly,
  369. +but they can be run using for example QEMU emulation.
  370. +
  371. +Upstream-Status: Pending [review on oe-core list]
  372. +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
  373. +Signed-off-by: Adam Duskett <aduskett@gmail.com>
  374. +---
  375. + giscanner/scannermain.py | 14 ++++++++++++++
  376. + 1 file changed, 14 insertions(+)
  377. +
  378. +diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
  379. +index 633496f..d684cd0 100755
  380. +--- a/giscanner/scannermain.py
  381. ++++ b/giscanner/scannermain.py
  382. +@@ -120,6 +120,9 @@ def _get_option_parser():
  383. +     parser.add_option("", "--program",
  384. +                       action="store", dest="program", default=None,
  385. +                       help="program to execute")
  386. ++    parser.add_option("", "--use-binary-wrapper",
  387. ++                      action="store", dest="wrapper", default=None,
  388. ++                      help="wrapper to use for running programs (useful when cross-compiling)")
  389. +     parser.add_option("", "--program-arg",
  390. +                       action="append", dest="program_args", default=[],
  391. +                       help="extra arguments to program")
  392. +@@ -417,6 +420,17 @@ def create_binary(transformer, options, args):
  393. +                                               gdump_parser.get_error_quark_functions())
  394. +
  395. +     shlibs = resolve_shlibs(options, binary, options.libraries)
  396. ++    if options.wrapper:
  397. ++        # The wrapper needs the binary itself, not the libtool wrapper script,
  398. ++        # so we check if libtool has sneaked the binary into .libs subdirectory
  399. ++        # and adjust the path accordingly
  400. ++        import os.path
  401. ++        dir_name, binary_name  = os.path.split(binary.args[0])
  402. ++        libtool_binary = os.path.join(dir_name, '.libs', binary_name)
  403. ++        if os.path.exists(libtool_binary):
  404. ++            binary.args[0] = libtool_binary
  405. ++      # Then prepend the wrapper to the command line to execute
  406. ++        binary.args = [options.wrapper] + binary.args
  407. +     gdump_parser.set_introspection_binary(binary)
  408. +     gdump_parser.parse()
  409. +     return shlibs
  410. +--
  411. +2.7.0
  412. +
  413. diff --git a/package/gobject-introspection/0005-giscanner-add-a-use-ldd-wrapper-option.patch b/package/gobject-introspection/0005-giscanner-add-a-use-ldd-wrapper-option.patch
  414. new file mode 100644
  415. index 0000000000..386c1c34b0
  416. --- /dev/null
  417. +++ b/package/gobject-introspection/0005-giscanner-add-a-use-ldd-wrapper-option.patch
  418. @@ -0,0 +1,48 @@
  419. +From d4ad57fd4a32c4f0d2f0522a3090ef940746431b Mon Sep 17 00:00:00 2001
  420. +From: Alexander Kanavin <alex.kanavin@gmail.com>
  421. +Date: Fri, 30 Oct 2015 16:28:46 +0200
  422. +Subject: [PATCH] giscanner: add a --use-ldd-wrapper option
  423. +
  424. +This is useful in cross-compile environments where system's ldd
  425. +command does not work on binaries built for a different architecture
  426. +
  427. +Upstream-Status: Pending [review in oe-core]
  428. +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
  429. +Signed-off-by: Adam Duskett <aduskett@gmail.com>
  430. +---
  431. + giscanner/scannermain.py | 3 +++
  432. + giscanner/shlibs.py      | 4 +++-
  433. + 2 files changed, 6 insertions(+), 1 deletion(-)
  434. +
  435. +diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
  436. +index d684cd0..1b3b369 100755
  437. +--- a/giscanner/scannermain.py
  438. ++++ b/giscanner/scannermain.py
  439. +@@ -123,6 +123,9 @@ def _get_option_parser():
  440. +     parser.add_option("", "--use-binary-wrapper",
  441. +                       action="store", dest="wrapper", default=None,
  442. +                       help="wrapper to use for running programs (useful when cross-compiling)")
  443. ++    parser.add_option("", "--use-ldd-wrapper",
  444. ++                      action="store", dest="ldd_wrapper", default=None,
  445. ++                      help="wrapper to use instead of ldd (useful when cross-compiling)")
  446. +     parser.add_option("", "--program-arg",
  447. +                       action="append", dest="program_args", default=[],
  448. +                       help="extra arguments to program")
  449. +diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
  450. +index c93d20c..c5b5942 100644
  451. +--- a/giscanner/shlibs.py
  452. ++++ b/giscanner/shlibs.py
  453. +@@ -97,7 +97,9 @@ def _resolve_non_libtool(options, binary, libraries):
  454. +             args.extend(libtool)
  455. +             args.append('--mode=execute')
  456. +         platform_system = platform.system()
  457. +-        if platform_system == 'Darwin':
  458. ++        if options.ldd_wrapper:
  459. ++            args.extend([options.ldd_wrapper, binary.args[0]])
  460. ++        elif platform_system == 'Darwin':
  461. +             args.extend(['otool', '-L', binary.args[0]])
  462. +         else:
  463. +             args.extend(['ldd', binary.args[0]])
  464. +--
  465. +2.7.0
  466. +
  467. diff --git a/package/gobject-introspection/0006-giscanner-add-a-lib-dirs-envvar-option.patch b/package/gobject-introspection/0006-giscanner-add-a-lib-dirs-envvar-option.patch
  468. new file mode 100644
  469. index 0000000000..06f5635610
  470. --- /dev/null
  471. +++ b/package/gobject-introspection/0006-giscanner-add-a-lib-dirs-envvar-option.patch
  472. @@ -0,0 +1,73 @@
  473. +From 3a9b3d8179b7eb9d2cc93da31578945bc03a45c3 Mon Sep 17 00:00:00 2001
  474. +From: Alexander Kanavin <alex.kanavin@gmail.com>
  475. +Date: Fri, 27 Apr 2018 12:56:15 -0400
  476. +Subject: [PATCH] giscanner: add a --lib-dirs-envvar option
  477. +
  478. +By default LD_LIBRARY_PATH is set to the list of target library paths;
  479. +this breaks down in cross-compilation environment, as we need to run a
  480. +native emulation wrapper rather than the target binary itself. This patch
  481. +allows exporting those paths to a different environment variable
  482. +which can be picked up and used by the wrapper.
  483. +
  484. +Upstream-Status: Pending
  485. +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
  486. +Signed-off-by: Adam Duskett <aduskett@gmail.com>
  487. +---
  488. + giscanner/ccompiler.py   | 4 ++--
  489. + giscanner/dumper.py      | 3 ++-
  490. + giscanner/scannermain.py | 3 +++
  491. + 3 files changed, 7 insertions(+), 3 deletions(-)
  492. +
  493. +diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
  494. +index d10327c..6cf25d5 100644
  495. +--- a/giscanner/ccompiler.py
  496. ++++ b/giscanner/ccompiler.py
  497. +@@ -174,7 +174,7 @@ class CCompiler(object):
  498. +
  499. +             self._cflags_no_deprecation_warnings = "-Wno-deprecated-declarations"
  500. +
  501. +-    def get_internal_link_flags(self, args, libtool, libraries, extra_libraries, libpaths):
  502. ++    def get_internal_link_flags(self, args, libtool, libraries, extra_libraries, libpaths, lib_dirs_envvar):
  503. +         # An "internal" link is where the library to be introspected
  504. +         # is being built in the current directory.
  505. +
  506. +@@ -184,7 +184,7 @@ class CCompiler(object):
  507. +         if os.name == 'nt':
  508. +             runtime_path_envvar = ['LIB', 'PATH']
  509. +         else:
  510. +-            runtime_path_envvar = ['LD_LIBRARY_PATH', 'DYLD_FALLBACK_LIBRARY_PATH']
  511. ++            runtime_path_envvar = ['LD_LIBRARY_PATH', 'DYLD_FALLBACK_LIBRARY_PATH'] if not lib_dirs_envvar else [lib_dirs_envvar]
  512. +             # Search the current directory first
  513. +             # (This flag is not supported nor needed for Visual C++)
  514. +             args.append('-L.')
  515. +diff --git a/giscanner/dumper.py b/giscanner/dumper.py
  516. +index 3c7220b..0abd565 100644
  517. +--- a/giscanner/dumper.py
  518. ++++ b/giscanner/dumper.py
  519. +@@ -244,7 +244,8 @@ class DumpCompiler(object):
  520. +                                                    libtool,
  521. +                                                    self._options.libraries,
  522. +                                                    self._options.extra_libraries,
  523. +-                                                   self._options.library_paths)
  524. ++                                                   self._options.library_paths,
  525. ++                                                   self._options.lib_dirs_envvar)
  526. +             args.extend(pkg_config_libs)
  527. +
  528. +         else:
  529. +diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
  530. +index d262785..51c9570 100755
  531. +--- a/giscanner/scannermain.py
  532. ++++ b/giscanner/scannermain.py
  533. +@@ -126,6 +126,9 @@ def _get_option_parser():
  534. +     parser.add_option("", "--use-ldd-wrapper",
  535. +                       action="store", dest="ldd_wrapper", default=None,
  536. +                       help="wrapper to use instead of ldd (useful when cross-compiling)")
  537. ++    parser.add_option("", "--lib-dirs-envvar",
  538. ++                      action="store", dest="lib_dirs_envvar", default=None,
  539. ++                      help="environment variable to write a list of library directories to (for running the transient binary), instead of standard LD_LIBRARY_PATH")
  540. +     parser.add_option("", "--program-arg",
  541. +                       action="append", dest="program_args", default=[],
  542. +                       help="extra arguments to program")
  543. +--
  544. +2.14.3
  545. +
  546. diff --git a/package/gobject-introspection/0007-Add-rpath-links-to-ccompiler.patch b/package/gobject-introspection/0007-Add-rpath-links-to-ccompiler.patch
  547. new file mode 100644
  548. index 0000000000..08835d3ecc
  549. --- /dev/null
  550. +++ b/package/gobject-introspection/0007-Add-rpath-links-to-ccompiler.patch
  551. @@ -0,0 +1,29 @@
  552. +From 72a427bc50daee8f1ded0e9221e53dbbf2a80f08 Mon Sep 17 00:00:00 2001
  553. +From: Adam Duskett <aduskett@gmail.com>
  554. +Date: Wed, 14 Mar 2018 12:07:10 -0400
  555. +Subject: [PATCH] Add rpath links to ccompiler
  556. +
  557. +This patch allows gobject-introspection to process extra paths passed to the
  558. +compiler via the GIR_EXTRA_LIBS_PATH variable.
  559. +
  560. +Signed-off-by: Adam Duskett <aduskett@gmail.com>
  561. +---
  562. + giscanner/ccompiler.py | 2 ++
  563. + 1 file changed, 2 insertions(+)
  564. +
  565. +diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py
  566. +index a8bd5b1..51bb9bc 100644
  567. +--- a/giscanner/ccompiler.py
  568. ++++ b/giscanner/ccompiler.py
  569. +@@ -229,6 +229,8 @@ class CCompiler(object):
  570. +
  571. +         for envvar in runtime_path_envvar:
  572. +             if envvar in os.environ:
  573. ++                for envvar_path in os.environ[envvar].split(':'):
  574. ++                    args.append("-Wl,-rpath-link," + envvar_path)
  575. +                 os.environ[envvar] = \
  576. +                     os.pathsep.join(runtime_paths + [os.environ[envvar]])
  577. +             else:
  578. +--
  579. +2.14.3
  580. +
  581. diff --git a/package/gobject-introspection/0008-ignore-error-return-codes-from-ldd-wrapper.patch b/package/gobject-introspection/0008-ignore-error-return-codes-from-ldd-wrapper.patch
  582. new file mode 100644
  583. index 0000000000..568758d332
  584. --- /dev/null
  585. +++ b/package/gobject-introspection/0008-ignore-error-return-codes-from-ldd-wrapper.patch
  586. @@ -0,0 +1,28 @@
  587. +From f742da8b3913f4818d3f419117076afe62f4dbf4 Mon Sep 17 00:00:00 2001
  588. +From: Alexander Kanavin <alex.kanavin@gmail.com>
  589. +Date: Wed, 5 Sep 2018 16:46:52 +0200
  590. +Subject: [PATCH] giscanner: ignore error return codes from ldd-wrapper
  591. +
  592. +prelink-rtld, which we use instead of ldd returns 127 when it can't find a library.
  593. +It is not an error per se, but it breaks subprocess.check_output().
  594. +
  595. +Upstream-Status: Inappropriate [oe-core specific]
  596. +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
  597. +Signed-off-by: Adam Duskett <aduskett@gmail.com>
  598. +---
  599. + giscanner/shlibs.py | 2 +-
  600. + 1 file changed, 1 insertion(+), 1 deletion(-)
  601. +
  602. +diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
  603. +index d67df95..80352a6 100644
  604. +--- a/giscanner/shlibs.py
  605. ++++ b/giscanner/shlibs.py
  606. +@@ -102,7 +102,7 @@ def _resolve_non_libtool(options, binary, libraries):
  607. +             args.extend(['otool', '-L', binary.args[0]])
  608. +         else:
  609. +             args.extend(['ldd', binary.args[0]])
  610. +-        output = subprocess.check_output(args)
  611. ++        output = subprocess.run(args, check=False, stdout=subprocess.PIPE).stdout
  612. +         if isinstance(output, bytes):
  613. +             output = output.decode("utf-8", "replace")
  614. +
  615. diff --git a/package/gobject-introspection/Config.in b/package/gobject-introspection/Config.in
  616. new file mode 100644
  617. index 0000000000..f33d803f81
  618. --- /dev/null
  619. +++ b/package/gobject-introspection/Config.in
  620. @@ -0,0 +1,33 @@
  621. +config BR2_PACKAGE_GOBJECT_INTROSPECTION
  622. +   bool "gobject-introspection"
  623. +   # While gcc 4.8 might be compatible with gobject-introspection,
  624. +   # The autobuilders use some toolchains from codesourcery which
  625. +   # have gcc 4.8 and a very old version of glibc, which will cause
  626. +   # compile errors with locale.c. As such, require 4.9 until this
  627. +   # can be verified.
  628. +   depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
  629. +   depends on BR2_USE_MMU # python3, libglib2
  630. +   depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
  631. +   depends on BR2_TOOLCHAIN_USES_GLIBC
  632. +   select BR2_PACKAGE_HOST_PRELINK_CROSS
  633. +   select BR2_PACKAGE_HOST_QEMU
  634. +   select BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE
  635. +   select BR2_PACKAGE_LIBFFI
  636. +   select BR2_PACKAGE_LIBGLIB2
  637. +   select BR2_PACKAGE_PYTHON3 if !BR2_PACKAGE_PYTHON
  638. +   select BR2_PACKAGE_ZLIB
  639. +   help
  640. +     GObject introspection is a middleware layer between C
  641. +     libraries (using GObject) and language bindings. The C library
  642. +     can be scanned at compile time and generate a metadata file,
  643. +     in addition to the actual native C library. Then at runtime,
  644. +     language bindings can read this metadata and automatically
  645. +     provide bindings to call into the C library.
  646. +
  647. +     https://wiki.gnome.org/action/show/Projects/GObjectIntrospection
  648. +
  649. +comment "gobject-introspection needs a glibc toolchain, gcc >= 4.9"
  650. +   depends on BR2_USE_MMU
  651. +   depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
  652. +   depends on !BR2_TOOLCHAIN_USES_GLIBC || \
  653. +       !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
  654. diff --git a/package/gobject-introspection/g-ir-compiler.in b/package/gobject-introspection/g-ir-compiler.in
  655. new file mode 100644
  656. index 0000000000..02d7c15c38
  657. --- /dev/null
  658. +++ b/package/gobject-introspection/g-ir-compiler.in
  659. @@ -0,0 +1,3 @@
  660. +#!/usr/bin/env bash
  661. +
  662. +$(dirname $0)/g-ir-scanner-qemuwrapper $(dirname $0)/g-ir-compiler.real "$@"
  663. \ No newline at end of file
  664. diff --git a/package/gobject-introspection/g-ir-scanner-lddwrapper.in b/package/gobject-introspection/g-ir-scanner-lddwrapper.in
  665. new file mode 100644
  666. index 0000000000..d7639c5c81
  667. --- /dev/null
  668. +++ b/package/gobject-introspection/g-ir-scanner-lddwrapper.in
  669. @@ -0,0 +1,3 @@
  670. +#!/usr/bin/env bash
  671. +
  672. +${HOST_DIR}/sbin/prelink-rtld --root=$(dirname $0)/../../ "$@"
  673. \ No newline at end of file
  674. diff --git a/package/gobject-introspection/g-ir-scanner-qemuwrapper.in b/package/gobject-introspection/g-ir-scanner-qemuwrapper.in
  675. new file mode 100644
  676. index 0000000000..6e433eb300
  677. --- /dev/null
  678. +++ b/package/gobject-introspection/g-ir-scanner-qemuwrapper.in
  679. @@ -0,0 +1,17 @@
  680. +#!/usr/bin/env bash
  681. +
  682. +# Pass -r to qemu-user as to trick glibc into not errorings out if the host kernel
  683. +# is older than the target kernel.
  684. +# Use a modules directory which does not exist so we don't load random things
  685. +# which may then get deleted (or their dependencies) and potentially segfault
  686. +GIO_MODULE_DIR=$(dirname $0)/../lib/gio/modules-dummy \
  687. +@QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \
  688. +-L $(dirname $0)/../../ \
  689. +-E LD_LIBRARY_PATH=${GIR_EXTRA_LIBS_PATH}:.libs:$(dirname $0)/../lib:$(dirname $0)/../../lib \
  690. +"$@"
  691. +
  692. +if [[ $? -ne 0 ]]; then
  693. +    echo "If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help."
  694. +    echo 'Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"'
  695. +    exit 1
  696. +fi
  697. \ No newline at end of file
  698. diff --git a/package/gobject-introspection/g-ir-scanner.in b/package/gobject-introspection/g-ir-scanner.in
  699. new file mode 100644
  700. index 0000000000..9f97497b7e
  701. --- /dev/null
  702. +++ b/package/gobject-introspection/g-ir-scanner.in
  703. @@ -0,0 +1,8 @@
  704. +#!/usr/bin/env bash
  705. +
  706. +export GI_SCANNER_DISABLE_CACHE=1
  707. +${HOST_DIR}/bin/g-ir-scanner \
  708. +--lib-dirs-envvar=GIR_EXTRA_LIBS_PATH \
  709. +--use-binary-wrapper=$(dirname $0)/g-ir-scanner-qemuwrapper \
  710. +--use-ldd-wrapper=$(dirname $0)/g-ir-scanner-lddwrapper \
  711. +--add-include-path=$(dirname $0)/../share/gir-1.0 "$@"
  712. diff --git a/package/gobject-introspection/gobject-introspection.hash b/package/gobject-introspection/gobject-introspection.hash
  713. new file mode 100644
  714. index 0000000000..0454c59565
  715. --- /dev/null
  716. +++ b/package/gobject-introspection/gobject-introspection.hash
  717. @@ -0,0 +1,4 @@
  718. +#From http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/1.62/gobject-introspection-1.62.0.sha256sum
  719. +sha256 b1ee7ed257fdbc008702bdff0ff3e78a660e7e602efa8f211dc89b9d1e7d90a2 gobject-introspection-1.62.0.tar.xz
  720. +sha256 d245807f90032872d1438d741ed21e2490e1175dc8aa3afa5ddb6c8e529b58e5 COPYING.LGPL
  721. +sha256 32b1062f7da84967e7019d01ab805935caa7ab7321a7ced0e30ebe75e5df1670 COPYING.GPL
  722. diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk
  723. new file mode 100644
  724. index 0000000000..67e5e37dee
  725. --- /dev/null
  726. +++ b/package/gobject-introspection/gobject-introspection.mk
  727. @@ -0,0 +1,133 @@
  728. +################################################################################
  729. +#
  730. +# gobject-introspection
  731. +#
  732. +################################################################################
  733. +
  734. +GOBJECT_INTROSPECTION_VERSION_MAJOR = 1.62
  735. +GOBJECT_INTROSPECTION_VERSION = $(GOBJECT_INTROSPECTION_VERSION_MAJOR).0
  736. +GOBJECT_INTROSPECTION_SITE = http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/$(GOBJECT_INTROSPECTION_VERSION_MAJOR)
  737. +GOBJECT_INTROSPECTION_SOURCE = gobject-introspection-$(GOBJECT_INTROSPECTION_VERSION).tar.xz
  738. +GOBJECT_INTROSPECTION_INSTALL_STAGING = YES
  739. +GOBJECT_INTROSPECTION_AUTORECONF = YES
  740. +GOBJECT_INTROSPECTION_LICENSE = LGPL-2.0+, GPL-2.0+, BSD-2-Clause
  741. +GOBJECT_INTROSPECTION_LICENSE_FILES = COPYING.LGPL COPYING.GPL giscanner/scannerlexer.l
  742. +
  743. +GOBJECT_INTROSPECTION_DEPENDENCIES = \
  744. +   host-autoconf-archive \
  745. +   host-gobject-introspection \
  746. +   host-prelink-cross \
  747. +   host-qemu \
  748. +   libffi \
  749. +   libglib2 \
  750. +   python3 \
  751. +   zlib
  752. +
  753. +HOST_GOBJECT_INTROSPECTION_DEPENDENCIES = \
  754. +   host-bison \
  755. +   host-flex \
  756. +   host-libglib2 \
  757. +   host-python3
  758. +
  759. +# g-ir-scanner will default to /usr/bin/ld for linking if this is not set.
  760. +GOBJECT_INTROSPECTION_NINJA_ENV += \
  761. +   CC="$(TARGET_CC)"
  762. +
  763. +# Disable introspection data on the host, as it is not needed and
  764. +# the package will attempt to use the systems libglib2 which will fail
  765. +# if the systems libglib2 version is older than 2.60.
  766. +HOST_GOBJECT_INTROSPECTION_CONF_OPTS = \
  767. +   -Denable-introspection-data=false
  768. +
  769. +# Use the host gi-scanner to prevent the scanner from generating incorrect
  770. +# elf classes.
  771. +GOBJECT_INTROSPECTION_CONF_OPTS = \
  772. +   -Denable-host-gi=true \
  773. +   -Denable-gi-cross-wrapper="$(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper" \
  774. +   -Denable-gi-ldd-wrapper="$(STAGING_DIR)/usr/bin/g-ir-scanner-lddwrapper" \
  775. +   -Denable-introspection-data=true
  776. +
  777. +ifeq ($(BR2_PACKAGE_CAIRO),y)
  778. +GOBJECT_INTROSPECTION_DEPENDENCIES += cairo
  779. +GOBJECT_INTROSPECTION_CONF_OPTS += -Dcairo=true
  780. +endif
  781. +
  782. +# GI_SCANNER_DISABLE_CACHE=1 prevents g-ir-scanner from writing cache data to ${HOME}
  783. +GOBJECT_INTROSPECTION_CONF_ENV = \
  784. +   GI_SCANNER_DISABLE_CACHE=1
  785. +
  786. +HOST_GOBJECT_INTROSPECTION_CONF_ENV = \
  787. +   GI_SCANNER_DISABLE_CACHE=1
  788. +
  789. +# Make sure g-ir-tool-template uses the host python.
  790. +define GOBJECT_INTROSPECTION_FIX_TOOLTEMPLATE_PYTHON_PATH
  791. +   $(SED) '1s%#!.*%#!$(HOST_DIR)/bin/python%' $(@D)/tools/g-ir-tool-template.in
  792. +endef
  793. +HOST_GOBJECT_INTROSPECTION_PRE_CONFIGURE_HOOKS += GOBJECT_INTROSPECTION_FIX_TOOLTEMPLATE_PYTHON_PATH
  794. +
  795. +# Perform the following:
  796. +# - Just as above, Ensure that g-ir-tool-template.in uses the host python.
  797. +# - Install all of the wrappers needed to build gobject-introspection.
  798. +# - Create a safe modules directory which does not exist so we don't load random things
  799. +#   which may then get deleted (or their dependencies) and potentially segfault
  800. +define GOBJECT_INTROSPECTION_INSTALL_PRE_WRAPPERS
  801. +   $(SED) '1s%#!.*%#!$(HOST_DIR)/bin/python%' $(@D)/tools/g-ir-tool-template.in
  802. +
  803. +   $(INSTALL) -D -m 755 $(GOBJECT_INTROSPECTION_PKGDIR)/g-ir-scanner-lddwrapper.in \
  804. +       $(STAGING_DIR)/usr/bin/g-ir-scanner-lddwrapper
  805. +
  806. +   $(INSTALL) -D -m 755 $(GOBJECT_INTROSPECTION_PKGDIR)/g-ir-scanner-qemuwrapper.in \
  807. +       $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper
  808. +   $(SED) "s%@QEMU_USER@%$(QEMU_USER)%g" \
  809. +       $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper
  810. +   $(SED) "s%@TOOLCHAIN_HEADERS_VERSION@%$(BR2_TOOLCHAIN_HEADERS_AT_LEAST)%g" \
  811. +       $(STAGING_DIR)/usr/bin/g-ir-scanner-qemuwrapper
  812. +
  813. +   # Use a modules directory which does not exist so we don't load random things
  814. +   # which may then get deleted (or their dependencies) and potentially segfault
  815. +   mkdir -p $(STAGING_DIR)/usr/lib/gio/modules-dummy
  816. +endef
  817. +GOBJECT_INTROSPECTION_PRE_CONFIGURE_HOOKS += GOBJECT_INTROSPECTION_INSTALL_PRE_WRAPPERS
  818. +
  819. +# Move the real compiler and scanner to .real, and replace them with the wrappers.
  820. +# Using .real has the following advantages:
  821. +# - There is no need to change the logic for other packages.
  822. +# - The wrappers call the .real files using qemu.
  823. +define GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
  824. +   # Move the real binaries to their names.real, then replace them with
  825. +   # the wrappers.
  826. +   $(foreach w,g-ir-compiler g-ir-scanner,
  827. +       mv $(STAGING_DIR)/usr/bin/$(w) $(STAGING_DIR)/usr/bin/$(w).real
  828. +       $(INSTALL) -D -m 755 \
  829. +           $(GOBJECT_INTROSPECTION_PKGDIR)/$(w).in $(STAGING_DIR)/usr/bin/$(w)
  830. +   )
  831. +   # Gobject-introspection installs Makefile.introspection in
  832. +   # $(STAGING_DIR)/usr/share which is needed for autotools-based programs to
  833. +   # build .gir and .typelib files. Unfortuantly, gobject-introspection-1.0.pc
  834. +   # uses $(prefix)/share as the directory, which
  835. +   # causes the host /usr/share being used instead of $(STAGING_DIR)/usr/share.
  836. +   # Change datarootdir to $(libdir)/../share which will prefix $(STAGING_DIR)
  837. +   # to the correct location.
  838. +   $(SED) "s%datarootdir=.*%datarootdir=\$${libdir}/../share%g" \
  839. +       $(STAGING_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
  840. +
  841. +   # By default, girdir and typelibdir use datadir and libdir as their prefix,
  842. +   # of which pkg-config appends the sysroot directory. This results in files
  843. +   # being installed in $(STAGING_DIR)/$(STAGING_DIR)/path/to/files.
  844. +   # Changing the prefix to exec_prefix prevents this error.
  845. +   $(SED) "s%girdir=.*%girdir=\$${exec_prefix}/share/gir-1.0%g" \
  846. +       $(STAGING_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
  847. +
  848. +   $(SED) "s%typelibdir=.*%typelibdir=\$${exec_prefix}/lib/girepository-1.0%g" \
  849. +       $(STAGING_DIR)/usr/lib/pkgconfig/gobject-introspection-1.0.pc
  850. +endef
  851. +GOBJECT_INTROSPECTION_POST_INSTALL_STAGING_HOOKS += GOBJECT_INTROSPECTION_INSTALL_WRAPPERS
  852. +
  853. +# Only .typelib files are needed to run.
  854. +define GOBJECT_INTROSPECTION_REMOVE_DEVELOPMENT_FILES
  855. +   find $(TARGET_DIR)/usr/share \( -iname "*.gir" -o -iname \*.rnc \) -delete
  856. +endef
  857. +GOBJECT_INTROSPECTION_TARGET_FINALIZE_HOOKS += GOBJECT_INTROSPECTION_REMOVE_DEVELOPMENT_FILES
  858. +
  859. +$(eval $(meson-package))
  860. +$(eval $(host-meson-package))
  861. diff --git a/package/libiberty/libiberty.hash b/package/libiberty/libiberty.hash
  862. new file mode 100644
  863. index 0000000000..270f38dfa7
  864. --- /dev/null
  865. +++ b/package/libiberty/libiberty.hash
  866. @@ -0,0 +1,2 @@
  867. +# From ftp://gcc.gnu.org/pub/binutils/releases/sha512.sum
  868. +sha512  d326408f12a03d9a61a9de56584c2af12f81c2e50d2d7e835d51565df8314df01575724afa1e43bd0db45cfc9916b41519b67dfce03232aa4978704492a6994a  binutils-2.32.tar.xz
  869. diff --git a/package/libiberty/libiberty.mk b/package/libiberty/libiberty.mk
  870. new file mode 100644
  871. index 0000000000..17976fdd4f
  872. --- /dev/null
  873. +++ b/package/libiberty/libiberty.mk
  874. @@ -0,0 +1,27 @@
  875. +################################################################################
  876. +#
  877. +# libiberty
  878. +#
  879. +################################################################################
  880. +
  881. +LIBIBERTY_VERSION = 2.32
  882. +LIBIBERTY_SOURCE = binutils-$(LIBIBERTY_VERSION).tar.xz
  883. +LIBIBERTY_SITE = $(BR2_GNU_MIRROR)/binutils
  884. +LIBIBERTY_DL_SUBDIR = binutils
  885. +LIBIBERTY_SUBDIR = libiberty
  886. +
  887. +# We explicitly disable multilib, as we do in binutils.
  888. +# By default, libiberty installs nothing, so we must force it.
  889. +HOST_LIBIBERTY_CONF_OPTS = \
  890. +   --disable-multilib \
  891. +   --enable-install-libiberty
  892. +
  893. +# Some packages (e.g. host-gdb) will pick this library and build shared
  894. +# objects with it. But libiberty does not honour the --enable-shared and
  895. +# --disable-static flags; it only ever builds a static library no matter
  896. +# what. So we must force -fPIC in build flags.
  897. +HOST_LIBIBERTY_CONF_ENV = \
  898. +   CFLAGS="$(HOST_CFLAGS) -fPIC" \
  899. +   LDFLAGS="$(HOST_LDFLAGS) -fPIC"
  900. +
  901. +$(eval $(host-autotools-package))
  902. diff --git a/package/meson/0002-mdist.py-import-lzma-only-when-needed.patch b/package/meson/0002-mdist.py-import-lzma-only-when-needed.patch
  903. deleted file mode 100644
  904. index 81758bc1b3..0000000000
  905. --- a/package/meson/0002-mdist.py-import-lzma-only-when-needed.patch
  906. +++ /dev/null
  907. @@ -1,50 +0,0 @@
  908. -From a3443360c8c0014638366d5bb2f5aa7683d5aec2 Mon Sep 17 00:00:00 2001
  909. -From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  910. -Date: Sat, 19 Oct 2019 09:52:06 +0200
  911. -Subject: [PATCH] mdist.py: import lzma only when needed
  912. -
  913. -Importing lzma requires that python was built with lzma support. Buildroot
  914. -builds its own version of python, without lzma support (i.e. without
  915. -dependency on host-xz).
  916. -
  917. -lzma is anyway only needed to make the dist target, which we don't do in
  918. -Buildroot. Therefore, in the Buildroot context, everything still works
  919. -properly without lzma support.
  920. -
  921. -Moving the import down to the place where it is actually needed does not
  922. -remove any functionality but fixes the problem for Buildroot.
  923. -
  924. -Source of patch:
  925. -http://lists.busybox.net/pipermail/buildroot/2019-October/262990.html
  926. -http://code.bulix.org/gdxcu4-914360
  927. -
  928. -Fixes https://github.com/mesonbuild/meson/issues/6012
  929. -
  930. -Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
  931. ----
  932. - mesonbuild/mdist.py | 2 +-
  933. - 1 file changed, 1 insertion(+), 1 deletion(-)
  934. -
  935. -diff --git a/mesonbuild/mdist.py b/mesonbuild/mdist.py
  936. -index 7b753826..28e2fced 100644
  937. ---- a/mesonbuild/mdist.py
  938. -+++ b/mesonbuild/mdist.py
  939. -@@ -13,7 +13,6 @@
  940. - # limitations under the License.
  941. -
  942. -
  943. --import lzma
  944. - import gzip
  945. - import os
  946. - import sys
  947. -@@ -133,6 +132,7 @@ def create_dist_hg(dist_name, archives, src_root, bld_root, dist_sub, dist_scrip
  948. -     if dist_scripts:
  949. -         mlog.warning('dist scripts are not supported in Mercurial projects')
  950. -     if 'xztar' in archives:
  951. -+        import lzma
  952. -         with lzma.open(xzname, 'wb') as xf, open(tarname, 'rb') as tf:
  953. -             shutil.copyfileobj(tf, xf)
  954. -         output_names.append(xzname)
  955. ---
  956. -2.20.1
  957. -
  958. diff --git a/package/meson/0003-envconfig-add-pkg_config_libdir-property.patch b/package/meson/0003-envconfig-add-pkg_config_libdir-property.patch
  959. new file mode 100644
  960. index 0000000000..ae40ab8b1c
  961. --- /dev/null
  962. +++ b/package/meson/0003-envconfig-add-pkg_config_libdir-property.patch
  963. @@ -0,0 +1,102 @@
  964. +From 3af920cb4a9c272b9b75a4f3eea9da9000520949 Mon Sep 17 00:00:00 2001
  965. +From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= <scerveau@collabora.com>
  966. +Date: Tue, 14 Jan 2020 11:11:52 +0100
  967. +Subject: [PATCH] envconfig: add pkg_config_libdir property
  968. +
  969. +In order to unify the use of sysroot in the cross-file,
  970. +the pkg_config_libdir can now be passed directly in the file.
  971. +
  972. +Upstream: 958df63dac810246e84c2b8eaa32d22d19ace0ef
  973. +[Arnout: remove documentation changes: we don't extract docs/]
  974. +Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
  975. +---
  976. + mesonbuild/dependencies/base.py |  6 ++++++
  977. + mesonbuild/envconfig.py         |  6 ++++++
  978. + run_unittests.py                | 30 +++++++++++++++++++++++++++++-
  979. + 3 files changed, 41 insertions(+), 1 deletion(-)
  980. +
  981. +diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
  982. +index 40e304c7..282c314b 100644
  983. +--- a/mesonbuild/dependencies/base.py
  984. ++++ b/mesonbuild/dependencies/base.py
  985. +@@ -697,6 +697,12 @@ class PkgConfigDependency(ExternalDependency):
  986. +         mlog.debug('PKG_CONFIG_PATH: ' + new_pkg_config_path)
  987. +         env['PKG_CONFIG_PATH'] = new_pkg_config_path
  988. +
  989. ++        pkg_config_libdir_prop = self.env.properties[self.for_machine].get_pkg_config_libdir()
  990. ++        if pkg_config_libdir_prop:
  991. ++            new_pkg_config_libdir = ':'.join([p for p in pkg_config_libdir_prop])
  992. ++            env['PKG_CONFIG_LIBDIR'] = new_pkg_config_libdir
  993. ++            mlog.debug('PKG_CONFIG_LIBDIR: ' + new_pkg_config_libdir)
  994. ++
  995. +         fenv = frozenset(env.items())
  996. +         targs = tuple(args)
  997. +         cache = PkgConfigDependency.pkgbin_cache
  998. +diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py
  999. +index c8a37f4c..3e5e44b8 100644
  1000. +--- a/mesonbuild/envconfig.py
  1001. ++++ b/mesonbuild/envconfig.py
  1002. +@@ -143,6 +143,12 @@ class Properties(HasEnvVarFallback):
  1003. +     def get_sys_root(self) -> T.Optional[T.Union[str, T.List[str]]]:
  1004. +         return self.properties.get('sys_root', None)
  1005. +
  1006. ++    def get_pkg_config_libdir(self) -> T.Optional[T.List[str]]:
  1007. ++        p = self.properties.get('pkg_config_libdir', None)
  1008. ++        if p is None:
  1009. ++            return p
  1010. ++        return mesonlib.listify(p)
  1011. ++
  1012. +     def __eq__(self, other: T.Any) -> 'T.Union[bool, NotImplemented]':
  1013. +         if isinstance(other, type(self)):
  1014. +             return self.properties == other.properties
  1015. +diff --git a/run_unittests.py b/run_unittests.py
  1016. +index 676604f4..382c0964 100755
  1017. +--- a/run_unittests.py
  1018. ++++ b/run_unittests.py
  1019. +@@ -3621,6 +3621,34 @@ recommended as it is not supported on some platforms''')
  1020. +         self.wipe()
  1021. +         self.init(testdir, extra_args=['-Dstart_native=true'], override_envvars=env)
  1022. +
  1023. ++    @skipIfNoPkgconfig
  1024. ++    @unittest.skipIf(is_windows(), 'Help needed with fixing this test on windows')
  1025. ++    def test_pkg_config_libdir(self):
  1026. ++        testdir = os.path.join(self.unit_test_dir,
  1027. ++                               '46 native dep pkgconfig var')
  1028. ++        with tempfile.NamedTemporaryFile(mode='w', delete=False) as crossfile:
  1029. ++            crossfile.write(textwrap.dedent(
  1030. ++                '''[binaries]
  1031. ++                pkgconfig = 'pkg-config'
  1032. ++
  1033. ++                [properties]
  1034. ++                pkg_config_libdir = [r'{0}']
  1035. ++
  1036. ++                [host_machine]
  1037. ++                system = 'linux'
  1038. ++                cpu_family = 'arm'
  1039. ++                cpu = 'armv7'
  1040. ++                endian = 'little'
  1041. ++                '''.format(os.path.join(testdir, 'cross_pkgconfig'))))
  1042. ++            crossfile.flush()
  1043. ++            self.meson_cross_file = crossfile.name
  1044. ++
  1045. ++        env = {'PKG_CONFIG_LIBDIR':  os.path.join(testdir,
  1046. ++                                                  'native_pkgconfig')}
  1047. ++        self.init(testdir, extra_args=['-Dstart_native=false'], override_envvars=env)
  1048. ++        self.wipe()
  1049. ++        self.init(testdir, extra_args=['-Dstart_native=true'], override_envvars=env)
  1050. ++
  1051. +     def __reconfigure(self, change_minor=False):
  1052. +         # Set an older version to force a reconfigure from scratch
  1053. +         filename = os.path.join(self.privatedir, 'coredata.dat')
  1054. +@@ -6847,7 +6875,7 @@ class NativeFileTests(BasePlatformTests):
  1055. +
  1056. + class CrossFileTests(BasePlatformTests):
  1057. +
  1058. +-    """Tests for cross file functioality not directly related to
  1059. ++    """Tests for cross file functionality not directly related to
  1060. +     cross compiling.
  1061. +
  1062. +     This is mainly aimed to testing overrides from cross files.
  1063. +--
  1064. +2.24.1
  1065. +
  1066. diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
  1067. index fc8e27f7eb..369e225b3e 100644
  1068. --- a/package/meson/cross-compilation.conf.in
  1069. +++ b/package/meson/cross-compilation.conf.in
  1070. @@ -8,7 +8,7 @@ c = '@TARGET_CROSS@gcc'
  1071.  cpp = '@TARGET_CROSS@g++'
  1072.  ar = '@TARGET_CROSS@ar'
  1073.  strip = '@TARGET_CROSS@strip'
  1074. -pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
  1075. +pkgconfig = '@HOST_DIR@/bin/pkgconf'
  1076.  
  1077.  [properties]
  1078.  needs_exe_wrapper = true
  1079. @@ -16,6 +16,8 @@ c_args = [@TARGET_CFLAGS@]
  1080.  c_link_args = [@TARGET_LDFLAGS@]
  1081.  cpp_args = [@TARGET_CXXFLAGS@]
  1082.  cpp_link_args = [@TARGET_LDFLAGS@]
  1083. +sys_root = '@STAGING_DIR@'
  1084. +pkg_config_libdir = '@STAGING_DIR@/usr/lib/pkgconfig:@STAGING_DIR@/usr/share/pkgconfig'
  1085.  
  1086.  [host_machine]
  1087.  system = 'linux'
  1088. diff --git a/package/meson/meson.hash b/package/meson/meson.hash
  1089. index 26b1fc9bb2..881d4211cf 100644
  1090. --- a/package/meson/meson.hash
  1091. +++ b/package/meson/meson.hash
  1092. @@ -1,4 +1,4 @@
  1093.  # Locally calculated after checking pgp signature
  1094. -# https://github.com/mesonbuild/meson/releases/download/0.52.0/meson-0.52.0.tar.gz.asc
  1095. -sha256 d60f75f0dedcc4fd249dbc7519d6f3ce6df490033d276ef1cf27453ef4938d32 meson-0.52.0.tar.gz
  1096. +# https://github.com/mesonbuild/meson/releases/download/0.53.1/meson-0.53.1.tar.gz.asc
  1097. +sha256 ec1ba33eea701baca2c1607dac458152dc8323364a51fdef6babda2623413b04 meson-0.53.1.tar.gz
  1098.  sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 COPYING
  1099. diff --git a/package/meson/meson.mk b/package/meson/meson.mk
  1100. index c708532c6d..810c84690a 100644
  1101. --- a/package/meson/meson.mk
  1102. +++ b/package/meson/meson.mk
  1103. @@ -4,7 +4,7 @@
  1104.  #
  1105.  ################################################################################
  1106.  
  1107. -MESON_VERSION = 0.52.0
  1108. +MESON_VERSION = 0.53.1
  1109.  MESON_SITE = https://github.com/mesonbuild/meson/releases/download/$(MESON_VERSION)
  1110.  MESON_LICENSE = Apache-2.0
  1111.  MESON_LICENSE_FILES = COPYING
  1112. @@ -45,8 +45,10 @@ else
  1113.  HOST_MESON_TARGET_CPU_FAMILY = $(ARCH)
  1114.  endif
  1115.  
  1116. -HOST_MESON_SED_CFLAGS = $(if $(strip $(TARGET_CFLAGS)),`printf '"%s"$(comma) ' $(TARGET_CFLAGS)`)
  1117. -HOST_MESON_SED_LDFLAGS = $(if $(strip $(TARGET_LDFLAGS)),`printf '"%s"$(comma) ' $(TARGET_LDFLAGS)`)
  1118. -HOST_MESON_SED_CXXFLAGS = $(if $(strip $(TARGET_CXXFLAGS)),`printf '"%s"$(comma) ' $(TARGET_CXXFLAGS)`)
  1119. +# Avoid interpreter shebang longer than 128 chars
  1120. +define HOST_MESON_SET_INTERPRETER
  1121. +   $(SED) '1s:.*:#!/usr/bin/env python3:' $(HOST_DIR)/bin/meson
  1122. +endef
  1123. +HOST_MESON_POST_INSTALL_HOOKS += HOST_MESON_SET_INTERPRETER
  1124.  
  1125.  $(eval $(host-python-package))
  1126. diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
  1127. index e7eea2aa58..352f439467 100644
  1128. --- a/package/pkg-meson.mk
  1129. +++ b/package/pkg-meson.mk
  1130. @@ -60,31 +60,27 @@ ifeq ($(4),target)
  1131.  $(2)_CFLAGS ?= $$(TARGET_CFLAGS)
  1132.  $(2)_LDFLAGS ?= $$(TARGET_LDFLAGS)
  1133.  $(2)_CXXFLAGS ?= $$(TARGET_CXXFLAGS)
  1134. -
  1135. -$(2)_MESON_SED_CFLAGS = $$(if $$(strip $$($(2)_CFLAGS)),`printf '"%s"$$(comma) ' $$($(2)_CFLAGS)`)
  1136. -$(2)_MESON_SED_LDFLAGS = $$(if $$(strip $$($(2)_LDFLAGS)),`printf '"%s"$$(comma) ' $$($(2)_LDFLAGS)`)
  1137. -$(2)_MESON_SED_CXXFLAGS = $$(if $$(strip $$($(2)_CXXFLAGS)),`printf '"%s"$$(comma) ' $$($(2)_CXXFLAGS)`)
  1138. -
  1139.  # Configure package for target
  1140.  #
  1141.  #
  1142.  define $(2)_CONFIGURE_CMDS
  1143.     rm -rf $$($$(PKG)_SRCDIR)/build
  1144.     mkdir -p $$($$(PKG)_SRCDIR)/build
  1145. -   sed -e "s%@TARGET_CROSS@%$$(TARGET_CROSS)%g" \
  1146. -       -e "s%@TARGET_ARCH@%$$(HOST_MESON_TARGET_CPU_FAMILY)%g" \
  1147. -       -e "s%@TARGET_CPU@%$$(GCC_TARGET_CPU)%g" \
  1148. -       -e "s%@TARGET_ENDIAN@%$$(call LOWERCASE,$$(BR2_ENDIAN))%g" \
  1149. -       -e "s%@TARGET_CFLAGS@%$$($(2)_MESON_SED_CFLAGS)%g" \
  1150. -       -e "s%@TARGET_LDFLAGS@%$$($(2)_MESON_SED_LDFLAGS)%g" \
  1151. -       -e "s%@TARGET_CXXFLAGS@%$$($(2)_MESON_SED_CXXFLAGS)%g" \
  1152. -       -e "s%@HOST_DIR@%$$(HOST_DIR)%g" \
  1153. +   sed -e 's%@TARGET_CROSS@%$$(TARGET_CROSS)%g' \
  1154. +       -e 's%@TARGET_ARCH@%$$(HOST_MESON_TARGET_CPU_FAMILY)%g' \
  1155. +       -e 's%@TARGET_CPU@%$$(GCC_TARGET_CPU)%g' \
  1156. +       -e 's%@TARGET_ENDIAN@%$$(call LOWERCASE,$$(BR2_ENDIAN))%g' \
  1157. +       -e 's%@TARGET_CFLAGS@%$$(call make-comma-list,$$($(2)_CFLAGS))%g' \
  1158. +       -e 's%@TARGET_LDFLAGS@%$$(call make-comma-list,$$($(2)_LDFLAGS))%g' \
  1159. +       -e 's%@TARGET_CXXFLAGS@%$$(call make-comma-list,$$($(2)_CXXFLAGS))%g' \
  1160. +       -e 's%@HOST_DIR@%$$(HOST_DIR)%g' \
  1161. +       -e 's%@STAGING_DIR@%$$(STAGING_DIR)%g' \
  1162.         $$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
  1163.             -e "/^\[binaries\]$$$$/s:$$$$:\n$$(x):" \
  1164.         ) \
  1165.         package/meson/cross-compilation.conf.in \
  1166.         > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
  1167. -   PATH=$$(BR_PATH) $$($$(PKG)_CONF_ENV) $$(MESON) \
  1168. +   $$(TARGET_MAKE_ENV) $$($$(PKG)_CONF_ENV) $$(MESON) \
  1169.         --prefix=/usr \
  1170.         --libdir=lib \
  1171.         --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \
  1172. @@ -188,19 +184,20 @@ host-meson-package = $(call inner-meson-package,host-$(pkgname),$(call UPPERCASE
  1173.  # own flags if they need to.
  1174.  define PKG_MESON_INSTALL_CROSS_CONF
  1175.     mkdir -p $(HOST_DIR)/etc/meson
  1176. -   sed -e "s%@TARGET_CROSS@%$(TARGET_CROSS)%g" \
  1177. -       -e "s%@TARGET_ARCH@%$(HOST_MESON_TARGET_CPU_FAMILY)%g" \
  1178. -       -e "s%@TARGET_CPU@%$(HOST_MESON_TARGET_CPU)%g" \
  1179. -       -e "s%@TARGET_ENDIAN@%$(HOST_MESON_TARGET_ENDIAN)%g" \
  1180. -       -e "s%@TARGET_CFLAGS@%$(HOST_MESON_SED_CFLAGS)@PKG_TARGET_CFLAGS@%g" \
  1181. -       -e "s%@TARGET_LDFLAGS@%$(HOST_MESON_SED_LDFLAGS)@PKG_TARGET_CFLAGS@%g" \
  1182. -       -e "s%@TARGET_CXXFLAGS@%$(HOST_MESON_SED_CXXFLAGS)@PKG_TARGET_CFLAGS@%g" \
  1183. -       -e "s%@HOST_DIR@%$(HOST_DIR)%g" \
  1184. +   sed -e 's%@TARGET_CROSS@%$(TARGET_CROSS)%g' \
  1185. +       -e 's%@TARGET_ARCH@%$(HOST_MESON_TARGET_CPU_FAMILY)%g' \
  1186. +       -e 's%@TARGET_CPU@%$(HOST_MESON_TARGET_CPU)%g' \
  1187. +       -e 's%@TARGET_ENDIAN@%$(HOST_MESON_TARGET_ENDIAN)%g' \
  1188. +       -e 's%@TARGET_CFLAGS@%$(call make-comma-list,$(TARGET_CFLAGS))@PKG_TARGET_CFLAGS@%g' \
  1189. +       -e 's%@TARGET_LDFLAGS@%$(call make-comma-list,$(TARGET_LDFLAGS))@PKG_TARGET_CFLAGS@%g' \
  1190. +       -e 's%@TARGET_CXXFLAGS@%$(call make-comma-list,$(TARGET_CXXFLAGS))@PKG_TARGET_CFLAGS@%g' \
  1191. +       -e 's%@HOST_DIR@%$(HOST_DIR)%g' \
  1192. +       -e 's%@STAGING_DIR@%$$(STAGING_DIR)%g' \
  1193.         $(HOST_MESON_PKGDIR)/cross-compilation.conf.in \
  1194.         > $(HOST_DIR)/etc/meson/cross-compilation.conf.in
  1195. -   sed -e "s%@PKG_TARGET_CFLAGS@%%g" \
  1196. -       -e "s%@PKG_TARGET_LDFLAGS@%%g" \
  1197. -       -e "s%@PKG_TARGET_CXXFLAGS@%%g" \
  1198. +   sed -e 's%@PKG_TARGET_CFLAGS@%%g' \
  1199. +       -e 's%@PKG_TARGET_LDFLAGS@%%g' \
  1200. +       -e 's%@PKG_TARGET_CXXFLAGS@%%g' \
  1201.         $(HOST_DIR)/etc/meson/cross-compilation.conf.in \
  1202.         > $(HOST_DIR)/etc/meson/cross-compilation.conf
  1203.  endef
  1204. diff --git a/package/pkg-python.mk b/package/pkg-python.mk
  1205. index 4ded4fde83..93f24856bf 100644
  1206. --- a/package/pkg-python.mk
  1207. +++ b/package/pkg-python.mk
  1208. @@ -20,21 +20,11 @@
  1209.  #
  1210.  ################################################################################
  1211.  
  1212. -define PKG_PYTHON_SYSCONFIGDATA_NAME
  1213. -$(basename $(notdir $(wildcard $(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/_sysconfigdata__linux_*.py)))
  1214. -endef
  1215. -
  1216.  # Target distutils-based packages
  1217.  PKG_PYTHON_DISTUTILS_ENV = \
  1218. -   PATH=$(BR_PATH) \
  1219. +   PATH=$(HOST_BIN_CROSS):$(BR_PATH) \
  1220.     $(TARGET_CONFIGURE_OPTS) \
  1221.     LDSHARED="$(TARGET_CROSS)gcc -shared" \
  1222. -   PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
  1223. -   PYTHONNOUSERSITE=1 \
  1224. -   _PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \
  1225. -   _python_sysroot=$(STAGING_DIR) \
  1226. -   _python_prefix=/usr \
  1227. -   _python_exec_prefix=/usr
  1228.  
  1229.  PKG_PYTHON_DISTUTILS_BUILD_OPTS = \
  1230.     --executable=/usr/bin/python
  1231. @@ -58,14 +48,8 @@ HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \
  1232.  
  1233.  # Target setuptools-based packages
  1234.  PKG_PYTHON_SETUPTOOLS_ENV = \
  1235. -   _PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \
  1236. -   PATH=$(BR_PATH) \
  1237. +   PATH=$(HOST_BIN_CROSS):$(BR_PATH) \
  1238.     $(TARGET_CONFIGURE_OPTS) \
  1239. -   PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
  1240. -   PYTHONNOUSERSITE=1 \
  1241. -   _python_sysroot=$(STAGING_DIR) \
  1242. -   _python_prefix=/usr \
  1243. -   _python_exec_prefix=/usr
  1244.  
  1245.  PKG_PYTHON_SETUPTOOLS_INSTALL_TARGET_OPTS = \
  1246.     --prefix=/usr \
  1247. @@ -225,7 +209,7 @@ endif # SETUP_TYPE
  1248.  #   - otherwise, we use the one requested by *_NEEDS_HOST_PYTHON.
  1249.  #
  1250.  ifeq ($(4),target)
  1251. -$(2)_PYTHON_INTERPRETER = $$(HOST_DIR)/bin/python
  1252. +$(2)_PYTHON_INTERPRETER = $$(HOST_BIN_CROSS)/python
  1253.  else
  1254.  ifeq ($$($(2)_NEEDS_HOST_PYTHON),)
  1255.  $(2)_PYTHON_INTERPRETER = $$(HOST_DIR)/bin/python
  1256. diff --git a/package/prelink-cross/prelink-cross.hash b/package/prelink-cross/prelink-cross.hash
  1257. new file mode 100644
  1258. index 0000000000..3ac33ac3d0
  1259. --- /dev/null
  1260. +++ b/package/prelink-cross/prelink-cross.hash
  1261. @@ -0,0 +1,3 @@
  1262. +# Locally computed
  1263. +sha256  cb3f5d833cd74b7e90e38465c9c948b0f4138c017509cb91e391b0931063429e  prelink-cross-a853a5d715d84eec93aa68e8f2df26b7d860f5b2.tar.gz
  1264. +sha256  b8a2f73f743dc1a51aff23f1aacbca4b868564db52496fa3c0caba755bfd1eaf  COPYING
  1265. diff --git a/package/prelink-cross/prelink-cross.mk b/package/prelink-cross/prelink-cross.mk
  1266. new file mode 100644
  1267. index 0000000000..b43c209b16
  1268. --- /dev/null
  1269. +++ b/package/prelink-cross/prelink-cross.mk
  1270. @@ -0,0 +1,16 @@
  1271. +################################################################################
  1272. +#
  1273. +# host-prelink-cross
  1274. +#
  1275. +################################################################################
  1276. +
  1277. +HOST_PRELINK_CROSS_VERSION = a853a5d715d84eec93aa68e8f2df26b7d860f5b2
  1278. +HOST_PRELINK_CROSS_SITE = https://git.yoctoproject.org/git/prelink-cross
  1279. +HOST_PRELINK_CROSS_SITE_METHOD = git
  1280. +HOST_PRELINK_CROSS_LICENSE = GPL-2.0
  1281. +HOST_PRELINK_CROSS_LICENSE_FILES = COPYING
  1282. +# Sources from git, no configure script present
  1283. +HOST_PRELINK_CROSS_AUTORECONF = YES
  1284. +HOST_PRELINK_CROSS_DEPENDENCIES = host-elfutils host-libiberty
  1285. +
  1286. +$(eval $(host-autotools-package))
  1287. diff --git a/package/python-gobject/0001-add-PYTHON_INCLUDES-override.patch b/package/python-gobject/0001-add-PYTHON_INCLUDES-override.patch
  1288. deleted file mode 100644
  1289. index d883f60ddf..0000000000
  1290. --- a/package/python-gobject/0001-add-PYTHON_INCLUDES-override.patch
  1291. +++ /dev/null
  1292. @@ -1,32 +0,0 @@
  1293. -[PATCH] m4/python.m4: add PYTHON_INCLUDES override for cross compilation
  1294. -
  1295. -As the configure script mixes up host/target python. Equivalent to the
  1296. -similar code in dbus-python.
  1297. -
  1298. -Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  1299. ----
  1300. - m4/python.m4 |    4 ++++
  1301. - 1 file changed, 4 insertions(+)
  1302. -
  1303. -Index: python-gobject-2.28.6/m4/python.m4
  1304. -===================================================================
  1305. ---- python-gobject-2.28.6.orig/m4/python.m4
  1306. -+++ python-gobject-2.28.6/m4/python.m4
  1307. -@@ -43,6 +43,9 @@
  1308. - [AC_REQUIRE([AM_PATH_PYTHON])
  1309. - AC_MSG_CHECKING(for headers required to compile python extensions)
  1310. - dnl deduce PYTHON_INCLUDES
  1311. -+if test "${PYTHON_INCLUDES+set}" = set; then
  1312. -+  AC_MSG_NOTICE([PYTHON_INCLUDES overridden to: $PYTHON_INCLUDES])
  1313. -+else
  1314. - py_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.prefix)"`
  1315. - py_exec_prefix=`$PYTHON -c "import sys; sys.stdout.write(sys.exec_prefix)"`
  1316. - PYTHON_CONFIG=`which $PYTHON`-config
  1317. -@@ -54,6 +57,7 @@
  1318. -   PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
  1319. - fi
  1320. - fi
  1321. -+fi
  1322. - AC_SUBST(PYTHON_INCLUDES)
  1323. - dnl check if the headers exist:
  1324. - save_CPPFLAGS="$CPPFLAGS"
  1325. diff --git a/package/python-gobject/Config.in b/package/python-gobject/Config.in
  1326. index 36ddffebb0..33f4b85385 100644
  1327. --- a/package/python-gobject/Config.in
  1328. +++ b/package/python-gobject/Config.in
  1329. @@ -1,16 +1,20 @@
  1330.  config BR2_PACKAGE_PYTHON_GOBJECT
  1331.     bool "python-gobject"
  1332. -   depends on BR2_USE_WCHAR # libglib2
  1333. -   depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2
  1334. -   depends on BR2_USE_MMU # libglib2
  1335. -   depends on BR2_PACKAGE_PYTHON # Broken with python 3.8
  1336. -   select BR2_PACKAGE_LIBGLIB2
  1337. +   depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
  1338. +   depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
  1339. +   depends on BR2_TOOLCHAIN_USES_GLIBC # gobject-introspection
  1340. +   depends on BR2_USE_MMU # python3, libglib2, gobject-introspection
  1341. +   depends on BR2_PACKAGE_GOBJECT_INTROSPECTION
  1342.     help
  1343.       Python bindings for the GLib/GObject library
  1344.  
  1345.       https://wiki.gnome.org/action/show/Projects/PyGObject
  1346.  
  1347. -comment "python-gobject needs a toolchain w/ wchar, threads"
  1348. -   depends on BR2_PACKAGE_PYTHON
  1349. +comment "python-gobject needs gobject-introspection"
  1350. +   depends on !BR2_PACKAGE_GOBJECT_INTROSPECTION
  1351. +
  1352. +comment "python-gobject needs a glibc toolchain, host-gcc >= 4.9"
  1353.     depends on BR2_USE_MMU
  1354. -   depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
  1355. +   depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
  1356. +   depends on !BR2_TOOLCHAIN_USES_GLIBC || \
  1357. +       !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9
  1358. diff --git a/package/python-gobject/python-gobject.hash b/package/python-gobject/python-gobject.hash
  1359. index 024419e965..958c022a18 100644
  1360. --- a/package/python-gobject/python-gobject.hash
  1361. +++ b/package/python-gobject/python-gobject.hash
  1362. @@ -1,2 +1,3 @@
  1363. -# from http://ftp.gnome.org/pub/GNOME/sources/pygobject/2.28/pygobject-2.28.6.sha256sum
  1364. -sha256 fb8a1d4f665130a125011659bd347c7339c944232163dbb9a34fd0686577adb8  pygobject-2.28.6.tar.xz
  1365. +# from http://ftp.gnome.org/pub/GNOME/sources/pygobject/3.34/pygobject-3.34.0.sha256sum
  1366. +sha256  87e2c9aa785f352ef111dcc5f63df9b85cf6e05e52ff04f803ffbebdacf5271a  pygobject-3.34.0.tar.xz
  1367. +sha256  32434afcc8666ba060e111d715bfdb6c2d5dd8a35fa4d3ab8ad67d8f850d2f2b  COPYING
  1368. diff --git a/package/python-gobject/python-gobject.mk b/package/python-gobject/python-gobject.mk
  1369. index cf5c874151..29d6d995ae 100644
  1370. --- a/package/python-gobject/python-gobject.mk
  1371. +++ b/package/python-gobject/python-gobject.mk
  1372. @@ -4,36 +4,17 @@
  1373.  #
  1374.  ################################################################################
  1375.  
  1376. -PYTHON_GOBJECT_VERSION_MAJOR = 2.28
  1377. -PYTHON_GOBJECT_VERSION = $(PYTHON_GOBJECT_VERSION_MAJOR).6
  1378. +PYTHON_GOBJECT_VERSION_MAJOR = 3.34
  1379. +PYTHON_GOBJECT_VERSION = $(PYTHON_GOBJECT_VERSION_MAJOR).0
  1380.  PYTHON_GOBJECT_SOURCE = pygobject-$(PYTHON_GOBJECT_VERSION).tar.xz
  1381. -PYTHON_GOBJECT_SITE = http://ftp.gnome.org/pub/gnome/sources/pygobject/$(PYTHON_GOBJECT_VERSION_MAJOR)
  1382. +PYTHON_GOBJECT_SITE = https://ftp.gnome.org/pub/gnome/sources/pygobject/$(PYTHON_GOBJECT_VERSION_MAJOR)
  1383.  PYTHON_GOBJECT_LICENSE = LGPL-2.1+
  1384.  PYTHON_GOBJECT_LICENSE_FILES = COPYING
  1385. -PYTHON_GOBJECT_DEPENDENCIES = host-pkgconf libglib2
  1386. -PYTHON_GOBJECT_CONF_OPTS = --disable-introspection
  1387. -# for 0001-add-PYTHON_INCLUDES-override.patch
  1388. -PYTHON_GOBJECT_AUTORECONF = YES
  1389. +PYTHON_GOBJECT_INSTALL_STAGING = YES
  1390. +PYTHON_GOBJECT_DEPENDENCIES = host-pkgconf libglib2 gobject-introspection python3
  1391. +PYTHON_GOBJECT_CONF_OPTS = \
  1392. +   -Dpycairo=false \
  1393. +   -Dtests=false \
  1394. +   -Dpython=$(HOST_BIN_CROSS)/python
  1395.  
  1396. -ifeq ($(BR2_PACKAGE_PYTHON),y)
  1397. -PYTHON_GOBJECT_DEPENDENCIES += python host-python
  1398. -
  1399. -PYTHON_GOBJECT_CONF_ENV = \
  1400. -   PYTHON=$(HOST_DIR)/bin/python2 \
  1401. -   PYTHON_INCLUDES="`$(STAGING_DIR)/usr/bin/python2-config --includes`"
  1402. -else
  1403. -PYTHON_GOBJECT_DEPENDENCIES += python3 host-python3
  1404. -
  1405. -PYTHON_GOBJECT_CONF_ENV = \
  1406. -   PYTHON=$(HOST_DIR)/bin/python3 \
  1407. -   PYTHON_INCLUDES="`$(STAGING_DIR)/usr/bin/python3-config --includes`"
  1408. -endif
  1409. -
  1410. -ifeq ($(BR2_PACKAGE_LIBFFI),y)
  1411. -PYTHON_GOBJECT_CONF_OPTS += --with-ffi
  1412. -PYTHON_GOBJECT_DEPENDENCIES += libffi
  1413. -else
  1414. -PYTHON_GOBJECT_CONF_OPTS += --without-ffi
  1415. -endif
  1416. -
  1417. -$(eval $(autotools-package))
  1418. +$(eval $(meson-package))
  1419. diff --git a/package/python/python-wrapper.in b/package/python/python-wrapper.in
  1420. new file mode 100644
  1421. index 0000000000..c5e6e5481b
  1422. --- /dev/null
  1423. +++ b/package/python/python-wrapper.in
  1424. @@ -0,0 +1,10 @@
  1425. +#! /bin/sh
  1426. +
  1427. +STAGING_DIR=$(cd "${0%/*}/../sysroot"; pwd)
  1428. +
  1429. +PYTHONPATH="@PYTHON_PATH@" \
  1430. +PYTHONNOUSERSITE=1 \
  1431. +_python_sysroot="$STAGING_DIR" \
  1432. +_python_prefix=/usr \
  1433. +_python_exec_prefix=/usr \
  1434. +exec "${0%/*}/../../bin/python" "$@"
  1435. diff --git a/package/python/python.mk b/package/python/python.mk
  1436. index 41a981e3d3..6f2e01386e 100644
  1437. --- a/package/python/python.mk
  1438. +++ b/package/python/python.mk
  1439. @@ -227,6 +227,20 @@ PYTHON_POST_INSTALL_STAGING_HOOKS += PYTHON_INSTALL_STAGING_PYTHON_CONFIG_SYMLIN
  1440.  
  1441.  PYTHON_AUTORECONF = YES
  1442.  
  1443. +# Provided to other packages
  1444. +PYTHON_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/sysconfigdata/
  1445. +
  1446. +define PYTHON_INSTALL_CROSS_WRAPPER
  1447. +   mkdir -p $(HOST_BIN_CROSS)
  1448. +   sed 's%@PYTHON_PATH@%$(PYTHON_PATH)%' \
  1449. +       package/python/python-wrapper.in \
  1450. +       > $(HOST_BIN_CROSS)/python
  1451. +   chmod 0755 $(HOST_BIN_CROSS)/python
  1452. +   ln -sf python $(HOST_BIN_CROSS)/python2
  1453. +endef
  1454. +
  1455. +PYTHON_POST_INSTALL_STAGING_HOOKS += PYTHON_INSTALL_CROSS_WRAPPER
  1456. +
  1457.  # Some packages may have build scripts requiring python2.
  1458.  # Only install the python symlink in the host tree if python3 is not enabled
  1459.  # for the target, otherwise the default python program may be missing.
  1460. @@ -239,9 +253,6 @@ endef
  1461.  HOST_PYTHON_POST_INSTALL_HOOKS += HOST_PYTHON_INSTALL_PYTHON_SYMLINK
  1462.  endif
  1463.  
  1464. -# Provided to other packages
  1465. -PYTHON_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/sysconfigdata/
  1466. -
  1467.  $(eval $(autotools-package))
  1468.  $(eval $(host-autotools-package))
  1469.  
  1470. diff --git a/package/python3/python-wrapper.in b/package/python3/python-wrapper.in
  1471. new file mode 100644
  1472. index 0000000000..c2f34f32df
  1473. --- /dev/null
  1474. +++ b/package/python3/python-wrapper.in
  1475. @@ -0,0 +1,24 @@
  1476. +#! /bin/sh
  1477. +
  1478. +STAGING_DIR=$(cd "${0%/*}/../sysroot"; pwd)
  1479. +
  1480. +SYSCONFIGDATA=""
  1481. +for sysconfig in ${STAGING_DIR}/usr/lib/python*/_sysconfigdata__linux_*.py; do
  1482. +    if [ -n "$SYSCONFIGDATA" ]; then
  1483. +        echo "*** More than one sysconfigdata exists. Buildroot doesn't support mixing targets." 1>&2
  1484. +        exit 1
  1485. +    fi
  1486. +    if [ ! -r "$sysconfig" ]; then
  1487. +        echo "*** No sysconfigdata found in $sysconfig." 1>&2
  1488. +        exit 1
  1489. +    fi
  1490. +    SYSCONFIGDATA="$(echo $sysconfig | sed 's%.*/\([^/]*\).py%\1%')"
  1491. +done
  1492. +
  1493. +PYTHONPATH="@PYTHON_PATH@" \
  1494. +PYTHONNOUSERSITE=1 \
  1495. +_PYTHON_SYSCONFIGDATA_NAME="$SYSCONFIGDATA" \
  1496. +_python_sysroot="$STAGING_DIR" \
  1497. +_python_prefix=/usr \
  1498. +_python_exec_prefix=/usr \
  1499. +exec "${0%/*}/../../bin/python3" "$@"
  1500. diff --git a/package/python3/python3.mk b/package/python3/python3.mk
  1501. index 9432f1c59e..6280b4a550 100644
  1502. --- a/package/python3/python3.mk
  1503. +++ b/package/python3/python3.mk
  1504. @@ -239,6 +239,20 @@ ifneq ($(BR2_PACKAGE_PYTHON),y)
  1505.  PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
  1506.  endif
  1507.  
  1508. +# Provided to other packages
  1509. +PYTHON3_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/
  1510. +
  1511. +define PYTHON3_INSTALL_CROSS_WRAPPER
  1512. +   mkdir -p $(HOST_BIN_CROSS)
  1513. +   sed 's%@PYTHON_PATH@%$(PYTHON3_PATH)%' \
  1514. +       package/python3/python-wrapper.in \
  1515. +       > $(HOST_BIN_CROSS)/python
  1516. +   chmod 0755 $(HOST_BIN_CROSS)/python
  1517. +   ln -sf python $(HOST_BIN_CROSS)/python3
  1518. +endef
  1519. +
  1520. +PYTHON3_POST_INSTALL_STAGING_HOOKS += PYTHON3_INSTALL_CROSS_WRAPPER
  1521. +
  1522.  # Some packages may have build scripts requiring python3, whatever is the
  1523.  # python version chosen for the target.
  1524.  # Only install the python symlink in the host tree if python3 is enabled
  1525. @@ -252,9 +266,6 @@ endef
  1526.  HOST_PYTHON3_POST_INSTALL_HOOKS += HOST_PYTHON3_INSTALL_SYMLINK
  1527.  endif
  1528.  
  1529. -# Provided to other packages
  1530. -PYTHON3_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/
  1531. -
  1532.  # Support for socket.AF_BLUETOOTH
  1533.  ifeq ($(BR2_PACKAGE_BLUEZ5_UTILS_HEADERS),y)
  1534.  PYTHON3_DEPENDENCIES += bluez5_utils-headers
  1535. --
  1536. 2.21.1 (Apple Git-122.3)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top