mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
orm: cross compile pg to linux; openssl: make cross compile work
This commit is contained in:
parent
986ed33deb
commit
27ff2f1628
@ -43,7 +43,9 @@ For a list of all features and fixes, check out the changelog.
|
||||
- [x] Lambdas: `a.sort(|a, b| a > b)`
|
||||
- [ ] Custom attributes
|
||||
- [ ] Contexts that are passed implicitly (e.g. for custom allocation/memory management)
|
||||
- [x] Implicit Veb contexts passed to requests
|
||||
- [ ] Direct C/C++ interop without generating wrappers
|
||||
- [ ] Make ORM work without installing developer libs (libpq-dev etc)
|
||||
|
||||
## [Version 0.6]
|
||||
|
||||
|
@ -12,6 +12,7 @@ $if $pkgconfig('libpq') {
|
||||
#flag -lpq
|
||||
}
|
||||
#flag linux -I/usr/include/postgresql
|
||||
//#flag linux -Ipostgresql // cross compiling to linux
|
||||
|
||||
#flag darwin -I/opt/local/include/postgresql11
|
||||
#flag darwin -L/opt/local/lib/postgresql11
|
||||
@ -32,12 +33,19 @@ $if $pkgconfig('libpq') {
|
||||
#flag freebsd -L/usr/local/lib
|
||||
}
|
||||
|
||||
// PostgreSQL Source Code
|
||||
// https://doxygen.postgresql.org/libpq-fe_8h.html
|
||||
#include <libpq-fe.h>
|
||||
$if cross_compile ? && linux {
|
||||
#include <libpq/libpq-fe.h>
|
||||
#include <libpq/pg_config.h>
|
||||
|
||||
// for PG_VERSION_NUM, which is defined everywhere at least since PG 9.5
|
||||
#include <pg_config.h>
|
||||
//#flag -lpq // libpq.a is located in LINUXROOT/lib/x86_64-linux-gnu/libpq.a
|
||||
} $else {
|
||||
// PostgreSQL Source Code
|
||||
// https://doxygen.postgresql.org/libpq-fe_8h.html
|
||||
#include <libpq-fe.h>
|
||||
|
||||
// for PG_VERSION_NUM, which is defined everywhere at least since PG 9.5
|
||||
#include <pg_config.h>
|
||||
}
|
||||
|
||||
// for orm
|
||||
$if windows {
|
||||
|
@ -1,5 +1,7 @@
|
||||
module openssl
|
||||
|
||||
#define OPENSSL_API_COMPAT 0x30000000L
|
||||
|
||||
// On Linux, prefer a locally built openssl, because it is
|
||||
// much more likely for it to be newer, than the system
|
||||
// openssl from libssl-dev. If there is no local openssl,
|
||||
@ -116,6 +118,8 @@ fn C.SSL_set_cipher_list(ctx &SSL, str &char) int
|
||||
|
||||
fn C.SSL_get_peer_certificate(ssl &SSL) &C.X509
|
||||
|
||||
// fn C.SSL_get1_peer_certificate(ssl &SSL) &C.X509
|
||||
|
||||
fn C.X509_free(const_cert &C.X509)
|
||||
|
||||
fn C.ERR_clear_error()
|
||||
|
@ -105,7 +105,9 @@ pub fn (cflags []CFlag) c_options_without_object_files() []string {
|
||||
pub fn (cflags []CFlag) c_options_only_object_files() []string {
|
||||
mut args := []string{}
|
||||
for flag in cflags {
|
||||
if flag.value.ends_with('.o') || flag.value.ends_with('.obj') {
|
||||
// TODO figure out a better way to copy cross compiling flags to the linker
|
||||
if flag.value.ends_with('.o') || flag.value.ends_with('.obj')
|
||||
|| (flag.name == '-l' && flag.value == 'pq') {
|
||||
args << flag.format()
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +138,11 @@ pub fn (mut p Preferences) fill_with_defaults() {
|
||||
}
|
||||
rpath_name := os.file_name(rpath)
|
||||
p.building_v = !p.is_repl && (rpath_name == 'v' || rpath_name == 'vfmt.v')
|
||||
if p.os == .linux {
|
||||
$if !linux {
|
||||
p.parse_define('cross_compile')
|
||||
}
|
||||
}
|
||||
if p.output_cross_c {
|
||||
// avoid linking any GC related code, since the target may not have an usable GC system
|
||||
p.gc_mode = .no_gc
|
||||
|
Loading…
x
Reference in New Issue
Block a user