Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpdecimal: Add version 4.0.0 #25896

Merged
merged 9 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions recipes/mpdecimal/2.5.x/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
sources:
"4.0.0":
sha256: "942445c3245b22730fd41a67a7c5c231d11cb1b9936b9c0f76334fb7d0b4468c"
url: "http://www.bytereef.org/software/mpdecimal/releases/mpdecimal-4.0.0.tar.gz"
"2.5.1":
sha256: "9f9cd4c041f99b5c49ffb7b59d9f12d95b683d88585608aa56a6307667b2b21f"
url: "http://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.5.1.tar.gz"
"2.5.0":
sha256: "15417edc8e12a57d1d9d75fa7e3f22b158a3b98f44db9d694cfd2acde8dfa0ca"
url: "http://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.5.0.tar.gz"
patches:
"4.0.0":
- patch_file: "patches/4.0.0-0001-msvc-fixes.patch"
- patch_file: "patches/4.0.0-0003-use-MPDECIMAL_DLL.patch"
"2.5.1":
- patch_file: "patches/2.5.1-0001-msvc-fixes.patch"
- patch_file: "patches/2.5.1-0002-add-mingw-to-configure-ac.patch"
Expand Down
2 changes: 1 addition & 1 deletion recipes/mpdecimal/2.5.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def package(self):
mpdecppdir = self.build_path / "libmpdec++"
copy(self, "mpdecimal.h", src=mpdecdir, dst=pkg_dir / "include")
if self.options.cxx:
copy(self, "decimal.hh", src=mpdecppdir, dst=pkg_dir / "include")
copy(self, "decimal.hh", src=self.source_path / "libmpdec++", dst=pkg_dir / "include")
Comment on lines 197 to +199
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is weird. For some reason, in the cache folder, most of the the files are symlinks in 4.0.0, but actual files in 2.5.1. So we need to copy from the source folder instead. But this only affects the libmpdec++ folder. In fact, making this change to the libmpdec folder causes the C header to not get packaged. I don't understand any of why this is the case, but it works like this.

Also to note: I'm just being consistent here with the usage of *_path variables, I know they're deprecated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested yet, but I'm hoping the weirdness will go away in the followup cleanup PR.

builddirs = [mpdecdir]
if self.options.cxx:
builddirs.append(mpdecppdir)
Expand Down
97 changes: 97 additions & 0 deletions recipes/mpdecimal/2.5.x/patches/4.0.0-0001-msvc-fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
diff --git a/libmpdec++/Makefile.vc b/libmpdec++/Makefile.vc
index 5985c33..bc2bdac 100644
--- a/libmpdec++/Makefile.vc
+++ b/libmpdec++/Makefile.vc
@@ -14,11 +14,11 @@ LIBIMPORT_CXX = libmpdec++-4.0.0.dll.lib
LIBSHARED_CXX = libmpdec++-4.0.0.dll

!if "$(DEBUG)" == "1"
-OPT = /MTd /Od /Zi /EHsc
-OPT_SHARED = /MDd /Od /Zi /EHsc
+OPT = /Od /Zi /EHsc
+OPT_SHARED = /Od /Zi /EHsc
!else
-OPT = /MT /O2 /GS /EHsc /DNDEBUG
-OPT_SHARED = /MD /O2 /GS /EHsc /DNDEBUG
+OPT = /O2 /GS /EHsc /DNDEBUG
+OPT_SHARED = /O2 /GS /EHsc /DNDEBUG
!endif

!if "$(CC)" == "clang-cl"
@@ -27,9 +27,9 @@ WARN = /W4 -Wno-undefined-inline
WARN = /W4
!endif

-MPD_CXXFLAGS = $(WARN) /nologo $(OPT)
-MPD_CXXFLAGS_SHARED = /DBUILD_LIBMPDECXX $(WARN) /nologo $(OPT_SHARED) $(PGOFLAGS)
-MPD_BIN_CXXFLAGS_SHARED = $(WARN) /nologo $(OPT_SHARED) $(PGOFLAGS)
+MPD_CXXFLAGS = $(WARN) /nologo $(OPT) $(CONAN_CXXFLAGS) $(CONAN_CFLAGS)
+MPD_CXXFLAGS_SHARED = /DBUILD_LIBMPDECXX $(WARN) /nologo $(OPT_SHARED) $(PGOFLAGS) $(CONAN_LDFLAGS)
+MPD_BIN_CXXFLAGS_SHARED = $(WARN) /nologo $(OPT_SHARED) $(PGOFLAGS) $(CONAN_LDFLAGS)
Copy link
Contributor Author

@Ahajha Ahajha Nov 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this section is still necessary, is this 1.x legacy? If so, I can remove from previous versions too. (there are a few other sections like this too)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm removing these sections in my followup PR


MPD_LDXXFLAGS= /DLL /MANIFEST $(LDXXFLAGS)

@@ -42,22 +42,22 @@ OBJS = decimal.obj
SHARED_OBJS = .objs\decimal.obj


-$(LIBSTATIC_CXX): Makefile $(OBJS)
+$(LIBSTATIC_CXX): Makefile.vc $(OBJS)
-@if exist $@ del $(LIBSTATIC_CXX)
lib /out:$(LIBSTATIC_CXX) $(OBJS)

-$(LIBSHARED_CXX): Makefile $(SHARED_OBJS)
+$(LIBSHARED_CXX): Makefile.vc $(SHARED_OBJS)
-@if exist $@ del $(LIBSHARED_CXX)
link $(MPD_LDXXFLAGS) /out:$(LIBSHARED_CXX) /implib:$(LIBIMPORT_CXX) /LIBPATH:$(SRCDIR) $(SHARED_OBJS) $(LIBIMPORT)
mt -manifest $(LIBSHARED_CXX).manifest -outputresource:$(LIBSHARED_CXX);2


