diff --git a/README.md b/README.md
index ae13ac49e..c3e760fa8 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Valum is a web micro-framework entirely written in the
```vala
using Valum;
-using VSGI.Soup;
+using VSGI.HTTP;
var app = new Router ();
diff --git a/data/vsgi.pc.in b/data/vsgi.pc.in
index 10870f54b..4f872e11b 100644
--- a/data/vsgi.pc.in
+++ b/data/vsgi.pc.in
@@ -7,7 +7,6 @@ Name: VSGI
Description: Interface and implementations for various web server technologies
URL: https://github.com/valum-framework/valum
Version: @VERSION@
-Requires: glib-2.0 gio-2.0 gthread-2.0 libsoup-2.4
+Requires: glib-2.0 gio-2.0 libsoup-2.4
Libs: -L${libdir} -lvsgi
-Libs.private: -L${libdir} -lfcgi
Cflags: -I${includedir}/vsgi
diff --git a/docs/application.rst b/docs/application.rst
index 6d407220b..ce3ce7f4e 100644
--- a/docs/application.rst
+++ b/docs/application.rst
@@ -14,7 +14,7 @@ a ``using`` statement as they all respect a common interface.
.. code:: vala
using Valum;
- using VSGI.Soup; // or VSGI.FastCGI
+ using VSGI.HTTP; // or VSGI.FastCGI
Many implementations are provided and documented in :doc:`vsgi/server/index`.
@@ -55,8 +55,8 @@ Serving the application
-----------------------
This part is pretty straightforward: you create a server that will serve your
-application at port ``3003`` and since ``using VSGI.Soup`` was specified,
-``Server`` refers to :doc:`vsgi/server/soup`.
+application at port ``3003`` and since ``using VSGI.HTTP`` was specified,
+``Server`` refers to :doc:`vsgi/server/http`.
.. code:: vala
diff --git a/docs/extras/index.rst b/docs/extras/index.rst
deleted file mode 100644
index 25988b4d1..000000000
--- a/docs/extras/index.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-Extras
-======
-
-Extra functionalities for various standards and technologies.
-
-.. toctree::
-
- server-sent-events
diff --git a/docs/getting-started.rst b/docs/getting-started.rst
index c82019839..a056e09a9 100644
--- a/docs/getting-started.rst
+++ b/docs/getting-started.rst
@@ -27,7 +27,7 @@ the latest changes in the framework.
.. code:: vala
using Valum;
- using VSGI.Soup;
+ using VSGI.HTTP;
var app = new Router ();
@@ -48,22 +48,6 @@ pretty much what you think is the best for your needs.
build/
src/
app.vala
- vapi/
- ctpl.vala
- fcgi.vala
-
-VAPI bindings
--------------
-
-`CTPL`_ and `FastCGI`_ are not providing Vala bindings, so you need to copy
-them in your project ``vapi`` folder. They are included in Valum's
-`vapi folder`_ and you can also find more VAPIs in `nemequ/vala-extra-vapis`_
-GitHub repository.
-
-.. _CTPL: http://ctpl.tuxfamily.org
-.. _FastCGI: http://www.fastcgi.com/drupal/
-.. _vapi folder: https://github.com/antono/valum/tree/master/vapi
-.. _nemequ/vala-extra-vapis: https://github.com/nemequ/vala-extra-vapis
Building manually
-----------------
@@ -74,13 +58,13 @@ locations, so this wont be necessary.
.. code-block:: bash
- valac --pkg valum --vapidir=vapi
+ valac --pkg=valum --pkg=vsgi-http --vapidir=vapi
-X -I/usr/local/include/valum -X -lvalum # compiler options
src/app.vala
-o build/app
# if installed in default location /usr
- valac --pkg valum --vapidir=vapi src/app.vala -o build/app
+ valac --pkg=valum --pkg=vsgi-http --vapidir=vapi src/app.vala -o build/app
Building with waf
-----------------
@@ -101,15 +85,15 @@ at the root of your project.
def configure(cfg):
cfg.load('compiler_c vala')
cfg.check_cfg(package='valum', uselib_store='VALUM', args='--libs --cflags')
+ cfg.check_cfg(package='vsgi-http', uselib_store='VSGI_HTTP', args='--libs --cflags')
def build(bld):
bld.load('vala')
bld.program(
- packages = ['valum'],
+ packages = ['valum', 'vsgi-http'],
target = 'app',
source = 'src/app.vala',
- use = 'VALUM'
- vapi_dirs = ['vapi'])
+ use = 'VALUM VSGI_HTTP')
You should now be able to build by issuing the following commands:
@@ -124,7 +108,7 @@ Running the example
VSGI produces process-based applications that are either self-hosted or able to
communicate with a HTTP server according to a standardized protocol.
-The :doc:`vsgi/server/soup` implementation is self-hosting, so you just have to
+The :doc:`vsgi/http/soup` implementation is self-hosting, so you just have to
run it and point your browser at http://127.0.0.1:3003 to see the result.
.. code-block:: bash
diff --git a/docs/recipes/index.rst b/docs/recipes/index.rst
index 3c30805ef..04ca252f4 100644
--- a/docs/recipes/index.rst
+++ b/docs/recipes/index.rst
@@ -6,6 +6,8 @@ their potential integration with Valum.
.. toctree::
+ configuration
json
+ persistence
static-resource
scripting
diff --git a/docs/recipes/persistence.rst b/docs/recipes/persistence.rst
index 9cbefa6e9..a9c2c541c 100644
--- a/docs/recipes/persistence.rst
+++ b/docs/recipes/persistence.rst
@@ -30,7 +30,7 @@ maintained in nemequ/vala-extra-vapis GitHub repository.
.. code:: vala
using Valum;
- using VSGI.Soup;
+ using VSGI.HTTP;
var app = new Router ();
var memcached = new Memcached.Context ();
diff --git a/docs/recipes/scripting.rst b/docs/recipes/scripting.rst
index eb8e927c8..6439d201b 100644
--- a/docs/recipes/scripting.rst
+++ b/docs/recipes/scripting.rst
@@ -20,7 +20,7 @@ Lua
.. code:: vala
using Valum;
- using VSGI.Soup;
+ using VSGI.HTTP;
using Lua;
var app = new Router ();
@@ -41,7 +41,7 @@ Lua
writer.put_string (lua.do_file ("scripts/hello.lua"));
});
- new Soup (app).run ();
+ new Server ("org.valum.example.Lua", app).run ();
The sample Lua script contains:
diff --git a/docs/vsgi/connection.rst b/docs/vsgi/connection.rst
index 75ad9298b..6fc3a0281 100644
--- a/docs/vsgi/connection.rst
+++ b/docs/vsgi/connection.rst
@@ -22,7 +22,7 @@ require the status to be part of the response headers.
.. code::
- using VSGI.Soup;
+ using VSGI.HTTP;
new Server ("org.vsgi.App", (req, res) => {
var message = req.connection.output_stream;
diff --git a/docs/vsgi/index.rst b/docs/vsgi/index.rst
index 9d68ebe8f..6d346f9c7 100644
--- a/docs/vsgi/index.rst
+++ b/docs/vsgi/index.rst
@@ -30,7 +30,7 @@ a :doc:`request` and a :doc:`response`.
.. code:: vala
- using VSGI.Soup;
+ using VSGI.HTTP;
new Server ("org.vsgi.App", (req, res) => {
// process the request and produce the response...
diff --git a/docs/vsgi/server/soup.rst b/docs/vsgi/server/http.rst
similarity index 96%
rename from docs/vsgi/server/soup.rst
rename to docs/vsgi/server/http.rst
index 85fe50420..9569acece 100644
--- a/docs/vsgi/server/soup.rst
+++ b/docs/vsgi/server/http.rst
@@ -1,5 +1,5 @@
-libsoup-2.4 built-in server
-============================
+HTTP
+====
libsoup-2.4 provides a `built-in HTTP server`_ that you can use to test your
application or spawn workers in production.
@@ -9,9 +9,9 @@ application or spawn workers in production.
.. code:: vala
using Valum;
- using VSGI.Soup;
+ using VSGI.HTTP;
- new Server ("org.vsgi.Soup", () => {
+ new Server ("org.vsgi.HTTP", () => {
res.status = Soup.Status.OK;
res.body.write_all ("Hello world!".data, null);
}).run ({"app", "--port", "3003"});
diff --git a/docs/vsgi/server/index.rst b/docs/vsgi/server/index.rst
index 6f2964384..e5880fe2d 100644
--- a/docs/vsgi/server/index.rst
+++ b/docs/vsgi/server/index.rst
@@ -8,7 +8,7 @@ host environment.
.. toctree::
:caption: Table of Contents
- soup
+ http
cgi
fastcgi
scgi
diff --git a/examples/api-interaction/app.vala b/examples/api-interaction/app.vala
index c0acda2d8..b65649260 100644
--- a/examples/api-interaction/app.vala
+++ b/examples/api-interaction/app.vala
@@ -16,7 +16,7 @@
*/
using Valum;
-using VSGI.Soup;
+using VSGI.HTTP;
var app = new Router ();
diff --git a/examples/api-interaction/wscript b/examples/api-interaction/wscript
index e2ff4c125..a242fde86 100644
--- a/examples/api-interaction/wscript
+++ b/examples/api-interaction/wscript
@@ -9,5 +9,4 @@ def build(bld):
target = 'app',
source = 'app.vala',
use = 'valum JSON CTPL',
- vapi_dirs = '../../vapi',
install_path = None)
diff --git a/examples/app/app.vala b/examples/app/app.vala
index 252f36f2a..4ebb1a191 100644
--- a/examples/app/app.vala
+++ b/examples/app/app.vala
@@ -17,7 +17,7 @@
using Valum;
using Valum.ServerSentEvents;
-using VSGI.Soup;
+using VSGI.HTTP;
var app = new Router ();
diff --git a/examples/app/wscript b/examples/app/wscript
index 17454280b..b1eae4aed 100644
--- a/examples/app/wscript
+++ b/examples/app/wscript
@@ -12,5 +12,4 @@ def build(bld):
target = 'app',
source = ['app.vala', 'view.vala', 'app.gresource.xml'],
use = 'valum CTPL GEE',
- vapi_dirs = '../../vapi',
install_path = None)
diff --git a/examples/cgi/wscript b/examples/cgi/wscript
index eb91648ef..fc3095dcb 100644
--- a/examples/cgi/wscript
+++ b/examples/cgi/wscript
@@ -8,5 +8,4 @@ def build(bld):
target = 'cgi-bin/app.cgi',
use = 'valum',
source = ['app.vala'],
- vapi_dirs = '../../vapi',
install_path = None)
diff --git a/examples/fastcgi/wscript b/examples/fastcgi/wscript
index 12a96dfae..cd39db817 100644
--- a/examples/fastcgi/wscript
+++ b/examples/fastcgi/wscript
@@ -8,6 +8,5 @@ def build(bld):
target = 'fastcgi',
use = 'valum',
source = ['app.vala'],
- vapi_dirs = '../../vapi',
install_path = None)
diff --git a/examples/genie/app.gs b/examples/genie/app.gs
index dfb0eb5eb..85ce5feb2 100644
--- a/examples/genie/app.gs
+++ b/examples/genie/app.gs
@@ -4,7 +4,7 @@ init
app.get ("", home)
- new VSGI.Soup.Server ("org.valum.example.Genie", app.handle).run ({"app", "--all"})
+ new VSGI.HTTP.Server ("org.valum.example.Genie", app.handle).run ({"app", "--all"})
def home (req : VSGI.Request, res : VSGI.Response) raises IOError
res.body.write_all ("Hello world!".data, null)
diff --git a/examples/genie/wscript b/examples/genie/wscript
index 28d1181f2..152bbd486 100644
--- a/examples/genie/wscript
+++ b/examples/genie/wscript
@@ -8,5 +8,4 @@ def build(bld):
target = 'app',
source = 'app.gs',
use = 'valum',
- vapi_dirs = '../../vapi',
install_path = None)
diff --git a/examples/json/app.vala b/examples/json/app.vala
index d07c91bc8..04f6f53b0 100644
--- a/examples/json/app.vala
+++ b/examples/json/app.vala
@@ -16,7 +16,7 @@
*/
using Valum;
-using VSGI.Soup;
+using VSGI.HTTP;
var app = new Router ();
diff --git a/examples/json/wscript b/examples/json/wscript
index e44c1d070..2b26e8d32 100644
--- a/examples/json/wscript
+++ b/examples/json/wscript
@@ -9,5 +9,4 @@ def build(bld):
target = 'app',
use = 'valum JSON',
source = 'app.vala',
- vapi_dirs = '../../vapi',
install_path = None)
diff --git a/examples/lua/app.vala b/examples/lua/app.vala
index 49b883d3d..20e2ea833 100644
--- a/examples/lua/app.vala
+++ b/examples/lua/app.vala
@@ -17,7 +17,7 @@
using Lua;
using Valum;
-using VSGI.Soup;
+using VSGI.HTTP;
var app = new Router ();
var vm = new LuaVM ();
diff --git a/examples/lua/wscript b/examples/lua/wscript
new file mode 100644
index 000000000..e31230478
--- /dev/null
+++ b/examples/lua/wscript
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+def configure(cfg):
+ cfg.check_cfg(package='luajit', uselib_store='LUA', args='--cflags --libs')
+
+def build(bld):
+ bld.program(
+ packages = 'lua',
+ target = 'app',
+ source = 'app.vala',
+ use = 'valum LUA',
+ install_path = None)
diff --git a/examples/lua/wscript_build b/examples/lua/wscript_build
deleted file mode 100644
index ae8053b6c..000000000
--- a/examples/lua/wscript_build
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env python
-
-bld.program(
- packages = ['glib-2.0', 'libsoup-2.4', 'lua'],
- target = 'app',
- source = 'app.vala',
- use = 'valum',
- uselib = ['GLIB', 'CTPL', 'GEE', 'SOUP', 'LUA', 'GCOV'],
- vapi_dirs = ['../../vapi'],
- install_path = None)
diff --git a/examples/lua/wscript_configure b/examples/lua/wscript_configure
deleted file mode 100644
index 480a48055..000000000
--- a/examples/lua/wscript_configure
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env python
-
-conf.check_cfg(package='luajit', uselib_store='LUA', args='--cflags --libs')
diff --git a/examples/markdown/app.vala b/examples/markdown/app.vala
index cd82cad22..3dfb8b871 100644
--- a/examples/markdown/app.vala
+++ b/examples/markdown/app.vala
@@ -1,6 +1,6 @@
using Markdown;
using Valum;
-using VSGI.Soup;
+using VSGI.HTTP;
var app = new Router ();
diff --git a/examples/markdown/wscript b/examples/markdown/wscript
index 97726bd7d..7c5240849 100644
--- a/examples/markdown/wscript
+++ b/examples/markdown/wscript
@@ -9,5 +9,5 @@ def build(bld):
target = 'app',
source = 'app.vala',
use = 'valum MARKDOWN',
- vapi_dirs = ['vapi', '../../vapi'],
+ vapi_dirs = 'vapi',
install_path = None)
diff --git a/examples/memcached/app.vala b/examples/memcached/app.vala
index 70d42865a..067f19cee 100644
--- a/examples/memcached/app.vala
+++ b/examples/memcached/app.vala
@@ -16,7 +16,7 @@
*/
using Valum;
-using VSGI.Soup;
+using VSGI.HTTP;
var app = new Router ();
var memcached = new Memcached.Context.from_configuration ("--SERVER=localhost".data);
diff --git a/examples/memcached/wscript b/examples/memcached/wscript
index f28b41d59..6114a217a 100644
--- a/examples/memcached/wscript
+++ b/examples/memcached/wscript
@@ -9,5 +9,5 @@ def build(bld):
target = 'app',
source = 'app.vala',
use = 'valum MEMCACHED',
- vapi_dirs = ['vapi', '../../vapi'],
+ vapi_dirs = 'vapi',
install_path = None)
diff --git a/examples/scgi/wscript b/examples/scgi/wscript
index 16f0ecb11..843fd64a0 100644
--- a/examples/scgi/wscript
+++ b/examples/scgi/wscript
@@ -7,6 +7,5 @@ def build(bld):
bld.program(
target = 'app',
use = 'valum',
- source = ['app.vala'],
- vapi_dirs = '../../vapi',
+ source = 'app.vala',
install_path = None)
diff --git a/src/valum-negociate.vala b/src/valum/valum-negociate.vala
similarity index 100%
rename from src/valum-negociate.vala
rename to src/valum/valum-negociate.vala
diff --git a/src/valum-route.vala b/src/valum/valum-route.vala
similarity index 100%
rename from src/valum-route.vala
rename to src/valum/valum-route.vala
diff --git a/src/valum-router.vala b/src/valum/valum-router.vala
similarity index 100%
rename from src/valum-router.vala
rename to src/valum/valum-router.vala
diff --git a/src/valum-server-sent-events.vala b/src/valum/valum-server-sent-events.vala
similarity index 100%
rename from src/valum-server-sent-events.vala
rename to src/valum/valum-server-sent-events.vala
diff --git a/src/valum-status.vala b/src/valum/valum-status.vala
similarity index 100%
rename from src/valum-status.vala
rename to src/valum/valum-status.vala
diff --git a/src/valum-subdomain.vala b/src/valum/valum-subdomain.vala
similarity index 100%
rename from src/valum-subdomain.vala
rename to src/valum/valum-subdomain.vala
diff --git a/src/valum.vala b/src/valum/valum.vala
similarity index 100%
rename from src/valum.vala
rename to src/valum/valum.vala
diff --git a/src/valum/wscript b/src/valum/wscript
new file mode 100644
index 000000000..dfe50c25b
--- /dev/null
+++ b/src/valum/wscript
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+
+def configure(cfg):
+ pass
+
+def build(bld):
+ from waflib import Context
+ bld.shlib(
+ target = 'valum',
+ gir = 'Valum-{}'.format(Context.g_module.API_VERSION),
+ source = bld.path.ant_glob('*.vala'),
+ use = 'vsgi',
+ header_path = '${INCLUDEDIR}/valum',
+ install_path = '${LIBDIR}')
+
diff --git a/src/vsgi-cgi/vsgi-cgi.pc.in b/src/vsgi-cgi/vsgi-cgi.pc.in
new file mode 100644
index 000000000..f30aff99f
--- /dev/null
+++ b/src/vsgi-cgi/vsgi-cgi.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: VSGI.CGI
+Description: CGI implementation for VSGI
+URL: https://github.com/valum-framework/valum
+Version: @VERSION@
+Libs: -L${libdir} -lvsgi-cgi
+Cflags: -I${includedir}/vsgi
diff --git a/src/vsgi-cgi.vala b/src/vsgi-cgi/vsgi-cgi.vala
similarity index 98%
rename from src/vsgi-cgi.vala
rename to src/vsgi-cgi/vsgi-cgi.vala
index 07e60b840..4399d4bd7 100644
--- a/src/vsgi-cgi.vala
+++ b/src/vsgi-cgi/vsgi-cgi.vala
@@ -142,7 +142,7 @@ namespace VSGI.CGI {
protected override uint8[]? build_head () {
var head = new StringBuilder ();
- head.append_printf ("Status: %u %s\r\n", status, global::Soup.Status.get_phrase (status));
+ head.append_printf ("Status: %u %s\r\n", status, Status.get_phrase (status));
this.headers.foreach ((k, v) => {
head.append_printf ("%s: %s\r\n", k, v);
diff --git a/src/vsgi-cgi/wscript b/src/vsgi-cgi/wscript
new file mode 100644
index 000000000..5c76aa5f4
--- /dev/null
+++ b/src/vsgi-cgi/wscript
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+def configure(cfg):
+ cfg.check_cfg(package='gio-unix-2.0', atleast_version='2.32', uselib_store='GIOUNIX', args='--cflags --libs')
+
+def build(bld):
+ from waflib import Context
+ bld.shlib(
+ packages = 'gio-unix-2.0',
+ target = 'vsgi-cgi',
+ gir = 'VSGI.CGI-{}'.format(Context.g_module.API_VERSION),
+ source = 'vsgi-cgi.vala',
+ use = 'vsgi GIOUNIX',
+ header_path = '${INCLUDEDIR}/vsgi',
+ install_path = '${LIBDIR}')
+
+ bld(
+ features = 'subst',
+ target = 'vsgi-cgi.pc',
+ source = 'vsgi-cgi.pc.in',
+ install_path = '${LIBDIR}/pkgconfig',
+ VERSION = Context.g_module.VERSION,
+ API_VERSION = Context.g_module.API_VERSION)
+
diff --git a/vapi/fcgi.deps b/src/vsgi-fastcgi/fcgi.deps
similarity index 100%
rename from vapi/fcgi.deps
rename to src/vsgi-fastcgi/fcgi.deps
diff --git a/vapi/fcgi.vapi b/src/vsgi-fastcgi/fcgi.vapi
similarity index 100%
rename from vapi/fcgi.vapi
rename to src/vsgi-fastcgi/fcgi.vapi
diff --git a/src/vsgi-fastcgi/vsgi-fastcgi.pc.in b/src/vsgi-fastcgi/vsgi-fastcgi.pc.in
new file mode 100644
index 000000000..ce9f2f46d
--- /dev/null
+++ b/src/vsgi-fastcgi/vsgi-fastcgi.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: VSGI.FastCGI
+Description: FastCGI implementation of VSGI
+Requires: vsgi gthread-2.0
+Libs: -L${libdir} -lvsgi-fastcgi
+Libs.private: -L${libdir} -lfcgi
+Cflags: -I${includedir}/vsgi
diff --git a/src/vsgi-fastcgi.vala b/src/vsgi-fastcgi/vsgi-fastcgi.vala
similarity index 96%
rename from src/vsgi-fastcgi.vala
rename to src/vsgi-fastcgi/vsgi-fastcgi.vala
index 70791cc6a..a603a20b8 100644
--- a/src/vsgi-fastcgi.vala
+++ b/src/vsgi-fastcgi/vsgi-fastcgi.vala
@@ -16,9 +16,15 @@
*/
using GLib;
-using FastCGI;
using Soup;
+#if INCLUDE_TYPE_MODULE
+[ModuleInit]
+public Type plugin_init (TypeModule type_module) {
+ return typeof (VSGI.FastCGI.Server);
+}
+#endif
+
/**
* FastCGI implementation of VSGI.
*
@@ -264,7 +270,7 @@ namespace VSGI.FastCGI {
#if GIO_2_40
if (options.contains ("socket")) {
var socket_path = options.lookup_value ("socket", VariantType.BYTESTRING).get_bytestring ();
- this.socket = new GLib.Socket.from_fd (open_socket (socket_path, backlog));
+ this.socket = new GLib.Socket.from_fd (global::FastCGI.open_socket (socket_path, backlog));
if (!this.socket.is_connected ()) {
command_line.printerr ("could not open socket path %s\n", socket_path);
@@ -276,7 +282,7 @@ namespace VSGI.FastCGI {
else if (options.contains ("port")) {
var port = ":%d".printf(options.lookup_value ("port", VariantType.INT32).get_int32 ());
- this.socket = new GLib.Socket.from_fd (open_socket (port, backlog));
+ this.socket = new GLib.Socket.from_fd (global::FastCGI.open_socket (port, backlog));
if (!this.socket.is_connected ()) {
command_line.printerr ("could not open TCP socket at port %s\n", port);
diff --git a/src/vsgi-fastcgi/wscript b/src/vsgi-fastcgi/wscript
new file mode 100644
index 000000000..b7be7cb3b
--- /dev/null
+++ b/src/vsgi-fastcgi/wscript
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+def configure(cfg):
+ cfg.check(lib='fcgi', uselib_store='FCGI', args='--cflags --libs')
+
+def build(bld):
+ from waflib import Context
+ bld.shlib(
+ packages = 'fcgi',
+ target = 'vsgi-fastcgi',
+ gir = 'VSGI.FastCGI-{}'.format(Context.g_module.API_VERSION),
+ source = 'vsgi-fastcgi.vala',
+ use = 'vsgi vsgi-cgi FCGI',
+ vala_define = 'INCLUDE_TYPE_MODULE',
+ vapi_dirs = '.',
+ header_path = '${INCLUDEDIR}/vsgi',
+ install_path = '${LIBDIR}')
+
+ bld(
+ features = 'subst',
+ target = 'vsgi-fastcgi.pc',
+ source = 'vsgi-fastcgi.pc.in',
+ install_path = '${LIBDIR}/pkgconfig',
+ VERSION = Context.g_module.VERSION,
+ API_VERSION = Context.g_module.API_VERSION)
+
+ bld.install_files('${DATADIR}/vala/vapi', 'fcgi.deps fcgi.vapi')
diff --git a/src/vsgi-http/vsgi-http.pc.in b/src/vsgi-http/vsgi-http.pc.in
new file mode 100644
index 000000000..1937010ee
--- /dev/null
+++ b/src/vsgi-http/vsgi-http.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: VSGI.HTTP
+Description: Implementation of VSGI based on libsoup-2.4
+Requires: vsgi
+Libs: -L${libdir} -lvsgi-http
+Cflags: -I${includedir}/vsgi
diff --git a/src/vsgi-soup.vala b/src/vsgi-http/vsgi-http.vala
similarity index 90%
rename from src/vsgi-soup.vala
rename to src/vsgi-http/vsgi-http.vala
index 81f26c93e..b5029b9df 100644
--- a/src/vsgi-soup.vala
+++ b/src/vsgi-http/vsgi-http.vala
@@ -18,18 +18,25 @@
using GLib;
using Soup;
+#if INCLUDE_TYPE_MODULE
+[ModuleInit]
+public Type plugin_init (TypeModule type_module) {
+ return typeof (VSGI.HTTP.Server);
+}
+#endif
+
/**
- * Soup implementation of VSGI.
+ * HTTP implementation of VSGI.
*
* @since 0.1
*/
-[CCode (gir_namespace = "VSGI.Soup", gir_version = "0.2")]
-namespace VSGI.Soup {
+[CCode (gir_namespace = "VSGI.HTTP", gir_version = "0.2")]
+namespace VSGI.HTTP {
#if !SOUP_2_50
private class MessageBodyOutputStream : OutputStream {
- public global::Soup.MessageBody message_body { construct; get; }
+ public MessageBody message_body { construct; get; }
public MessageBodyOutputStream (MessageBody message_body) {
Object (message_body: message_body);
@@ -207,7 +214,7 @@ namespace VSGI.Soup {
*/
public class Server : VSGI.Server {
- private global::Soup.Server server;
+ private Soup.Server server;
/**
* {@inheritDoc}
@@ -276,29 +283,29 @@ namespace VSGI.Soup {
return 1;
}
#endif
- this.server = new global::Soup.Server (
+ this.server = new Soup.Server (
#if !SOUP_2_48
- global::Soup.SERVER_PORT, port,
+ SERVER_PORT, port,
#endif
- global::Soup.SERVER_RAW_PATHS, options.contains ("raw-paths"),
+ SERVER_RAW_PATHS, options.contains ("raw-paths"),
#if SOUP_2_38
- global::Soup.SERVER_TLS_CERTIFICATE, tls_certificate,
+ SERVER_TLS_CERTIFICATE, tls_certificate,
#else
- global::Soup.SERVER_SSL_CERT_FILE, options.lookup_value ("ssl-cert-file", VariantType.BYTESTRING).get_bytestring (),
- global::Soup.SERVER_SSL_KEY_FILE, options.lookup_value ("ssl-key-file", VariantType.BYTESTRING).get_bytestring (),
+ SERVER_SSL_CERT_FILE, options.lookup_value ("ssl-cert-file", VariantType.BYTESTRING).get_bytestring (),
+ SERVER_SSL_KEY_FILE, options.lookup_value ("ssl-key-file", VariantType.BYTESTRING).get_bytestring (),
#endif
- global::Soup.SERVER_SERVER_HEADER, null);
+ SERVER_SERVER_HEADER, null);
} else
#endif
{
- this.server = new global::Soup.Server (
+ this.server = new Soup.Server (
#if !SOUP_2_48
- global::Soup.SERVER_PORT, port,
+ SERVER_PORT, port,
#endif
#if GIO_2_40
- global::Soup.SERVER_RAW_PATHS, options.contains ("raw-paths"),
+ SERVER_RAW_PATHS, options.contains ("raw-paths"),
#endif
- global::Soup.SERVER_SERVER_HEADER, null);
+ SERVER_SERVER_HEADER, null);
}
#if GIO_2_40
@@ -310,7 +317,7 @@ namespace VSGI.Soup {
this.server.add_handler (null, (server, msg, path, query, client) => {
#if SOUP_2_50
var connection = client.steal_connection ();
- msg.set_status (global::Soup.Status.OK);
+ msg.set_status (Status.OK);
msg.response_headers.replace ("Connection", "close");
#else
var connection = new Connection (server, msg);
@@ -378,9 +385,9 @@ namespace VSGI.Soup {
private InputStream _input_stream;
private OutputStream _output_stream;
- public global::Soup.Server server { construct; get; }
+ public Soup.Server server { construct; get; }
- public global::Soup.Message message { construct; get; }
+ public Message message { construct; get; }
public override InputStream input_stream {
get {
@@ -401,7 +408,7 @@ namespace VSGI.Soup {
* until the connection lives
* @param message message wrapped to provide the IOStream
*/
- public Connection (global::Soup.Server server, global::Soup.Message message) {
+ public Connection (Soup.Server server, Message message) {
Object (server: server, message: message);
this._input_stream = new MemoryInputStream.from_data (message.request_body.flatten ().data, null);
diff --git a/src/vsgi-http/wscript b/src/vsgi-http/wscript
new file mode 100644
index 000000000..547e9e254
--- /dev/null
+++ b/src/vsgi-http/wscript
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+def configure(cfg):
+ pass
+
+def build(bld):
+ from waflib import Context
+ bld.shlib(
+ target = 'vsgi-http',
+ gir = 'VSGI.HTTP-{}'.format(Context.g_module.API_VERSION),
+ source = 'vsgi-http.vala',
+ use = 'vsgi',
+ vala_define = 'INCLUDE_TYPE_MODULE',
+ header_path = '${INCLUDEDIR}/vsgi',
+ install_path = '${LIBDIR}')
+
+ bld(
+ features = 'subst',
+ target = 'vsgi-http.pc',
+ source = 'vsgi-http.pc.in',
+ install_path = '${LIBDIR}/pkgconfig',
+ VERSION = Context.g_module.VERSION,
+ API_VERSION = Context.g_module.API_VERSION)
+
diff --git a/src/vsgi-mock/vsgi-mock.pc.in b/src/vsgi-mock/vsgi-mock.pc.in
new file mode 100644
index 000000000..05723c828
--- /dev/null
+++ b/src/vsgi-mock/vsgi-mock.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: VSGI.Mock
+Description: Mocked implementation of VSGI for testing purposes
+URL: https://github.com/valum-framework/valum
+Version: @VERSION@
+Libs: -L${libdir} -lvsgi-mock
+Cflags: -I${includedir}/vsgi
diff --git a/tests/vsgi-test.vala b/src/vsgi-mock/vsgi-mock.vala
similarity index 96%
rename from tests/vsgi-test.vala
rename to src/vsgi-mock/vsgi-mock.vala
index 6b7ce3a75..8856b9f36 100644
--- a/tests/vsgi-test.vala
+++ b/src/vsgi-mock/vsgi-mock.vala
@@ -19,14 +19,14 @@ using GLib;
using Soup;
/**
- * Test implementation of VSGI.
+ * Mock implementation of VSGI used for testing purposes.
*/
-namespace VSGI.Test {
+namespace VSGI.Mock {
/**
* Stubbed connection with in-memory streams.
*
- * The typical use case is to create a {@link VSGI.Test.Request} with a
+ * The typical use case is to create a {@link VSGI.Mock.Request} with a
* stubbed connection so that the produced and consumed messages can be
* easily inspected.
*/
diff --git a/src/vsgi-mock/wscript b/src/vsgi-mock/wscript
new file mode 100644
index 000000000..78f74efd4
--- /dev/null
+++ b/src/vsgi-mock/wscript
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+def configure(cfg):
+ pass
+
+def build(bld):
+ from waflib import Context
+ bld.shlib(
+ target = 'vsgi-mock',
+ gir = 'VSGI.Mock-{}'.format(Context.g_module.API_VERSION),
+ source = 'vsgi-mock.vala',
+ use = 'vsgi',
+ header_path = '${INCLUDEDIR}/vsgi',
+ install_path = '${LIBDIR}')
+
+ bld(
+ features = 'subst',
+ target = 'vsgi-mock.pc',
+ source = 'vsgi-mock.pc.in',
+ install_path = '${LIBDIR}/pkgconfig',
+ VERSION = Context.g_module.VERSION,
+ API_VERSION = Context.g_module.API_VERSION)
+
diff --git a/src/vsgi-scgi/vsgi-scgi.pc.in b/src/vsgi-scgi/vsgi-scgi.pc.in
new file mode 100644
index 000000000..be7f04b00
--- /dev/null
+++ b/src/vsgi-scgi/vsgi-scgi.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: VSGI.SCGI
+Description: SCGI implementation of VSGI
+Requires: vsgi
+Libs: -L${libdir} -lvsgi-scgi
+Cflags: -I${includedir}/vsgi
diff --git a/src/vsgi-scgi.vala b/src/vsgi-scgi/vsgi-scgi.vala
similarity index 98%
rename from src/vsgi-scgi.vala
rename to src/vsgi-scgi/vsgi-scgi.vala
index 7611980bc..4ccd0c0de 100644
--- a/src/vsgi-scgi.vala
+++ b/src/vsgi-scgi/vsgi-scgi.vala
@@ -17,6 +17,13 @@
using GLib;
+#if INCLUDE_TYPE_MODULE
+[ModuleInit]
+public Type plugin_init (TypeModule type_module) {
+ return typeof (VSGI.SCGI.Server);
+}
+#endif
+
/**
* SCGI implementation of VSGI.
*
diff --git a/src/vsgi-scgi/wscript b/src/vsgi-scgi/wscript
new file mode 100644
index 000000000..c10c456ee
--- /dev/null
+++ b/src/vsgi-scgi/wscript
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+def configure(cfg):
+ pass
+
+def build(bld):
+ from waflib import Context
+ bld.shlib(
+ target = 'vsgi-scgi',
+ gir = 'VSGI.SCGI-{}'.format(Context.g_module.API_VERSION),
+ source = 'vsgi-scgi.vala',
+ use = 'vsgi vsgi-cgi',
+ vala_define = 'INCLUDE_TYPE_MODULE',
+ header_path = '${INCLUDEDIR}/vsgi',
+ install_path = '${LIBDIR}')
+
+ bld(
+ features = 'subst',
+ target = 'vsgi-scgi.pc',
+ source = 'vsgi-scgi.pc.in',
+ install_path = '${LIBDIR}/pkgconfig',
+ VERSION = Context.g_module.VERSION,
+ API_VERSION = Context.g_module.API_VERSION)
diff --git a/src/vsgi-chunked-encoder.vala b/src/vsgi/vsgi-chunked-encoder.vala
similarity index 100%
rename from src/vsgi-chunked-encoder.vala
rename to src/vsgi/vsgi-chunked-encoder.vala
diff --git a/src/vsgi-converted-request.vala b/src/vsgi/vsgi-converted-request.vala
similarity index 100%
rename from src/vsgi-converted-request.vala
rename to src/vsgi/vsgi-converted-request.vala
diff --git a/src/vsgi-converted-response.vala b/src/vsgi/vsgi-converted-response.vala
similarity index 100%
rename from src/vsgi-converted-response.vala
rename to src/vsgi/vsgi-converted-response.vala
diff --git a/src/vsgi-cookies.vala b/src/vsgi/vsgi-cookies.vala
similarity index 100%
rename from src/vsgi-cookies.vala
rename to src/vsgi/vsgi-cookies.vala
diff --git a/src/vsgi-filtered-request.vala b/src/vsgi/vsgi-filtered-request.vala
similarity index 100%
rename from src/vsgi-filtered-request.vala
rename to src/vsgi/vsgi-filtered-request.vala
diff --git a/src/vsgi-filtered-response.vala b/src/vsgi/vsgi-filtered-response.vala
similarity index 100%
rename from src/vsgi-filtered-response.vala
rename to src/vsgi/vsgi-filtered-response.vala
diff --git a/src/vsgi-request.vala b/src/vsgi/vsgi-request.vala
similarity index 100%
rename from src/vsgi-request.vala
rename to src/vsgi/vsgi-request.vala
diff --git a/src/vsgi-response.vala b/src/vsgi/vsgi-response.vala
similarity index 100%
rename from src/vsgi-response.vala
rename to src/vsgi/vsgi-response.vala
diff --git a/src/vsgi-server.vala b/src/vsgi/vsgi-server.vala
similarity index 100%
rename from src/vsgi-server.vala
rename to src/vsgi/vsgi-server.vala
diff --git a/src/vsgi.vala b/src/vsgi/vsgi.vala
similarity index 100%
rename from src/vsgi.vala
rename to src/vsgi/vsgi.vala
diff --git a/src/vsgi/wscript b/src/vsgi/wscript
new file mode 100644
index 000000000..a5121a6fc
--- /dev/null
+++ b/src/vsgi/wscript
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+def configure(cfg):
+ cfg.check_cfg(package='glib-2.0', atleast_version='2.32', uselib_store='GLIB', args='--cflags --libs')
+ cfg.check_cfg(package='gio-2.0', atleast_version='2.32', uselib_store='GIO', args='--cflags --libs')
+ cfg.check_cfg(package='libsoup-2.4', atleast_version='2.38',uselib_store='SOUP', args='--cflags --libs')
+
+ # glib (>=2.38) to enable subprocess in tests
+ if cfg.check_cfg(package='glib-2.0', atleast_version='2.38', mandatory=False, uselib_store='GLIB', args='--cflags --libs'):
+ cfg.env.append_unique('VALAFLAGS', ['--define=GIO_2_38'])
+
+ # gio (>=2.34) is necessary for ApplicationCommandLine.get_stdin
+ if cfg.check_cfg(package='gio-2.0', atleast_version='2.34', mandatory=False, uselib_store='GIO', args='--cflags --libs'):
+ cfg.env.append_unique('VALAFLAGS', ['--define=GIO_2_34'])
+
+ # gio (>=2.40) is necessary for CLI arguments parsing
+ if cfg.check_cfg(package='gio-2.0', atleast_version='2.40', mandatory=False, uselib_store='GIO', args='--cflags --libs'):
+ cfg.env.append_unique('VALAFLAGS', ['--define=GIO_2_40'])
+
+ # gio (>=2.44) is necessary for 'write_all_async' and 'strv_contains'
+ if cfg.check_cfg(package='gio-2.0', atleast_version='2.44', mandatory=False, uselib_store='GIO', args='--cflags --libs'):
+ cfg.env.append_unique('VALAFLAGS', ['--define=GIO_2_44'])
+
+ # libsoup (>=2.38) to support TLS certificate
+ if cfg.check_cfg(package='libsoup-2.4', atleast_version='2.38', mandatory=False, uselib_store='SOUP', args='--cflags --libs'):
+ cfg.env.append_unique('VALAFLAGS', ['--define=SOUP_2_38'])
+
+ # libsoup (>=2.48) is necessary for the new server API
+ if cfg.check_cfg(package='libsoup-2.4', atleast_version='2.48', mandatory=False, uselib_store='SOUP', args='--cflags --libs'):
+ cfg.env.append_unique('VALAFLAGS', ['--define=SOUP_2_48'])
+
+ # libsoup (>=2.50) for steal_connection
+ if cfg.check_cfg(package='libsoup-2.4', atleast_version='2.50', mandatory=False, uselib_store='SOUP', args='--cflags --libs'):
+ cfg.env.append_unique('VALAFLAGS', ['--define=SOUP_2_50'])
+
+def build(bld):
+ from waflib import Context
+ bld.shlib(
+ packages = ['glib-2.0', 'gio-2.0', 'libsoup-2.4'],
+ target = 'vsgi',
+ gir = 'VSGI-{}'.format(Context.g_module.API_VERSION),
+ source = bld.path.ant_glob('*.vala'),
+ use = ['GLIB', 'GIO', 'SOUP'],
+ header_path = '${INCLUDEDIR}/vsgi',
+ install_path = '${LIBDIR}')
+
diff --git a/src/wscript b/src/wscript
new file mode 100644
index 000000000..66a16b376
--- /dev/null
+++ b/src/wscript
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+def configure(cfg):
+ cfg.recurse('vsgi valum')
+ cfg.recurse('vsgi-http vsgi-cgi vsgi-scgi vsgi-fastcgi vsgi-mock')
+
+def build(bld):
+ bld.recurse('vsgi valum')
+ bld.recurse('vsgi-http vsgi-cgi vsgi-scgi vsgi-fastcgi vsgi-mock')
+
+ # static bundle for tests and examples
+ bld.stlib(
+ packages = 'glib-2.0 gio-2.0 gio-unix-2.0 libsoup-2.4 fcgi',
+ target = 'valum',
+ source = bld.path.ant_glob('**/*.vala'),
+ use = 'GLIB GIO GIOUNIX SOUP FCGI GCOV',
+ vapi_dirs = 'vsgi-fastcgi',
+ install_binding = False,
+ header_path = None,
+ install_path = None)
diff --git a/tests/cgi-test.vala b/tests/cgi-test.vala
index 071afc48c..6b7838782 100644
--- a/tests/cgi-test.vala
+++ b/tests/cgi-test.vala
@@ -31,7 +31,7 @@ public static void test_vsgi_cgi_request () {
"HTTP_HOST=example.com"
};
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
var request = new Request (connection, environment);
assert (Soup.HTTPVersion.@1_0 == request.http_version);
@@ -53,7 +53,7 @@ public static void test_vsgi_cgi_request () {
*/
public static void test_vsgi_cgi_request_missing_path_info () {
string[] environment = {};
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
var request = new Request (connection, environment);
assert ("/" == request.uri.get_path ());
@@ -63,7 +63,7 @@ public static void test_vsgi_cgi_request_missing_path_info () {
* @since 0.2
*/
public void test_vsgi_cgi_request_http_1_1 () {
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
string[] environment = {"SERVER_PROTOCOL=HTTP/1.1"};
var request = new Request (connection, environment);
@@ -75,7 +75,7 @@ public void test_vsgi_cgi_request_http_1_1 () {
* @since 0.2.4
*/
public void test_vsgi_cgi_request_https_detection () {
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
string[] environment = {"PATH_TRANSLATED=https://example.com:80/"};
var request = new Request (connection, environment);
@@ -88,7 +88,7 @@ public void test_vsgi_cgi_request_https_detection () {
*/
public void test_vsgi_cgi_response () {
string[] environment = {};
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
var request = new Request (connection, environment);
var response = new Response (request);
diff --git a/tests/cookies-test.vala b/tests/cookies-test.vala
index 69672ec98..b40bde4a4 100644
--- a/tests/cookies-test.vala
+++ b/tests/cookies-test.vala
@@ -15,7 +15,7 @@
* along with Valum. If not, see .
*/
-using VSGI.Test;
+using VSGI.Mock;
/**
* @since 0.1
diff --git a/tests/fastcgi-test.vala b/tests/fastcgi-test.vala
index 183817ea5..4b2472127 100644
--- a/tests/fastcgi-test.vala
+++ b/tests/fastcgi-test.vala
@@ -30,7 +30,7 @@ public static void test_vsgi_fastcgi_request () {
"HTTP_HOST=example.com"
};
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
var request = new Request (connection, environment);
assert (Soup.HTTPVersion.@1_0 == request.http_version);
@@ -56,7 +56,7 @@ public static void test_vsgi_fastcgi_request_https_on () {
"HTTPS=on"
};
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
var request = new Request (connection, environment);
assert ("https" == request.uri.scheme);
@@ -74,7 +74,7 @@ public static void test_vsgi_fastcgi_request_uri_with_query () {
"REQUEST_URI=/home?a=b"
};
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
var request = new Request (connection, environment);
assert ("/home" == request.uri.path);
@@ -92,7 +92,7 @@ public static void test_vsgi_fastcgi_response () {
"SERVER_PORT=3003"
};
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
var request = new Request (connection, environment);
var response = new Response (request);
diff --git a/tests/soup-test.vala b/tests/http-test.vala
similarity index 93%
rename from tests/soup-test.vala
rename to tests/http-test.vala
index 4251e40ee..67a83a3b6 100644
--- a/tests/soup-test.vala
+++ b/tests/http-test.vala
@@ -15,7 +15,7 @@
* along with Valum. If not, see .
*/
-using VSGI.Soup;
+using VSGI.HTTP;
/**
* @since 0.2
@@ -23,7 +23,7 @@ using VSGI.Soup;
public static void test_vsgi_soup_request () {
var message = new Soup.Message ("GET", "http://0.0.0.0:3003/");
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
var request = new Request (connection, message, null);
assert (message == request.message);
@@ -42,7 +42,7 @@ public static void test_vsgi_soup_request () {
public static void test_vsgi_soup_response () {
var message = new Soup.Message ("GET", "http://0.0.0.0:3003/");
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
var request = new Request (connection, message, null);
var response = new Response (request, message);
diff --git a/tests/negociate-test.vala b/tests/negociate-test.vala
index 29d189820..428c036f8 100644
--- a/tests/negociate-test.vala
+++ b/tests/negociate-test.vala
@@ -1,5 +1,5 @@
using Valum;
-using VSGI.Test;
+using VSGI.Mock;
/**
* @since 0.3
diff --git a/tests/route-test.vala b/tests/route-test.vala
index 1b517b0cf..fb7b884be 100644
--- a/tests/route-test.vala
+++ b/tests/route-test.vala
@@ -16,7 +16,7 @@
*/
using Valum;
-using VSGI.Test;
+using VSGI.Mock;
/**
* @since 0.1
diff --git a/tests/router-test.vala b/tests/router-test.vala
index ec52444fb..be866ee2f 100644
--- a/tests/router-test.vala
+++ b/tests/router-test.vala
@@ -16,7 +16,7 @@
*/
using Valum;
-using VSGI.Test;
+using VSGI.Mock;
/**
* @since 0.1
diff --git a/tests/scgi-test.vala b/tests/scgi-test.vala
index 8246847c1..22c996fe4 100644
--- a/tests/scgi-test.vala
+++ b/tests/scgi-test.vala
@@ -29,7 +29,7 @@ public void test_vsgi_scgi_request_with_request_uri () {
"REQUEST_URI=/home?a=b"
};
- var connection = new VSGI.Test.Connection ();
+ var connection = new VSGI.Mock.Connection ();
var request = new Request (connection, new SCGIInputStream (connection.input_stream, 0), environment);
assert ("GET" == request.method);
diff --git a/tests/server-sent-events-test.vala b/tests/server-sent-events-test.vala
index 5774843d3..fd4fd6fd6 100644
--- a/tests/server-sent-events-test.vala
+++ b/tests/server-sent-events-test.vala
@@ -1,6 +1,6 @@
using Valum;
using Valum.ServerSentEvents;
-using VSGI.Test;
+using VSGI.Mock;
/**
* @since 0.3
diff --git a/tests/subdomain-test.vala b/tests/subdomain-test.vala
index c8c9df590..a500ae313 100644
--- a/tests/subdomain-test.vala
+++ b/tests/subdomain-test.vala
@@ -17,7 +17,7 @@
using GLib;
using Valum;
-using VSGI.Test;
+using VSGI.Mock;
/**
* @since 0.3
diff --git a/tests/wscript b/tests/wscript
index 72926ccb3..5cc4a932b 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -11,7 +11,7 @@ def build(bld):
bld.program(
features = 'test',
target = 'tests',
- source = ['tests.vala', 'tests.gresource.xml'] + bld.path.ant_glob('*-test.vala'),
+ source = bld.path.ant_glob('*.vala') + ['tests.gresource.xml'],
use = 'valum',
- vapi_dirs = '../vapi',
+ vapi_dirs = '../src/vsgi-fastcgi',
install_path = None)
diff --git a/vapi/wscript_build b/vapi/wscript_build
deleted file mode 100644
index 69e2d545b..000000000
--- a/vapi/wscript_build
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env python
-
-bld.install_files ('${DATADIR}/vala/vapi', bld.path.ant_glob('*.deps') + bld.path.ant_glob('*.vapi'))
diff --git a/wscript b/wscript
index 7227be776..00bc34cd3 100644
--- a/wscript
+++ b/wscript
@@ -15,45 +15,11 @@ def options(opt):
def configure(conf):
conf.load('compiler_c vala')
- conf.check_cfg(package='glib-2.0', atleast_version='2.32', uselib_store='GLIB', args='--cflags --libs')
- conf.check_cfg(package='gio-2.0', atleast_version='2.32', uselib_store='GIO', args='--cflags --libs')
- conf.check_cfg(package='gio-unix-2.0', atleast_version='2.32', uselib_store='GIOUNIX', args='--cflags --libs')
- conf.check_cfg(package='libsoup-2.4', atleast_version='2.38',uselib_store='SOUP', args='--cflags --libs')
-
- # glib (>=2.38) to enable subprocess in tests
- if conf.check_cfg(package='glib-2.0', atleast_version='2.38', mandatory=False, uselib_store='GLIB', args='--cflags --libs'):
- conf.env.append_unique('VALAFLAGS', ['--define=GIO_2_38'])
-
- # gio (>=2.34) is necessary for ApplicationCommandLine.get_stdin
- if conf.check_cfg(package='gio-2.0', atleast_version='2.34', mandatory=False, uselib_store='GIO', args='--cflags --libs'):
- conf.env.append_unique('VALAFLAGS', ['--define=GIO_2_34'])
-
- # gio (>=2.40) is necessary for CLI arguments parsing
- if conf.check_cfg(package='gio-2.0', atleast_version='2.40', mandatory=False, uselib_store='GIO', args='--cflags --libs'):
- conf.env.append_unique('VALAFLAGS', ['--define=GIO_2_40'])
-
- # gio (>=2.44) is necessary for 'write_all_async' and 'strv_contains'
- if conf.check_cfg(package='gio-2.0', atleast_version='2.44', mandatory=False, uselib_store='GIO', args='--cflags --libs'):
- conf.env.append_unique('VALAFLAGS', ['--define=GIO_2_44'])
-
- # libsoup (>=2.38) to support TLS certificate
- if conf.check_cfg(package='libsoup-2.4', atleast_version='2.38', mandatory=False, uselib_store='SOUP', args='--cflags --libs'):
- conf.env.append_unique('VALAFLAGS', ['--define=SOUP_2_38'])
-
- # libsoup (>=2.48) is necessary for the new server API
- if conf.check_cfg(package='libsoup-2.4', atleast_version='2.48', mandatory=False, uselib_store='SOUP', args='--cflags --libs'):
- conf.env.append_unique('VALAFLAGS', ['--define=SOUP_2_48'])
-
- # libsoup (>=2.50) for steal_connection
- if conf.check_cfg(package='libsoup-2.4', atleast_version='2.50', mandatory=False, uselib_store='SOUP', args='--cflags --libs'):
- conf.env.append_unique('VALAFLAGS', ['--define=SOUP_2_50'])
-
- # other dependencies
- conf.check(lib='fcgi', uselib_store='FCGI', args='--cflags --libs')
conf.check(lib='gcov', mandatory=False, uselib_store='GCOV', args='--cflags --libs')
-
conf.find_program('valadoc', mandatory=False)
+ conf.recurse(['src', 'docs', 'tests'])
+
if conf.options.enable_gcov:
conf.env.append_unique('CFLAGS', ['-fprofile-arcs', '-ftest-coverage'])
conf.env.append_unique('VALAFLAGS', ['--debug'])
@@ -63,55 +29,23 @@ def configure(conf):
conf.env.ENABLE_EXAMPLES = True
conf.recurse(glob.glob('examples/*'))
- conf.recurse(['docs', 'tests'])
-
def build(bld):
- bld.shlib(
- packages = ['glib-2.0', 'gio-2.0', 'gio-unix-2.0', 'libsoup-2.4', 'fcgi'],
- target = 'vsgi',
- gir = 'VSGI-{}'.format(API_VERSION),
- source = ['src/vsgi.vala'] + bld.path.ant_glob('src/vsgi-*.vala'),
- use = ['GLIB', 'GIO', 'GIOUNIX', 'SOUP', 'FCGI'],
- vapi_dirs = ['vapi'],
- header_path = '${INCLUDEDIR}/vsgi',
- install_path = '${LIBDIR}')
-
- bld.shlib(
- target = 'valum',
- gir = 'Valum-{}'.format(API_VERSION),
- source = ['src/valum.vala'] + bld.path.ant_glob('src/valum-*.vala'),
- use = ['vsgi'],
- vapi_dirs = ['vapi'],
- header_path = '${INCLUDEDIR}/valum',
- install_path = '${LIBDIR}')
-
- # static library for tests and examples
- bld.stlib(
- packages = ['glib-2.0', 'gio-2.0', 'gio-unix-2.0', 'libsoup-2.4', 'fcgi'],
- target = 'valum',
- source = bld.path.ant_glob('src/*.vala'),
- use = ['GLIB', 'GIO', 'GIOUNIX', 'SOUP', 'FCGI', 'GCOV'],
- vapi_dirs = ['vapi'],
- vala_dir = 'static',
- install_binding = False,
- header_path = None,
- install_path = None)
+ bld.load('compiler_c vala')
+ bld.recurse(['src', 'data', 'docs', 'tests'])
# generate the api documentation
if bld.env.VALADOC:
bld.load('valadoc')
bld(
features = 'valadoc',
- packages = ['glib-2.0', 'gio-2.0', 'gio-unix-2.0', 'libsoup-2.4', 'fcgi'],
- files = bld.path.ant_glob('src/*.vala'),
+ packages = ['glib-2.0', 'gio-2.0', 'gio-unix-2.0', 'libsoup-2.4', 'fcgi'],
+ files = bld.path.ant_glob('src/**/*.vala'),
package_name = 'valum',
package_version = VERSION,
+ vapi_dirs = 'src/vsgi-fastcgi',
output_dir = 'apidocs',
- force = True,
- vapi_dirs = ['vapi'])
+ force = True)
# build examples
if bld.env.ENABLE_EXAMPLES:
bld.recurse(glob.glob('examples/*'))
-
- bld.recurse(['data', 'docs', 'tests', 'vapi'])