public inbox for [email protected]  
help / color / mirror / Atom feed
Windows meson build
2+ messages / 2 participants
[nested] [flat]

* Windows meson build
@ 2024-11-05 06:32 Kohei Harikae (Fujitsu) <[email protected]>
  2024-11-06 19:04 ` Re: Windows meson build Andres Freund <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Kohei Harikae (Fujitsu) @ 2024-11-05 06:32 UTC (permalink / raw)
  To: '[email protected]' <[email protected]>

Hi,

I do not use pkgconf in my Windows environment.
In my Windows environment, I could not build the following OSS with meson.
- 0001 icu
- 0002 libxml
- 0003 libxslt
- 0004 lz4
- 0005 tcl
- 0006 zlib
- 0007 zstd

[1]thread, I created a patch like the one in the attached file, and now I can build.
Would you like to be able to build OSS with Windows meson without using pkgconf?

 [1] https://www.postgresql.org/message-id/flat/CA%2BOCxowQhMHFNRLTsXNuJpC96KRtSPHYKJuOS%3Db-Zrwmy-P4-g%4...

Regards,
Kohei Harikae


Attachments:

  [application/octet-stream] 0003-messon-libxslt.patch (1023B, 2-0003-messon-libxslt.patch)
  download | inline diff:
diff --git a/meson.build b/meson.build
index 9a98f0c86a0..f7ddd75e9ce 100644
--- a/meson.build
+++ b/meson.build
@@ -876,10 +876,17 @@ endif
 
 libxsltopt = get_option('libxslt')
 if not libxsltopt.disabled()
-  libxslt = dependency('libxslt', required: false)
-  # Unfortunately the dependency is named differently with cmake
-  if not libxslt.found() # combine with above once meson 0.60.0 is required
-    libxslt = dependency('LibXslt', required: libxsltopt, method: 'cmake')
+  if host_system != 'windows'
+    libxslt = dependency('libxslt', required: false)
+    # Unfortunately the dependency is named differently with cmake
+    if not libxslt.found() # combine with above once meson 0.60.0 is required
+      libxslt = dependency('LibXslt', required: libxsltopt, method: 'cmake')
+    endif
+  else
+    libxslt = dependency('libxslt', required: false)
+    if not libxslt.found()
+      libxslt = cc.find_library('libxslt', required: libxsltopt, dirs: postgres_lib_d)
+    endif
   endif
 
   if libxslt.found()


  [application/octet-stream] 0004-messon-lz4.patch (1.1K, 3-0004-messon-lz4.patch)
  download | inline diff:
diff --git a/meson.build b/meson.build
index 9a98f0c86a0..e40f95e79d8 100644
--- a/meson.build
+++ b/meson.build
@@ -897,12 +897,19 @@ endif
 
 lz4opt = get_option('lz4')
 if not lz4opt.disabled()
-  lz4 = dependency('liblz4', required: false)
-  # Unfortunately the dependency is named differently with cmake
-  if not lz4.found() # combine with above once meson 0.60.0 is required
-    lz4 = dependency('lz4', required: lz4opt,
-                     method: 'cmake', modules: ['LZ4::lz4_shared'],
-                    )
+  if host_system != 'windows'
+    lz4 = dependency('liblz4', required: false)
+    # Unfortunately the dependency is named differently with cmake
+    if not lz4.found() # combine with above once meson 0.60.0 is required
+      lz4 = dependency('lz4', required: lz4opt,
+                       method: 'cmake', modules: ['LZ4::lz4_shared'],
+                      )
+    endif
+  else
+    lz4 = dependency('liblz4', required: false)
+    if not lz4.found()
+      lz4 = cc.find_library('liblz4', required: lz4opt, dirs: postgres_lib_d)
+    endif
   endif
 
   if lz4.found()


  [application/octet-stream] 0005-messon-tcl.patch (1.1K, 4-0005-messon-tcl.patch)
  download | inline diff:
diff --git a/meson.build b/meson.build
index 9a98f0c86a0..ff51fab280c 100644
--- a/meson.build
+++ b/meson.build
@@ -930,17 +930,24 @@ tcl_version = get_option('tcl_version')
 tcl_dep = not_found_dep
 if not tclopt.disabled()
 
-  # via pkg-config
-  tcl_dep = dependency(tcl_version, required: false)
+  if host_system != 'windows'
+    # via pkg-config
+    tcl_dep = dependency(tcl_version, required: false)
 
-  if not tcl_dep.found()
-    tcl_dep = cc.find_library(tcl_version,
-      required: tclopt,
-      dirs: test_lib_d)
-  endif
+    if not tcl_dep.found()
+      tcl_dep = cc.find_library(tcl_version,
+        required: tclopt,
+        dirs: test_lib_d)
+    endif
 
-  if not cc.has_header('tcl.h', dependencies: tcl_dep, required: tclopt)
-    tcl_dep = not_found_dep
+    if not cc.has_header('tcl.h', dependencies: tcl_dep, required: tclopt)
+      tcl_dep = not_found_dep
+    endif
+  else
+    tcl_dep = dependency(tcl_version, required: false)
+    if not tcl_dep.found()
+      tcl_dep = cc.find_library(tcl_version, required: tclopt, dirs: postgres_lib_d)
+    endif
   endif
 endif
 


  [application/octet-stream] 0006-messon-zlib.patch (661B, 5-0006-messon-zlib.patch)
  download | inline diff:
diff --git a/meson.build b/meson.build
index 9a98f0c86a0..b9f907e808b 100644
--- a/meson.build
+++ b/meson.build
@@ -1470,7 +1470,14 @@ endif
 zlibopt = get_option('zlib')
 zlib = not_found_dep
 if not zlibopt.disabled()
-  zlib_t = dependency('zlib', required: zlibopt)
+  if host_system != 'windows'
+    zlib_t = dependency('zlib', required: zlibopt)
+  else
+    zlib_t = dependency('zlib', required: false)
+    if not zlib_t.found()
+      zlib_t = cc.find_library('zlib', required: zlibopt, dirs: postgres_lib_d)
+    endif
+  endif
 
   if zlib_t.type_name() == 'internal'
     # if fallback was used, we don't need to test if headers are present (they


  [application/octet-stream] 0007-messon-zstd.patch (1.2K, 6-0007-messon-zstd.patch)
  download | inline diff:
diff --git a/meson.build b/meson.build
index 9a98f0c86a0..d302c67a861 100644
--- a/meson.build
+++ b/meson.build
@@ -1523,11 +1523,18 @@ endif
 
 zstdopt = get_option('zstd')
 if not zstdopt.disabled()
-  zstd = dependency('libzstd', required: false, version: '>=1.4.0')
-  # Unfortunately the dependency is named differently with cmake
-  if not zstd.found() # combine with above once meson 0.60.0 is required
-    zstd = dependency('zstd', required: zstdopt, version: '>=1.4.0',
-                      method: 'cmake', modules: ['zstd::libzstd_shared'])
+  if host_system != 'windows'
+    zstd = dependency('libzstd', required: false, version: '>=1.4.0')
+    # Unfortunately the dependency is named differently with cmake
+    if not zstd.found() # combine with above once meson 0.60.0 is required
+      zstd = dependency('zstd', required: zstdopt, version: '>=1.4.0',
+                        method: 'cmake', modules: ['zstd::libzstd_shared'])
+    endif
+  else
+    zstd = dependency('libzstd', required: false, version: '>=1.4.0')
+    if not zstd.found()
+      zstd = cc.find_library('libzstd', required: zstdopt, dirs: postgres_lib_d)
+    endif
   endif
 
   if zstd.found()


  [application/octet-stream] 0002-meson-libxml.patch (1.2K, 7-0002-meson-libxml.patch)
  download | inline diff:
diff --git a/meson.build b/meson.build
index 9a98f0c86a0..9f4ab748023 100644
--- a/meson.build
+++ b/meson.build
@@ -854,13 +854,20 @@ endif
 
 libxmlopt = get_option('libxml')
 if not libxmlopt.disabled()
-  libxml = dependency('libxml-2.0', required: false, version: '>= 2.6.23')
-  # Unfortunately the dependency is named differently with cmake
-  if not libxml.found() # combine with above once meson 0.60.0 is required
-    libxml = dependency('LibXml2', required: libxmlopt, version: '>= 2.6.23',
-      method: 'cmake')
+  if host_system != 'windows'
+    libxml = dependency('libxml-2.0', required: false, version: '>= 2.6.23')
+    # Unfortunately the dependency is named differently with cmake
+    if not libxml.found() # combine with above once meson 0.60.0 is required
+      libxml = dependency('LibXml2', required: libxmlopt, version: '>= 2.6.23',
+        method: 'cmake')
+    endif
+  else
+    libxml = dependency('libxml2', required: false, version: '>= 2.6.23')
+    if not libxml.found()
+       libxml = cc.find_library('libxml2', required: libxmlopt, dirs: postgres_lib_d)
+    endif
   endif
-
+  
   if libxml.found()
     cdata.set('USE_LIBXML', 1)
   endif


  [application/octet-stream] 0001-messon-icu.patch (2.1K, 8-0001-messon-icu.patch)
  download | inline diff:
diff --git a/meson.build b/meson.build
index 9a98f0c86a0..490932ce35b 100644
--- a/meson.build
+++ b/meson.build
@@ -819,19 +819,31 @@ endif
 ###############################################################
 
 icuopt = get_option('icu')
+icu_i18n = not_found_dep
 if not icuopt.disabled()
-  icu = dependency('icu-uc', required: false)
-  if icu.found()
-    icu_i18n = dependency('icu-i18n', required: true)
-  endif
-
-  # Unfortunately the dependency is named differently with cmake
-  if not icu.found() # combine with above once meson 0.60.0 is required
-    icu = dependency('ICU', required: icuopt,
-                     components: ['uc'], modules: ['ICU::uc'], method: 'cmake')
+  if host_system != 'windows'
+    icu = dependency('icu-uc', required: false)
     if icu.found()
-      icu_i18n = dependency('ICU', required: true,
-                            components: ['i18n'], modules: ['ICU::i18n'])
+      icu_i18n = dependency('icu-i18n', required: true)
+    endif
+
+    # Unfortunately the dependency is named differently with cmake
+    if not icu.found() # combine with above once meson 0.60.0 is required
+      icu = dependency('ICU', required: icuopt,
+                       components: ['uc'], modules: ['ICU::uc'], method: 'cmake')
+      if icu.found()
+        icu_i18n = dependency('ICU', required: true,
+                              components: ['i18n'], modules: ['ICU::i18n'])
+      endif
+    endif
+  else
+    icu = dependency('icuuc', required: false)
+    if not icu.found()
+       icu = cc.find_library('icuuc', required: icuopt, dirs: postgres_lib_d)
+    endif
+    icuin = dependency('icuin', required: false)
+    if not icuin.found()
+       icuin = cc.find_library('icuin', required: icuopt, dirs: postgres_lib_d)
     endif
   endif
 
@@ -844,6 +856,7 @@ if not icuopt.disabled()
 else
   icu = not_found_dep
   icu_i18n = not_found_dep
+  icuin = not_found_dep
 endif
 
 
@@ -3070,6 +3083,12 @@ backend_both_deps += [
   zstd,
 ]
 
+if host_system == 'windows'
+  backend_both_deps += [
+    icuin,
+  ]
+endif
+
 backend_mod_deps = backend_both_deps + os_deps
 
 backend_code = declare_dependency(


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Windows meson build
  2024-11-05 06:32 Windows meson build Kohei Harikae (Fujitsu) <[email protected]>
@ 2024-11-06 19:04 ` Andres Freund <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Andres Freund @ 2024-11-06 19:04 UTC (permalink / raw)
  To: Kohei Harikae (Fujitsu) <[email protected]>; +Cc: '[email protected]' <[email protected]>

Hi,

On 2024-11-05 06:32:51 +0000, Kohei Harikae (Fujitsu) wrote:
> I do not use pkgconf in my Windows environment.
> In my Windows environment, I could not build the following OSS with meson.
> - 0001 icu
> - 0002 libxml
> - 0003 libxslt
> - 0004 lz4
> - 0005 tcl
> - 0006 zlib
> - 0007 zstd
> 
> [1]thread, I created a patch like the one in the attached file, and now I can build.
> Would you like to be able to build OSS with Windows meson without using pkgconf?

You can use pkgconf or cmake for the dependencies.  I don't want to add "raw"
dependency handling for every dependency, they each build in too many variants
for that to be a sensible investment of time.


Greetings,

Andres Freund






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-11-06 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-11-05 06:32 Windows meson build Kohei Harikae (Fujitsu) <[email protected]>
2024-11-06 19:04 ` Andres Freund <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox