[Git][debian-gis-team/tilemaker][master] Added patch to include latomic flag when needed.

ǝɹʇʇɐʃǝ◖ xıʃǝɟ (@xamanu) gitlab at salsa.debian.org
Tue Aug 9 16:23:56 BST 2022



ǝɹʇʇɐʃǝ◖ xıʃǝɟ pushed to branch master at Debian GIS Project / tilemaker


Commits:
92635990 by Felix Delattre at 2022-08-09T15:23:41+00:00
Added patch to include latomic flag when needed.

- - - - -


5 changed files:

- debian/changelog
- debian/patches/0001-Fix-manpage-in-makefiles.patch
- + debian/patches/0002-Check-and-add-latomic.patch
- debian/patches/series
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,8 +1,8 @@
 tilemaker (2.2.0-2) UNRELEASED; urgency=medium
 
-  * Added libatomic for armel, mipsel and powerpc architectures.
+  * Added patch to include latomic flag when needed.
 
- -- Felix Delattre <debian at xama.nu>  Wed, 03 Aug 2022 12:57:08 +0000
+ -- Felix Delattre <debian at xama.nu>  Tue, 09 Aug 2022 15:23:21 +0000
 
 tilemaker (2.2.0-1) unstable; urgency=medium
 


=====================================
debian/patches/0001-Fix-manpage-in-makefiles.patch
=====================================
@@ -1,9 +1,9 @@
 From: Felix Delattre <felix at delattre.de>
 Date: Tue, 2 Aug 2022 22:04:10 +0000
 Subject: Fix manpage in makefile.
+
 Origin: https://github.com/systemed/tilemaker/pull/423/commits/b810fd7102a43840fd60f2fac139ec745a1db5c4
 Bug: https://github.com/systemed/tilemaker/pull/423
-
 ---
  CMakeLists.txt | 1 +
  Makefile       | 4 ++--


=====================================
debian/patches/0002-Check-and-add-latomic.patch
=====================================
@@ -0,0 +1,106 @@
+From: Felix Delattre <felix at delattre.de>
+Date: Mon, 8 Aug 2022 19:18:34 +0000
+Subject: Check and add latomic
+
+Origin: https://github.com/systemed/tilemaker/pull/427/commits/d837f3ac82668d72ffd6877152824405cf6b124e
+Bug: https://github.com/systemed/tilemaker/pull/427
+---
+ CMakeLists.txt             |  7 +++++
+ cmake/CheckCxxAtomic.cmake | 66 ++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 73 insertions(+)
+ create mode 100644 cmake/CheckCxxAtomic.cmake
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 78bfa5c..204f612 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -106,10 +106,17 @@ file(GLOB tilemaker_src_files
+ 	src/tilemaker.cpp
+ 	src/write_geometry.cpp
+   )
++
+ add_executable(tilemaker vector_tile.pb.cc osmformat.pb.cc ${tilemaker_src_files})
+ target_link_libraries(tilemaker ${PROTOBUF_LIBRARY} ${LIBSHP_LIBRARIES} ${SQLITE3_LIBRARIES} ${LUAJIT_LIBRARY} ${LUA_LIBRARIES} ${ZLIB_LIBRARY} ${THREAD_LIB} ${CMAKE_DL_LIBS}
+ 	Boost::system Boost::filesystem Boost::program_options Boost::iostreams)
+ 
++include(CheckCxxAtomic)
++if(NOT HAVE_CXX11_ATOMIC)
++	string(APPEND CMAKE_CXX_STANDARD_LIBRARIES
++	" ${LIBATOMIC_LINK_FLAGS}")
++endif()
++
+ if(MSVC)
+     target_link_libraries(tilemaker unofficial::sqlite3::sqlite3)
+ endif()
+diff --git a/cmake/CheckCxxAtomic.cmake b/cmake/CheckCxxAtomic.cmake
+new file mode 100644
+index 0000000..a4c8a77
+--- /dev/null
++++ b/cmake/CheckCxxAtomic.cmake
+@@ -0,0 +1,66 @@
++# some platforms do not offer support for atomic primitive for all integer
++# types, in that case we need to link against libatomic
++
++include(CheckCXXSourceCompiles)
++include(CMakePushCheckState)
++
++
++function(check_cxx_atomics var)
++  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -std=c++11")
++    check_cxx_source_compiles("
++#include <atomic>
++#include <cstdint>
++#include <cstddef>
++#if defined(__SIZEOF_INT128__)
++// Boost needs 16-byte atomics for tagged pointers.
++// These are implemented via inline instructions on the platform
++// if 16-byte alignment can be proven, and are delegated to libatomic
++// library routines otherwise.  Whether or not alignment is provably
++// OK for a std::atomic unfortunately depends on compiler version and
++// optimization levels, and also on the details of the expression.
++// We specifically test access via an otherwise unknown pointer here
++// to ensure we get the most complex case.  If this access can be
++// done without libatomic, then all accesses can be done.
++struct tagged_ptr {
++  int* ptr;
++  std::size_t tag;
++};
++void atomic16(std::atomic<tagged_ptr> *ptr)
++{
++  tagged_ptr p{nullptr, 1};
++  ptr->store(p);
++  tagged_ptr f = ptr->load();
++  tagged_ptr new_tag{nullptr, 0};
++  ptr->compare_exchange_strong(f, new_tag);
++}
++#endif
++int main() {
++#if defined(__SIZEOF_INT128__)
++  std::atomic<tagged_ptr> ptr;
++  atomic16(&ptr);
++#endif
++  std::atomic<uint8_t> w1;
++  std::atomic<uint16_t> w2;
++  std::atomic<uint32_t> w4;
++  std::atomic<uint64_t> w8;
++  return w1 + w2 + w4 + w8;
++}
++" ${var})
++endfunction(check_cxx_atomics)
++
++cmake_push_check_state()
++check_cxx_atomics(HAVE_CXX11_ATOMIC)
++cmake_pop_check_state()
++
++if(NOT HAVE_CXX11_ATOMIC)
++  cmake_push_check_state()
++  set(CMAKE_REQUIRED_LIBRARIES "atomic")
++  check_cxx_atomics(HAVE_LIBATOMIC)
++  cmake_pop_check_state()
++  if(HAVE_LIBATOMIC)
++    set(LIBATOMIC_LINK_FLAGS "-latomic")
++  else()
++    message(FATAL_ERROR
++      "Host compiler ${CMAKE_CXX_COMPILER} requires libatomic, but it is not found")
++  endif()
++endif()


=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
 0001-Fix-manpage-in-makefiles.patch
+0002-Check-and-add-latomic.patch


=====================================
debian/rules
=====================================
@@ -10,11 +10,7 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 include /usr/share/dpkg/pkg-info.mk
 TM_VERSION := $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//')
 
-ifneq (,$(filter $(DEB_BUILD_ARCH),armel mipsel powerpc))
-    export DEB_CXXFLAGS_MAINT_APPEND=-DTM_VERSION=$(TM_VERSION) -latomic
-else
-    export DEB_CXXFLAGS_MAINT_APPEND=-DTM_VERSION=$(TM_VERSION)
-endif
+export DEB_CXXFLAGS_MAINT_APPEND=-DTM_VERSION=$(TM_VERSION)
 
 %:
 	dh $@ --buildsystem=cmake



View it on GitLab: https://salsa.debian.org/debian-gis-team/tilemaker/-/commit/926359901b9de00b011ba41745386c3b97fa267b

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/tilemaker/-/commit/926359901b9de00b011ba41745386c3b97fa267b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20220809/466a6fb1/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list