pganalyze / libpg_query

C library for accessing the PostgreSQL parser outside of the server environment
BSD 3-Clause "New" or "Revised" License
1.21k stars 182 forks source link

Binaries on GitHub Releases? #237

Open karlhorky opened 10 months ago

karlhorky commented 10 months ago

The GitHub releases, eg the 16-5.1.0 release seen below, do not currently have binaries for common platforms like win32-x64, darwin-x64, darwin-arm64, linux-x64, linux-arm64:

Screenshot 2024-01-25 at 12 33 18

Would @pganalyze be open to publishing binaries with releases (eg. as a part of a CI action)?

This would be helpful for projects based on libpg_query, such as the libpg-query npm package by @pyramation and others:

lfittl commented 10 months ago

Would @pganalyze be open to publishing binaries with releases (eg. as a part of a CI action)?

We probably could, since we're already running the test infrastructure on Linux and Windows anyway, and I think we just need to do this conditionally when its a release tag.

That said, the current Windows MSVC makefile generates a static object (.lib), instead of a shared library (.dll). I'm not sure if a downstream user like @pyramation's npm package can use a static object, or requires a DLL?

pyramation commented 10 months ago

That said, the current Windows MSVC makefile generates a static object (.lib), instead of a shared library (.dll). I'm not sure if a downstream user like @pyramation's npm package can use a static object, or requires a DLL?

Before publishing, I have linux and mac covered with .a files:

libpg_query
libpg_query/osx
libpg_query/osx/libpg_query.a
libpg_query/osx/.gitkeep
libpg_query/include
libpg_query/include/.gitkeep
libpg_query/include/pg_query.h
libpg_query/linux
libpg_query/linux/libpg_query.a
libpg_query/linux/.gitkeep
libpg_query/windows
libpg_query/windows/.gitkeep

My process for managing this was

  1. I would build it on mac (outputs osx/libpg_query.a)
  2. run docker, mount volume to same output dir, build on linux (outputs linux/libpg_query.a)
  3. Finally, npm publish after both libpg_query.a files are built in the output libpg_query/ folder

So my guess is, which is a wild guess since I don't use windows, that the build would stick the new file (.lib or other) in the libpg_query/windows folder, and it would hopefully "just work" for windows users

Perhaps if we do this with a CI, my question would be — is there a way to build all three operating systems somehow? My process was doing all three builds then publish. Not sure how to map this properly, but I'm sure we can figure it out!

froque commented 10 months ago

Having the (shared) binaries compiled upstream would be great for us.

I am currently doing a manual cross compilation and persisting the objects to git: https://github.com/premium-minds/sonar-postgres-plugin/blob/master/generate_libpg_query.sh