Skip to content

Commit

Permalink
rebase patches
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Jun 6, 2023
1 parent 5bba9a2 commit 5a5a205
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 256 deletions.
6 changes: 2 additions & 4 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ source:
- patches/0005-stop-pretending-sp-glue-code-belongs-in-third_party-.patch
# ensure python bindings link to correct libs on windows
- patches/0006-point-to-our-libs-headers-for-windows-in-setup.py.patch
# we don't want to link the msvc runtime statically
- patches/0007-don-t-force-replace-MD-with-MT.patch
# install pkg-config metadata also on windows
- patches/0008-also-install-pkg-config-files-on-windows.patch
- patches/0007-also-install-pkg-config-files-on-windows.patch
# install CMake metadata
- patches/0009-create-and-install-CMake-metadata.patch
- patches/0008-create-and-install-CMake-metadata.patch

build:
number: 0
Expand Down
18 changes: 6 additions & 12 deletions recipe/patches/0001-do-not-mix-static-shared-builds.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 36b084be62cd5f116749cab4cc0de4206555c628 Mon Sep 17 00:00:00 2001
From df7925b506acf44eb3f06ce94e812c8a23f83699 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Thu, 2 Dec 2021 08:39:53 +1100
Subject: [PATCH 1/9] do not mix static & shared builds
Subject: [PATCH 1/8] do not mix static & shared builds

---
src/CMakeLists.txt | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6cb3922..0a7f67e 100644
index 1c7726e..39b0ef2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -202,13 +202,13 @@ endif()
@@ -220,18 +220,18 @@ endif()
if (SPM_ENABLE_SHARED)
add_library(sentencepiece SHARED ${SPM_SRCS})
add_library(sentencepiece_train SHARED ${SPM_TRAIN_SRCS})
Expand All @@ -31,16 +31,13 @@ index 6cb3922..0a7f67e 100644

if (SPM_ENABLE_SHARED)
target_link_libraries(sentencepiece ${SPM_LIBS})
@@ -220,7 +220,7 @@ if (SPM_ENABLE_SHARED)
(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "sh4"))
list(APPEND SPM_LIBS "atomic")
endif()
target_link_libraries(sentencepiece_train ${SPM_LIBS} sentencepiece)
- set(SPM_INSTALLTARGETS sentencepiece sentencepiece_train sentencepiece-static sentencepiece_train-static)
+ set(SPM_INSTALLTARGETS sentencepiece sentencepiece_train)
set_target_properties(sentencepiece sentencepiece_train PROPERTIES SOVERSION 0 VERSION 0.0.0)
set_target_properties(sentencepiece PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS YES)
set_target_properties(sentencepiece_train PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS YES)
@@ -235,10 +235,10 @@ else()
@@ -246,10 +246,10 @@ else()
add_library(sentencepiece ALIAS sentencepiece-static)
add_library(sentencepiece_train ALIAS sentencepiece_train-static)
set(SPM_INSTALLTARGETS sentencepiece-static sentencepiece_train-static)
Expand All @@ -54,6 +51,3 @@ index 6cb3922..0a7f67e 100644

if (NOT MSVC)
if (SPM_COVERAGE)
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 285d03b18e98d013f33106694e963ef8e4c2e7bc Mon Sep 17 00:00:00 2001
From 075ffeaf1de3319784ba18f2b516bb3daf9f8d16 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Thu, 2 Dec 2021 10:05:12 +1100
Subject: [PATCH 2/9] do not build vendored abseil & libprotobuf-lite
Subject: [PATCH 2/8] do not build vendored abseil & libprotobuf-lite

---
CMakeLists.txt | 6 +++---
Expand All @@ -11,10 +11,10 @@ Subject: [PATCH 2/9] do not build vendored abseil & libprotobuf-lite
4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 78379a3..827d114 100644
index 1b3af04..7e40f5c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,9 +57,9 @@ add_definitions(-D_FREEBSD)
@@ -68,9 +68,9 @@ add_definitions(-D_FREEBSD)
endif()

if (SPM_USE_BUILTIN_PROTOBUF)
Expand All @@ -26,7 +26,7 @@ index 78379a3..827d114 100644
endif()

if (MSVC)
@@ -110,7 +110,7 @@ if (SPM_BUILD_TEST)
@@ -147,7 +147,7 @@ if (SPM_BUILD_TEST)
endif()

if (SPM_USE_EXTERNAL_ABSL)
Expand All @@ -36,18 +36,18 @@ index 78379a3..827d114 100644

add_subdirectory(src)
diff --git a/sentencepiece.pc.in b/sentencepiece.pc.in
index ac7fef6..cc9bf78 100644
index 6a5ba56..1108973 100644
--- a/sentencepiece.pc.in
+++ b/sentencepiece.pc.in
@@ -6,5 +6,5 @@ includedir=@includedir@
@@ -6,5 +6,5 @@ includedir=@includedir_for_pc_file@
Name: @PROJECT_NAME@
Description: Unsupervised text tokenizer and detokenizer for Neural Network-based text generation.
Version: @PROJECT_VERSION@
-Libs: -L${libdir} -lsentencepiece -lsentencepiece_train @libprotobuf_lite@ @pkgconfiglibs@
+Libs: -L${libdir} -lsentencepiece -lsentencepiece_train @libprotobuf@ @pkgconfiglibs@
Cflags: -I${includedir} @pkgconfigcflags@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0a7f67e..d4e2ddc 100644
index 39b0ef2..6dfd76d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -69,6 +69,11 @@ if (SPM_USE_BUILTIN_PROTOBUF)
Expand All @@ -72,6 +72,3 @@ index d00ecba..3096702 100644
-
-
+include_directories(darts_clone esaxx)
--
2.38.1.windows.1

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From d275c55621f9fea17a1f07c885235e495f4eae34 Mon Sep 17 00:00:00 2001
From bb0bda21c70a52c388353876a64560b5f6243c7b Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <[email protected]>
Date: Mon, 6 Dec 2021 21:18:54 +1100
Subject: [PATCH 3/9] consistently use absolute paths for CMAKE_INSTALL_*DIR
Subject: [PATCH 3/8] consistently use absolute paths for CMAKE_INSTALL_*DIR

---
CMakeLists.txt | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 827d114..f4f7548 100644
index 7e40f5c..434530a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,11 +40,8 @@ endif()
@@ -51,11 +51,8 @@ endif()

if (UNIX)
include(GNUInstallDirs)
Expand All @@ -25,7 +25,7 @@ index 827d114..f4f7548 100644
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/lib")
@@ -83,15 +80,15 @@ if (APPLE)
@@ -96,15 +93,15 @@ if (APPLE)
endif()

if (NOT DEFINED CMAKE_INSTALL_BINDIR)
Expand All @@ -43,7 +43,4 @@ index 827d114..f4f7548 100644
+ set(CMAKE_INSTALL_INCDIR "${CMAKE_INSTALL_PREFIX}/include")
endif()

configure_file("${PROJECT_SOURCE_DIR}/config.h.in" "config.h")
--
2.38.1.windows.1

# SPDX-License-Identifier: (MIT OR CC0-1.0)
Loading

0 comments on commit 5a5a205

Please sign in to comment.