enabled mysql and ffi in pkgs/hawk.spec.in

This commit is contained in:
hyung-hwan 2021-08-19 19:45:48 +00:00
parent ebdb8cecce
commit c870c6be18
2 changed files with 34 additions and 4 deletions

View File

@ -559,12 +559,12 @@ Socket functions are available.
BEGIN { BEGIN {
mysql = mysql::open(); mysql = mysql::open();
if (mysql::connect(mysql, "10.30.1.219", "pdns", "pdns", "pdns") <= -1) if (mysql::connect(mysql, "192.168.1.1", "mysql", "username", "password") <= -1)
{ {
print "connect error -", mysql::errmsg(); print "connect error -", mysql::errmsg();
} }
if (mysql::query(mysql, "select * from records") <= -1) if (mysql::query(mysql, "select * from user") <= -1)
{ {
print "query error -", mysql::errmsg(); print "query error -", mysql::errmsg();
} }
@ -710,4 +710,32 @@ The following sample illustrates the basic steps hightlighed above.
} }
If you prefer C++, you may use the Hawk/HawkStd wrapper classes to simplify the task. The C++ classes are inferior to the C equivalents in that they don't allow creation of multiple runtime contexts over a single hawk instance. If you prefer C++, you may use the Hawk/HawkStd wrapper classes to simplify the task. The C++ classes are inferior to the C equivalents in that they don't allow creation of multiple runtime contexts over a single hawk instance. Here is the sample code that prints "hello, world":
#include <HawkStd.hpp>
#include <stdio.h>
int main ()
{
HAWK::HawkStd hawk;
if (hawk.open() <= -1)
{
fprintf (stderr, "unable to open hawk - %s\n", hawk.getErrorMessageB());
return -1;
}
HAWK::HawkStd::SourceString s("BEGIN { print \"hello, world\"; }");
if (hawk.parse(s, HAWK::HawkStd::Source::NONE) == HAWK_NULL)
{
fprintf (stderr, "unable to open parse - %s\n", hawk.getErrorMessageB());
hawk.close ();
return -1;
}
HAWK::Hawk::Value vr;
hawk.exec (&vr, HAWK_NULL, 0);
hawk.close ();
return 0;
}

View File

@ -12,7 +12,7 @@ Group: System Environment/Libraries
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
#Requires: #Requires:
BuildRequires: mysql-devel BuildRequires: mysql-devel, libffi-devel
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
%description %description
@ -48,6 +48,8 @@ CFLAGS="${RPM_OPT_FLAGS} -fPIC" CXXFLAGS="${RPM_OPT_FLAGS} -fPIC" ./configure \
--enable-pthread-flags=yes \ --enable-pthread-flags=yes \
--enable-libltdl=no \ --enable-libltdl=no \
--enable-libunwind=no \ --enable-libunwind=no \
--enable-mod-ffi=yes \
--with-mysql=yes \
--enable-mod-mysql=yes \ --enable-mod-mysql=yes \
--enable-mod-uci=no ##CC=gcc44 CXX=g++44 --enable-mod-uci=no ##CC=gcc44 CXX=g++44