Skip to content

Commit

Permalink
Merge pull request #16 from babelouest/2.0b
Browse files Browse the repository at this point in the history
Ulfius 2.0
  • Loading branch information
babelouest committed May 22, 2017
2 parents 6ac7d2e + 8893c93 commit 8a198c5
Show file tree
Hide file tree
Showing 83 changed files with 5,113 additions and 3,034 deletions.
35 changes: 23 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
*.o
examples/*/*.o
example_programs/*/*.o
example_programs/*/valgrind*.txt
src/*.o
src/*.so
src/*.so.*
examples/auth_example/auth_client
examples/auth_example/auth_server
examples/injection_example/injection_example
examples/proxy_example/proxy
examples/request_example/client
examples/request_example/mail
examples/request_example/server
examples/simple_example/simple_example
examples/stream_example/stream_example
examples/stream_example/stream_client
examples/test_u_map/test_u_map
example_programs/auth_example/auth_client
example_programs/auth_example/auth_server
example_programs/injection_example/injection_example
example_programs/proxy_example/proxy
example_programs/request_example/client
example_programs/request_example/mail
example_programs/request_example/server
example_programs/simple_example/simple_example
example_programs/stream_example/stream_example
example_programs/stream_example/stream_client
example_programs/test_u_map/test_u_map
example_programs/multiple_callbacks_example/multiple_callbacks_example
example_programs/sheep_counter/sheep_counter
example_programs/websocket_example/websocket_example
test/valgrind*.txt
test/*.o
test/core
test/u_map
test/framework
*.key
*.pem
488 changes: 363 additions & 125 deletions API.md

Large diffs are not rendered by default.

55 changes: 42 additions & 13 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,74 @@

### External dependencies

To install the external dependencies, for Debian based distributions (Debian, Ubuntu, Raspbian, etc.), run as root:
To install all the external dependencies, for Debian based distributions (Debian, Ubuntu, Raspbian, etc.), run as root:

```shell
# apt-get install libmicrohttpd-dev libjansson-dev libcurl4-gnutls-dev
# apt-get install libmicrohttpd-dev libjansson-dev libcurl4-gnutls-dev libgnutls28-dev libgcrypt20-dev
```

### Note

Here libcurl4-gnutls-dev for the example, but any `libcurl*-dev` library should be sufficent, depending on your needs and configuration.
Here libcurl4-gnutls-dev for the example, but any `libcurl*-dev` library should be sufficent, depending on your needs and configuration. Note that gnutls is mandatory for websocket management and https support.

Also, it seems that Debian Wheezy uses an old version of libjansson (2.3), you can either upgrade to jessie or download the latest version of libjansson from [github](https://github.com/akheron/jansson).

As in version 2.0, libcurl and libjansson are no longer mandatory if you don't need one or both.

If you want to use the websocket server functions, you need to install libmicrohttpd 0.9.53 minimum version.

## Installation

Download Ulfius source code from Github, get the submodules, compile and install:
Download Ulfius source code from Github, get the submodules, compile and install each submodule, then compile and install ulfius:

```shell
$ git clone https://github.com/babelouest/ulfius.git
$ cd ulfius/
$ git submodule update --init
$ cd lib/orcania
$ make && sudo make install
$ cd ../yder
$ make && sudo make install
$ cd ../..
$ make
$ sudo make install
```

By default, the shared libraries and the header files will be installed in the `/usr/local` location. To change this setting, you can modify the `PREFIX` value in the `src/Makefile`, `lib/orcania/Makefile` and `lib/yder/src/Makefile` files.
To disable libcurl functions, append the option `CURLFLAG=-DU_DISABLE_CURL` to the make command when you build Ulfius:

If you download Ulfius as a `.zip` or `.tar.gz` file via github release tab, you must initiaize the submodules prior to the compilaton with the following command:
```shell
$ make CURLFLAG=-DU_DISABLE_CURL
```

If libcurl functions are disabled, `libcurl4-gnutls-dev` is no longer mandatory for install.

To disable libjansson functions, append the option `JANSSONFLAG=-DU_DISABLE_JANSSON` to the make command when you build Ulfius and Orcania:

```shell
$ cd ulfius/
$ git submodule update --init
$ make JANSSONFLAG=-DU_DISABLE_JANSSON
```

If libjansson functions are disabled, `libjansson-dev` is no longer mandatory for install.

To disable websocket implementation and avoid installing libgnutls, append the option `WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET` to the make command when you build Ulfius:

```shell
$ make WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET
```

### libcurl older than 7.20
If websocket functions are disabled, `libgnutls-dev` is no longer mandatory for install.

If you use old version of liburl, as in Centos 6.5 for example, `ulfius_send_smtp_email` won't be available due to libcurl options problems. In this case, uncomment the following line in the file `src/Makefile`:
To disable two or more libraries, append options, example:

```Makefile
#SMTPFLAGS=-DULFIUS_IGNORE_SMTP
```shell
$ make CURLFLAG=-DU_DISABLE_CURL JANSSONFLAG=-DU_DISABLE_JANSSON
```

This will disable `ulfius_send_smtp_email` during the compilation.
By default, the shared libraries and the header files will be installed in the `/usr/local` location. To change this setting, you can modify the `PREFIX` value in the `src/Makefile`, `lib/orcania/src/Makefile` and `lib/yder/src/Makefile` files.

If you download Ulfius as a `.zip` or `.tar.gz` file via github release tab, you must initiaize the submodules prior to the compilaton with the following command:

```shell
$ cd ulfius/
$ git submodule update --init
```
30 changes: 17 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Makefile used to build all programs
#
# Copyright 2014-2015 Nicolas Mora <[email protected]>
# Copyright 2014-2017 Nicolas Mora <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the MIT License
Expand All @@ -14,16 +14,26 @@
#

LIBULFIUS_LOCATION=./src
LIBORCANIA_LOCATION=lib/orcania
LIBORCANIA_LOCATION=lib/orcania/src
LIBYDER_LOCATION=lib/yder/src
EXAMPLES_LOCATION=./examples
EXAMPLES_LOCATION=./example_programs

ifeq (($(JANSSONFLAG)),"")
ADD_JANSSONFLAG="JANSSONFLAG=-DU_DISABLE_JANSSON"
endif

ifeq (($(CURLFLAG)),"")
ADD_CURLFLAG="CURLFLAG=-DU_DISABLE_CURL"
endif

ifeq (($(WEBSOCKETFLAG)),"")
ADD_WEBSOCKETFLAG="WEBSOCKETFLAG=-DU_DISABLE_WEBSOCKET"
endif

all: libulfius.so

debug:
cd $(LIBORCANIA_LOCATION) && $(MAKE) debug
cd $(LIBYDER_LOCATION) && $(MAKE) debug
cd $(LIBULFIUS_LOCATION) && $(MAKE) debug
cd $(LIBULFIUS_LOCATION) && $(MAKE) debug $(ADD_JANSSONFLAG) $(ADD_CURLFLAG) $(ADD_WEBSOCKETFLAG)

clean:
cd $(LIBORCANIA_LOCATION) && $(MAKE) clean
Expand All @@ -32,16 +42,10 @@ clean:
cd $(EXAMPLES_LOCATION) && $(MAKE) clean

install:
cd $(LIBORCANIA_LOCATION) && $(MAKE) install
cd $(LIBYDER_LOCATION) && $(MAKE) install
cd $(LIBULFIUS_LOCATION) && $(MAKE) install

uninstall:
cd $(LIBORCANIA_LOCATION) && $(MAKE) uninstall
cd $(LIBYDER_LOCATION) && $(MAKE) uninstall
cd $(LIBULFIUS_LOCATION) && $(MAKE) uninstall

libulfius.so:
cd $(LIBORCANIA_LOCATION) && $(MAKE)
cd $(LIBYDER_LOCATION) && $(MAKE)
cd $(LIBULFIUS_LOCATION) && $(MAKE)
cd $(LIBULFIUS_LOCATION) && $(MAKE) $(ADD_JANSSONFLAG) $(ADD_CURLFLAG) $(ADD_WEBSOCKETFLAG)
Loading

0 comments on commit 8a198c5

Please sign in to comment.