0447b7a.patch 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. diff -Nuar a/cmake/VersioningUtils.cmake b/cmake/VersioningUtils.cmake
  2. --- a/cmake/VersioningUtils.cmake 2021-01-18 17:40:23.000000000 +0300
  3. +++ b/cmake/VersioningUtils.cmake 2021-02-28 16:01:31.749319740 +0300
  4. @@ -1,3 +1,12 @@
  5. +function(READ_VERSION_HEADER var_prefix def_regex file_path)
  6. + file(STRINGS "${file_path}" lines)
  7. + foreach (line ${lines})
  8. + if (line MATCHES "^#define[ \t]+(${def_regex})[ \t]+([0-9]+)$")
  9. + set("${var_prefix}${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}" PARENT_SCOPE)
  10. + endif()
  11. + endforeach()
  12. +endfunction()
  13. +
  14. macro(SET_PROJECT_VERSION major minor micro)
  15. set(PROJECT_VERSION_MAJOR "${major}")
  16. set(PROJECT_VERSION_MINOR "${minor}")
  17. diff -Nuar a/CMakeLists.txt b/CMakeLists.txt
  18. --- a/CMakeLists.txt 2021-01-18 17:40:23.000000000 +0300
  19. +++ b/CMakeLists.txt 2021-02-28 16:01:00.215322016 +0300
  20. @@ -4,7 +4,8 @@
  21. set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
  22. include(VersioningUtils)
  23. -SET_PROJECT_VERSION(1 9 1)
  24. +READ_VERSION_HEADER("" "WPE_[A-Z]+_VERSION" "${CMAKE_SOURCE_DIR}/include/wpe/libwpe-version.h")
  25. +SET_PROJECT_VERSION(${WPE_MAJOR_VERSION} ${WPE_MINOR_VERSION} ${WPE_MICRO_VERSION})
  26. set(WPE_API_VERSION "1.0")
  27. # Before making a release, the LT_VERSION string should be modified.
  28. @@ -41,10 +42,6 @@
  29. endif ()
  30. endforeach ()
  31. -set(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources/wpe")
  32. -configure_file(include/wpe/version.h.cmake ${DERIVED_SOURCES_DIR}/version.h @ONLY)
  33. -configure_file(include/wpe/version-deprecated.h.cmake ${DERIVED_SOURCES_DIR}/version-deprecated.h @ONLY)
  34. -
  35. include(DistTargets)
  36. include(GNUInstallDirs)
  37. @@ -52,8 +49,9 @@
  38. find_package(Libxkbcommon REQUIRED)
  39. set(WPE_PUBLIC_HEADERS
  40. - ${DERIVED_SOURCES_DIR}/version.h
  41. - ${DERIVED_SOURCES_DIR}/version-deprecated.h
  42. + include/wpe/libwpe-version.h
  43. + include/wpe/version.h
  44. + include/wpe/version-deprecated.h
  45. include/wpe/export.h
  46. include/wpe/input.h
  47. include/wpe/keysyms.h
  48. @@ -81,7 +79,6 @@
  49. target_include_directories(wpe PRIVATE
  50. "include"
  51. "src"
  52. - ${DERIVED_SOURCES_DIR}/..
  53. $<TARGET_PROPERTY:GL::egl,INTERFACE_INCLUDE_DIRECTORIES>
  54. )
  55. target_compile_definitions(wpe PRIVATE
  56. @@ -145,10 +142,8 @@
  57. --sitemap=${CMAKE_SOURCE_DIR}/docs/sitemap.txt
  58. --output=${CMAKE_CURRENT_BINARY_DIR}/Documentation/
  59. --c-sources "${CMAKE_SOURCE_DIR}/include/wpe/*.h"
  60. - "${DERIVED_SOURCES_DIR}/version.h"
  61. - "${DERIVED_SOURCES_DIR}/version-deprecated.h"
  62. --extra-c-flags=-DWPE_COMPILATION=1
  63. - --c-include-directories ${CMAKE_SOURCE_DIR}/include ${DERIVED_SOURCES_DIR}
  64. + --c-include-directories ${CMAKE_SOURCE_DIR}/include
  65. --c-smart-index
  66. )
  67. ELSE()
  68. diff -Nuar a/include/wpe/libwpe-version.h b/include/wpe/libwpe-version.h
  69. --- a/include/wpe/libwpe-version.h 1970-01-01 02:00:00.000000000 +0200
  70. +++ b/include/wpe/libwpe-version.h 2021-02-28 16:01:59.205317759 +0300
  71. @@ -0,0 +1,15 @@
  72. +/*
  73. + * libwpe-version.h
  74. + * Copyright (C) 2021 Adrian Perez de Castro <aperez@igalia.com>
  75. + *
  76. + * Distributed under terms of the MIT license.
  77. + */
  78. +
  79. +#ifndef LIBWPE_VERSION_H
  80. +#define LIBWPE_VERSION_H
  81. +
  82. +#define WPE_MAJOR_VERSION 1
  83. +#define WPE_MINOR_VERSION 9
  84. +#define WPE_MICRO_VERSION 1
  85. +
  86. +#endif /* !LIBWPE_VERSION_H */
  87. diff -Nuar a/include/wpe/meson.build b/include/wpe/meson.build
  88. --- a/include/wpe/meson.build 2021-01-18 17:40:23.000000000 +0300
  89. +++ b/include/wpe/meson.build 2021-02-28 16:02:31.313315442 +0300
  90. @@ -2,27 +2,17 @@
  91. 'export.h',
  92. 'input.h',
  93. 'keysyms.h',
  94. + 'libwpe-version.h',
  95. 'loader.h',
  96. 'pasteboard.h',
  97. 'renderer-backend-egl.h',
  98. 'renderer-host.h',
  99. + 'version.h',
  100. + 'version-deprecated.h',
  101. 'view-backend.h',
  102. 'wpe-egl.h',
  103. 'wpe.h',
  104. -
  105. - # Generated API headers.
  106. - configure_file(
  107. - input: 'version.h.cmake',
  108. - output: 'version.h',
  109. - configuration: version_info,
  110. - ),
  111. - configure_file(
  112. - input: 'version-deprecated.h.cmake',
  113. - output: 'version-deprecated.h',
  114. - configuration: version_info,
  115. - ),
  116. ]
  117. install_headers(api_headers,
  118. subdir: join_paths('wpe-' + api_version, 'wpe'),
  119. )
  120. -
  121. diff -Nuar a/include/wpe/version-deprecated.h b/include/wpe/version-deprecated.h
  122. --- a/include/wpe/version-deprecated.h 1970-01-01 02:00:00.000000000 +0200
  123. +++ b/include/wpe/version-deprecated.h 2021-02-28 16:02:59.227313428 +0300
  124. @@ -0,0 +1,88 @@
  125. +/*
  126. + * Copyright (C) 2018 Igalia S.L.
  127. + * All rights reserved.
  128. + *
  129. + * Redistribution and use in source and binary forms, with or without
  130. + * modification, are permitted provided that the following conditions
  131. + * are met:
  132. + * 1. Redistributions of source code must retain the above copyright
  133. + * notice, this list of conditions and the following disclaimer.
  134. + * 2. Redistributions in binary form must reproduce the above copyright
  135. + * notice, this list of conditions and the following disclaimer in the
  136. + * documentation and/or other materials provided with the distribution.
  137. + *
  138. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  139. + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  140. + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  141. + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  142. + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  143. + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  144. + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  145. + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  146. + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  147. + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  148. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  149. + */
  150. +
  151. +#if !defined(__WPE_H_INSIDE__) && !defined(WPE_COMPILATION)
  152. +#error "Only <wpe/wpe.h> can be included directly."
  153. +#endif
  154. +
  155. +#ifndef wpe_version_deprecated_h
  156. +#define wpe_version_deprecated_h
  157. +
  158. +#if defined(WPE_COMPILATION)
  159. +#include "export.h"
  160. +#endif
  161. +
  162. +#include "libwpe-version.h"
  163. +
  164. +#ifdef __cplusplus
  165. +extern "C" {
  166. +#endif
  167. +
  168. +#define WPE_BACKEND_MAJOR_VERSION WPE_MAJOR_VERSION
  169. +#define WPE_BACKEND_MINOR_VERSION WPE_MINOR_VERSION
  170. +#define WPE_BACKEND_MICRO_VERSION WPE_MICRO_VERSION
  171. +
  172. +#define WPE_BACKEND_CHECK_VERSION(major, minor, micro) \
  173. + (WPE_BACKEND_MAJOR_VERSION > (major) || \
  174. + (WPE_BACKEND_MAJOR_VERSION == (major) && WPE_BACKEND_MINOR_VERSION > (minor)) || \
  175. + (WPE_BACKEND_MAJOR_VERSION == (major) && WPE_BACKEND_MINOR_VERSION == (minor) && \
  176. + WPE_BACKEND_MICRO_VERSION >= (micro)))
  177. +
  178. +/**
  179. + * wpe_backend_get_major_version:
  180. + *
  181. + * Returns: Major version of the `libwpe` library.
  182. + *
  183. + * Deprecated: Since `libwpe` version 1.0.0, use wpe_get_major_version()
  184. + * instead.
  185. + */
  186. +WPE_EXPORT unsigned wpe_backend_get_major_version(void);
  187. +
  188. +/**
  189. + * wpe_backend_get_minor_version:
  190. + *
  191. + * Returns: Minor version of the `libwpe` library.
  192. + *
  193. + * Deprecated: Since `libwpe` version 1.0.0, use wpe_get_minor_version()
  194. + * instead.
  195. + */
  196. +WPE_EXPORT unsigned wpe_backend_get_minor_version(void);
  197. +
  198. +/**
  199. + * wpe_backend_get_micro_version:
  200. + *
  201. + * Returns: Micro version of the `libwpe` library.
  202. + *
  203. + * Deprecated: Since `libwpe` version 1.0.0, use wpe_get_micro_version()
  204. + * instead.
  205. + */
  206. +WPE_EXPORT unsigned wpe_backend_get_micro_version(void);
  207. +
  208. +#ifdef __cplusplus
  209. +}
  210. +#endif
  211. +
  212. +#endif /* wpe_version_deprecated_h */
  213. diff -Nuar a/include/wpe/version.h b/include/wpe/version.h
  214. --- a/include/wpe/version.h 1970-01-01 02:00:00.000000000 +0200
  215. +++ b/include/wpe/version.h 2021-02-28 16:03:30.351311182 +0300
  216. @@ -0,0 +1,85 @@
  217. +/*
  218. + * Copyright (C) 2018 Igalia S.L.
  219. + * All rights reserved.
  220. + *
  221. + * Redistribution and use in source and binary forms, with or without
  222. + * modification, are permitted provided that the following conditions
  223. + * are met:
  224. + * 1. Redistributions of source code must retain the above copyright
  225. + * notice, this list of conditions and the following disclaimer.
  226. + * 2. Redistributions in binary form must reproduce the above copyright
  227. + * notice, this list of conditions and the following disclaimer in the
  228. + * documentation and/or other materials provided with the distribution.
  229. + *
  230. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  231. + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  232. + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  233. + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  234. + * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  235. + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  236. + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  237. + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  238. + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  239. + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  240. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  241. + */
  242. +
  243. +#if !defined(__WPE_H_INSIDE__) && !defined(WPE_COMPILATION)
  244. +#error "Only <wpe/wpe.h> can be included directly."
  245. +#endif
  246. +
  247. +#ifndef wpe_version_h
  248. +#define wpe_version_h
  249. +
  250. +/**
  251. + * SECTION:version
  252. + * @short_description: Library Version
  253. + * @title: Version
  254. + * @symbols:
  255. + * - wpe_backend_get_major_version
  256. + * - wpe_backend_get_minor_version
  257. + * - wpe_backend_get_micro_version
  258. + */
  259. +
  260. +#if defined(WPE_COMPILATION)
  261. +#include "export.h"
  262. +#endif
  263. +
  264. +#include "libwpe-version.h"
  265. +
  266. +#ifdef __cplusplus
  267. +extern "C" {
  268. +#endif
  269. +
  270. +#define WPE_CHECK_VERSION(major, minor, micro) \
  271. + (WPE_MAJOR_VERSION > (major) || \
  272. + (WPE_MAJOR_VERSION == (major) && WPE_MINOR_VERSION > (minor)) || \
  273. + (WPE_MAJOR_VERSION == (major) && WPE_MINOR_VERSION == (minor) && \
  274. + WPE_MICRO_VERSION >= (micro)))
  275. +
  276. +/**
  277. + * wpe_get_major_version:
  278. + *
  279. + * Returns: Major version of the `libwpe` library.
  280. + */
  281. +WPE_EXPORT unsigned wpe_get_major_version(void);
  282. +
  283. +/**
  284. + * wpe_get_minor_version:
  285. + *
  286. + * Returns: Minor version of the `libwpe` library.
  287. + */
  288. +WPE_EXPORT unsigned wpe_get_minor_version(void);
  289. +
  290. +/**
  291. + * wpe_get_micro_version:
  292. + *
  293. + * Returns: Micro version of the `libwpe` library.
  294. + */
  295. +WPE_EXPORT unsigned wpe_get_micro_version(void);
  296. +
  297. +#ifdef __cplusplus
  298. +}
  299. +#endif
  300. +
  301. +#endif /* wpe_version_h */
  302. diff -Nuar a/include/wpe/wpe.h b/include/wpe/wpe.h
  303. --- a/include/wpe/wpe.h 2021-01-18 17:40:23.000000000 +0300
  304. +++ b/include/wpe/wpe.h 2021-02-28 16:04:05.245308665 +0300
  305. @@ -40,9 +40,10 @@
  306. #include "loader.h"
  307. #include "pasteboard.h"
  308. #include "renderer-host.h"
  309. +#include "view-backend.h"
  310. +#include "libwpe-version.h"
  311. #include "version.h"
  312. #include "version-deprecated.h"
  313. -#include "view-backend.h"
  314. #undef __WPE_H_INSIDE__
  315. diff -Nuar a/meson.build b/meson.build
  316. --- a/meson.build 2021-01-18 17:40:23.000000000 +0300
  317. +++ b/meson.build 2021-02-28 16:04:55.565305034 +0300
  318. @@ -7,7 +7,7 @@
  319. 'cpp_std=c++11',
  320. ],
  321. license: 'BSD-2-Clause',
  322. - version: '1.9.1',
  323. + version: run_command(join_paths('scripts', 'version.py')).stdout().strip(),
  324. )
  325. # This refers to the API level provided. This is modified only with major,
  326. diff -Nuar a/scripts/version.py b/scripts/version.py
  327. --- a/scripts/version.py 1970-01-01 02:00:00.000000000 +0200
  328. +++ b/scripts/version.py 2021-02-28 16:05:47.436301291 +0300
  329. @@ -0,0 +1,23 @@
  330. +#! /usr/bin/env python3
  331. +# -*- coding: utf-8 -*-
  332. +# vim:fenc=utf-8
  333. +#
  334. +# Copyright © 2021 Igalia S.L.
  335. +#
  336. +# Distributed under terms of the MIT license.
  337. +
  338. +from os import environ, path
  339. +import re
  340. +
  341. +version = {}
  342. +version_re = re.compile(r"^#define\s+WPE_([A-Z]+)_VERSION\s+(\d+)$")
  343. +version_file = path.join(environ["MESON_SOURCE_ROOT"],
  344. + "include", "wpe", "libwpe-version.h")
  345. +
  346. +with open(version_file, "r") as f:
  347. + for line in f.readlines():
  348. + m = version_re.match(line)
  349. + if m:
  350. + version[m[1]] = m[2]
  351. +
  352. +print("{}.{}.{}".format(version["MAJOR"], version["MINOR"], version["MICRO"]))
  353. diff -Nuar a/src/version.c b/src/version.c
  354. --- a/src/version.c 2021-01-18 17:40:23.000000000 +0300
  355. +++ b/src/version.c 2021-02-28 16:06:13.622299402 +0300
  356. @@ -24,8 +24,8 @@
  357. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  358. */
  359. -#include "wpe/version.h"
  360. -#include "wpe/version-deprecated.h"
  361. +#include "../include/wpe/version.h"
  362. +#include "../include/wpe/version-deprecated.h"
  363. unsigned
  364. wpe_get_major_version(void)