Refactor the whole project to improve portability and fix build on OpenBSD - #199
ChihHao-Su wants to merge 4 commits into
Conversation
…dlog flags directly; Give another option for enabling mariadb; Remove linker flags link to libstdc++; Prevent the including of build-tools/grammar-tools/FlexLexer.h on non-windows platform; Remove all '#include <malloc.h>' (this problem also exist in OCESQL); Provide a unified and cross-platform bitswap implementation.
| #define COB_BSWAP_16(val) bitswap16(val) | ||
| #define COB_BSWAP_32(val) bitswap32(val) | ||
| #define COB_BSWAP_64(val) bitswap64(val) |
There was a problem hiding this comment.
What is wrong with the existing one (other than possibly the exact ifdefs)?
There was a problem hiding this comment.
The existing one rely on platform-dependent things, it affects portability. It means you must implement COB_SWAP_XXX for every operating systems, I think it isn't necessary & beneficial for GixSQL to use bitswap function of the OSes.
Infact, this whole PR not only does the adaptation for OpenBSD, but also improves portability.
|
@ChihHao-Su can you please split this PR, moving the bitswap one out to another one? |
| bin_PROGRAMS = gixpp | ||
| gixpp_SOURCES = main.cpp popl.hpp | ||
| gixpp_CXXFLAGS = -std=c++17 -I.. -I $(top_srcdir)/common -I$(top_srcdir)/libcpputils -I$(top_srcdir)/libgixpp -I$(top_srcdir)/build-tools/grammar-tools | ||
| gixpp_CXXFLAGS = -std=c++17 -I.. -I $(top_srcdir)/common -I$(top_srcdir)/libcpputils -I$(top_srcdir)/libgixpp |
There was a problem hiding this comment.
This should have -I$(top_builddir)/libgixpp as penultimate entry (as this is used for out-of-tree builds).
|
|
||
|
|
||
| # Check if the driver ID is valid | ||
| AS_IF([test "$with_default_driver" == "none" || test "$with_default_driver" == "odbc" || test "$with_default_driver" == "mysql" || test "$with_default_driver" == "pgsql" ] || test "$with_default_driver" == "oracle" ] || test "$with_default_driver" == "sqlite" ], |
|
@GitMensch Thank you, I will deal with these issues after a few days; I'm quite busy lately. |
builds 2. Prioritize using the platform's bitswap functions 3. Fix a double quotes problem in configure.ac (mridoni#170)
|
I have solved these problem you mentioned.
Hi, I think it's much better to take this approach: We enumerate some platforms and the way to invoke their bitswap functionality, to use bitswap functionality provide by the target platform first, if target platform is not in the enumerate, we use a self-made bitswap implementation. I've done this. |
Tested on OpenBSD 7.3 and Fedora 41
This pull request has a series of modifications, let me explain:
Change the system-detecting logic (configure.ac)
The original configure.ac rejects configuration if the target system is not one of: windows (cygwin/msys), linux, macos. But, actually, this project has basically nothing platform-dependent. Therefore I modified this area of logic: the script will assume the project is able to build on every systems, it just needs to have some special handling for certain platforms.
Get fmt and spdlog via pkg-config instead of specifing -lfmt and -lspdlog flags directly
The libraries might have different filename than we thought, or inside some other directories. For example, on OpenBSD, some libraries are located in
/usr/local/lib, for them, additional linker flags or compiler flags are needed.Give another option for enabling mariadb
So that users can specify clearly whether he wants
libmysqlclientorlibmariadb.Remove linker flags link to libstdc++
Target platform may not use libstdc++.
Prevent the including of build-tools/grammar-tools/FlexLexer.h on non-windows platform
build-tools/grammar-tools/FlexLexer.h, this file only works with GNU systems's flex. So just useFlexLexer.hof the system's flex.Refactor
yyin.getlineinto two overloadedyyinGetlinefunction (libgixpp/GixEsqlLexer.cpp)In OpenBSD's flex,
yyinis astd::istream*instead of astd::istream.Remove all
#include <malloc.h>This is useless, because there's already
#include <stdlib.h>. And this file is not standard C header, doesn't exist on OpenBSD and some systems.Provide a unified and cross-platform bitswap implementation (
runtime/libgixsql/SqlVar.cpp)To find the bitswap function of every system is troublesome, and you cannot find that on some systems, for example, OpenBSD. Let use a self-implemented one.