Fixed runtime problems of the lib.

This commit is contained in:
Matthias Fechner 2020-11-28 14:57:23 +00:00
parent 58cf2d5921
commit 7c71de28db
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=556494
2 changed files with 34 additions and 25 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= gitlab-pg_query
PORTVERSION= 1.3.0
PORTREVISION= 1
CATEGORIES= databases rubygems
MASTER_SITES= RG
@ -12,13 +13,11 @@ COMMENT= Parses SQL queries using a copy of the PostgreSQL server query parser
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
BUILD_DEPENDS= ${LOCALBASE}/lib/libpg_query.a:databases/libpg_query
MY_DEPENDS= ${LOCALBASE}/lib/libpg_query.a:databases/libpg_query
BUILD_DEPENDS= ${MY_DEPENDS}
RUN_DEPENDS= ${MY_DEPENDS}
USES= gem
USE_RUBY= yes
#CONFIGURE_ARGS= --with-pgsql-include-dir=`${PG_CONFIG} --includedir` \
# --with-pgsql-lib-dir=`${PG_CONFIG} --libdir`
#PG_CONFIG= ${LOCALBASE}/bin/pg_config
.include <bsd.port.mk>

View File

@ -1,8 +1,15 @@
--- ext/pg_query/extconf.rb.orig 2020-11-20 23:41:38 UTC
--- ext/pg_query/extconf.rb.orig 2020-11-21 10:30:23 UTC
+++ ext/pg_query/extconf.rb
@@ -10,22 +10,22 @@ libdir = File.join(workdir, 'libpg_query-' + LIB_PG_QU
@@ -3,44 +3,12 @@
require 'mkmf'
require 'open-uri'
-LIB_PG_QUERY_TAG = 'gitlab-10-1.0.3'.freeze
-
workdir = Dir.pwd
-libdir = File.join(workdir, 'libpg_query-' + LIB_PG_QUERY_TAG)
gemdir = File.join(__dir__, '../..')
libfile = libdir + '/libpg_query.a'
-libfile = libdir + '/libpg_query.a'
-unless File.exist?("#{workdir}/libpg_query.tar.gz")
- File.open("#{workdir}/libpg_query.tar.gz", 'wb') do |target_file|
@ -11,29 +18,32 @@
- end
- end
-end
+#unless File.exist?("#{workdir}/libpg_query.tar.gz")
+# File.open("#{workdir}/libpg_query.tar.gz", 'wb') do |target_file|
+# open("https://gitlab.com/gitlab-org/libpg_query/-/archive/#{LIB_PG_QUERY_TAG}/libpg_query-#{LIB_PG_QUERY_TAG}.tar.gz", 'rb') do |read_file|
+# target_file.write(read_file.read)
+# end
+# end
+#end
+abort "pgquery is missing" unless find_header('pg_query.h')
+abort "pgquery is missing" unless find_library('pg_query', 'pg_query_init')
-unless Dir.exist?(libdir)
- system("tar -xzf #{workdir}/libpg_query.tar.gz") || raise('ERROR')
-end
+#unless Dir.exist?(libdir)
+# system("tar -xzf #{workdir}/libpg_query.tar.gz") || raise('ERROR')
+#end
-
-unless Dir.exist?(libfile)
- # Build libpg_query (and parts of PostgreSQL)
- system("cd #{libdir}; #{ENV['MAKE'] || (RUBY_PLATFORM =~ /bsd/ ? 'gmake' : 'make')} build")
-end
+#unless Dir.exist?(libfile)
+# # Build libpg_query (and parts of PostgreSQL)
+# system("cd #{libdir}; #{ENV['MAKE'] || (RUBY_PLATFORM =~ /bsd/ ? 'gmake' : 'make')} build")
+#end
-
-# Copy test files (this intentionally overwrites existing files!)
-system("cp #{libdir}/testdata/* #{gemdir}/spec/files/")
-
$objs = ['pg_query_ruby.o']
-
-$LOCAL_LIBS << '-lpg_query'
-$LIBPATH << libdir
-$CFLAGS << " -I #{libdir} -O3 -Wall -fno-strict-aliasing -fwrapv -g"
-
-SYMFILE = File.join(__dir__, 'pg_query_ruby.sym')
-if RUBY_PLATFORM =~ /darwin/
- $DLDFLAGS << " -Wl,-exported_symbols_list #{SYMFILE}" unless defined?(::Rubinius)
-else
- $DLDFLAGS << " -Wl,--retain-symbols-file=#{SYMFILE}"
-end
# Copy test files (this intentionally overwrites existing files!)
system("cp #{libdir}/testdata/* #{gemdir}/spec/files/")
create_makefile 'pg_query/pg_query'