decimal.obj:\
-Makefile decimal.cc ..\libmpdec\mpdecimal.h decimal.hh
+Makefile.vc decimal.cc ..\libmpdec\mpdecimal.h decimal.hh
$(CXX) "-I." "-I$(SRCDIR)" $(MPD_CXXFLAGS) -c decimal.cc

.objs\decimal.obj:\
-Makefile decimal.cc ..\libmpdec\mpdecimal.h decimal.hh
+Makefile.vc decimal.cc ..\libmpdec\mpdecimal.h decimal.hh
$(CXX) "-I." "-I$(SRCDIR)" $(MPD_CXXFLAGS_SHARED) -c decimal.cc /Fo.objs\decimal.obj


diff --git a/libmpdec/Makefile.vc b/libmpdec/Makefile.vc
index 7f72a4b..2ee3ddb 100644
--- a/libmpdec/Makefile.vc
+++ b/libmpdec/Makefile.vc
@@ -31,11 +31,11 @@ CONFIG = /DCONFIG_32 /DANSI
!endif

!if "$(DEBUG)" == "1"
-OPT = /MTd /Od /Zi /EHsc
-OPT_SHARED = /MDd /Od /Zi /EHsc
+OPT = /Od /Zi /EHsc
+OPT_SHARED = /Od /Zi /EHsc
!else
-OPT = /MT /O2 /GS /EHsc /DNDEBUG
-OPT_SHARED = /MD /O2 /GS /EHsc /DNDEBUG
+OPT = /O2 /GS /EHsc /DNDEBUG
+OPT_SHARED = /O2 /GS /EHsc /DNDEBUG
!endif

!if "$(CC)" == "clang-cl"
@@ -44,13 +44,13 @@ WARN = /W4 /wd4200 /wd4204 /wd4221 -Wno-unknown-pragmas -Wno-undefined-inline /D
WARN = /W4 /wd4200 /wd4204 /wd4221 /D_CRT_SECURE_NO_WARNINGS
!endif

-MPD_CFLAGS = $(WARN) /nologo $(CONFIG) $(OPT)
-MPD_CFLAGS_SHARED = /DBUILD_LIBMPDEC $(WARN) /nologo $(CONFIG) $(OPT_SHARED) $(PGOFLAGS)
+MPD_CFLAGS = $(WARN) /nologo $(CONFIG) $(OPT) $(CONAN_CFLAGS)
+MPD_CFLAGS_SHARED = /DBUILD_LIBMPDEC $(WARN) /nologo $(CONFIG) $(OPT_SHARED) $(PGOFLAGS) $(CONAN_CFLAGS)

MPD_BIN_CFLAGS = $(WARN) /nologo $(OPT)
MPD_BIN_CFLAGS_SHARED = $(WARN) /nologo $(OPT_SHARED) $(PGOFLAGS)

-MPD_LDFLAGS= /DLL /MANIFEST $(LDFLAGS)
+MPD_LDFLAGS= /DLL /MANIFEST $(LDFLAGS) $(CONAN_LDFLAGS)


default: $(LIBSTATIC) $(LIBSHARED)
39 changes: 39 additions & 0 deletions recipes/mpdecimal/2.5.x/patches/4.0.0-0003-use-MPDECIMAL_DLL.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/libmpdec++/decimal.hh b/libmpdec++/decimal.hh
index 9040290..5e057cb 100644
--- a/libmpdec++/decimal.hh
+++ b/libmpdec++/decimal.hh
@@ -58,7 +58,7 @@
#ifdef _MSC_VER
#if defined (BUILD_LIBMPDECXX)
#define IMPORTEXPORT __declspec(dllexport)
- #elif defined(_DLL)
+ #elif defined(MPDECIMAL_DLL)
#define IMPORTEXPORT __declspec(dllimport)
#else
#define IMPORTEXPORT
diff --git a/libmpdec/mpdecimal32vc.h b/libmpdec/mpdecimal32vc.h
index 6a35951..43e5631 100644
--- a/libmpdec/mpdecimal32vc.h
+++ b/libmpdec/mpdecimal32vc.h
@@ -59,7 +59,7 @@ extern "C" {
#if defined (BUILD_LIBMPDEC)
#undef IMPORTEXPORT
#define IMPORTEXPORT __declspec(dllexport)
-#elif defined(_DLL)
+#elif defined(MPDECIMAL_DLL)
#undef IMPORTEXPORT
#define IMPORTEXPORT __declspec(dllimport)
#endif
diff --git a/libmpdec/mpdecimal64vc.h b/libmpdec/mpdecimal64vc.h
index 9320176..a9944fc 100644
--- a/libmpdec/mpdecimal64vc.h
+++ b/libmpdec/mpdecimal64vc.h
@@ -59,7 +59,7 @@ extern "C" {
#if defined (BUILD_LIBMPDEC)
#undef IMPORTEXPORT
#define IMPORTEXPORT __declspec(dllexport)
-#elif defined(_DLL)
+#elif defined(MPDECIMAL_DLL)
#undef IMPORTEXPORT
#define IMPORTEXPORT __declspec(dllimport)
#endif
2 changes: 2 additions & 0 deletions recipes/mpdecimal/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"4.0.0":
folder: "2.5.x"
"2.5.1":
folder: "2.5.x"
"2.5.0":
Expand Down