Commit Graph

179 Commits

Author SHA1 Message Date
Joris Vink 6fbb6d188e swap macos to dynamic_lookup for undefined. 2024-03-25 19:09:48 -04:00
Joris Vink 92e1ffcc10 remove -f from the cli, it is default. 2023-04-15 10:03:31 +02:00
Joris Vink 5dd2e922b3 Minor style nits from previous patches. 2023-04-02 18:51:10 +02:00
Alibek Omarov 54f6234e4f kodev: add support for generating Clang compilation database
* generated sources for assets are skipped through filepath check
  it's fine for now, but probably should be redone
* despite Kore supports JSON manipulation, kodev doesn't share this code
  so for now JSON file is being regenerated each build
* tested in Qt Creator, works OK
2023-04-02 18:51:03 +02:00
Alibek Omarov b3802d186d kodev: split generating compiler commandline to separate function
args array is supposed to hold 34 + CFLAGS_MAX pointers and like the original
function lacks any checks
2023-04-02 18:51:03 +02:00
Alibek Omarov f9e64ea5f0 kodev: small improvement, fix argv offset, making that argv[0] current command name
* so potential getopt users are happy now
* and no more very specific check for "create" command in main()
2023-04-02 18:51:03 +02:00
Joris Vink 17b6f3bbc6 Disable deprecated warnings for OpenSSL 3.
Until the replacement is done, make sure Kore builds against OpenSSL 3
so it can be used as most distros made the move towards it.
2022-12-28 11:09:15 +01:00
Joris Vink 11cf2075a2 Get rid of PRI_TIME_T defines locally.
Instead do an ugly, use PRId64 and cast the time_t to a signed 64-bit integer.
This'll work on all platforms regardless of how they defined time_t.
2022-08-22 13:17:45 +02:00
Joris Vink 139348c2b7 change PRI_TIME_T to ldd on BSD platforms 2022-08-19 17:00:33 +02:00
Daniel Fahlgren 5e21de3a4c Add printf format attributes and fix fallout 2022-08-17 13:16:18 +02:00
Joris Vink 833ca646e7 i forgot, it's 2022. 2022-01-31 22:02:06 +01:00
Joris Vink a54f806978 Don't let kore build with openssl 3 again.
The whole privilege separation breaks with OpenSSL 3, even if it builds.

I guess it is somewhat time to start on donutls.
2021-12-06 23:58:13 +01:00
Joris Vink 06803e2592 Get kore to at least build with openssl 3 2021-12-06 21:21:21 +01:00
Joris Vink 960730a062 On MacOS put the OpenSSL flags under FEATURES_INC.
Use this to pick them up automatically for kodev.
2021-10-27 22:28:08 +02:00
Joris Vink 0af7258c30 Don't include kore config in all builds just yet. 2021-10-04 19:18:15 +02:00
Joris Vink d078bdfb95 Add a gen command to kodev.
This will generate an asset file for Kore based on the source file
or directory given.

This allows other build systems to more easily generate asset
files if their compilation steps are different.
2021-09-22 22:39:42 +02:00
Joris Vink 1fcc9345a6 add cflags/ldflags commands to kodev.
These will spew out the required CFLAGS and LDFLAGS respectively
when compiling source code for use in Kore applications.

This should make it easier to integrate this into existing
build systems where using kodev may be a bit annoying.

Eg: gcc -Wall -std=c99 `kodev cflags` koreapp.c `kodev ldflags` -o koreapp.so
2021-09-22 20:50:09 +02:00
Joris Vink 17ceb32e23 Cleanup single/dso files properly with kodev clean.
Obey the out_dir too, in case its set differently.
2021-09-21 20:17:44 +02:00
Joel Arbring 31aaf128a1 Check for .so file where we create it 2021-09-17 20:04:46 +02:00
Joris Vink e98a4ddab5 Change how routes are configured in Kore.
Routes are now configured in a context per route:

route /path {
	handler handler_name
	methods get post head
	validate qs:get id v_id
}

All route related configurations are per-route, allowing multiple
routes for the same path (for different methods).

The param context is removed and merged into the route context now
so that you use the validate keyword to specify what needs validating.
2021-09-15 11:09:52 +02:00
Joris Vink fb335e1e0c Major Python API improvements.
1) Add @kore.route as a decorator for Python.

This decorator can be used on non-class methods to automatically
declare their route and parameters.

Takes the same arguments as the kore.domain.route function that
exists today.

Provides a nice clean way of setting up Kore if you dont want
a whole class based approach.

2) Remove the requirement for the name for kore.server() and the
kore.domain(attach=) keywords.

Instead of no name was given, the name "default" is used in both
places resulting in less boilerplating.

3) Allow multiple routes to be defined for the same URI as long
as the methods are different. So you can have one method for GET /
and another for POST /.

All changes combined condense the initial experience of getting
a Kore Python app up and running:

eg:

import kore

kore.server(ip="127.0.0.1", port="8888", tls=False)
kore.domain("*")

@kore.route("/", methods=["get"])
async def index(req):
    req.response(200, b'get method')

@kore.route("/", methods=["post"])
async def index_post(req)
    req.response(200, b'post method')
2021-05-02 00:32:47 +02:00
Joris Vink c77ec598e7 Remove dh parameters from kodev. 2021-04-21 10:52:02 +02:00
Joris Vink cf9e97f087 Improve TLS settings and dependencies.
- Kore now only supports OpenSSL 1.1.1 and LibreSSL 3.x.
- Revise the default TLS ciphersuites.
- Kore now carries ffdhe4096.pem and installs it under PREFIX/share/kore.
- Kore its tls_dhparam config setting defaults to the path mentioned above
  so you no longer have to set it.
2021-04-21 10:48:00 +02:00
Joris Vink 960fe5afd3 drop unused __init__ in cli generation 2021-04-20 10:00:46 +02:00
Joris Vink a27227d37f Rework how kodev create does python apps.
Drop the kore.conf for python apps, all configuration
can be done from inside the python code since kore4.

Adds all the basic goo in the app.py file to get up and running.
2021-04-19 09:47:18 +02:00
Joris Vink cef5ac4003 bump copyright year. 2021-01-11 23:46:08 +01:00
Joris Vink 51e9c64fc0 strdup the application name. 2020-09-09 22:30:56 +02:00
Joris Vink 4e384167f0 The version.c file has moved.
Therefor make sure kodev knows the correct place to look for it
and include it in single binary builds.
2020-09-09 21:27:07 +02:00
Joris Vink 2dca8fd6cc Add an install-sources target.
This will place the required sources for building
single binary builds under $PREFIX/share/kore.

The kodev utility will now pickup this KORE_SOURCE path automatically
unless another one is given via the conf/build.conf file or the KORE_SOURCE
environment path.
2020-09-09 21:09:40 +02:00
Joris Vink aaf8be40c2 Add casts for isxdigit and isspace.
The argument must be representable as an unsigned char or EOF.
2020-09-08 19:19:56 +02:00
Joris Vink 4115df69f6 adjust for configuration changes 2020-02-11 11:04:10 +01:00
Joris Vink 9d0aef0079 bump copyright 2020-02-10 14:47:33 +01:00
Frederic Cambus c6dbf16b65 Account for the change from 'static' to 'route' in the CLI tool as well. 2019-11-16 12:34:57 +01:00
Joris Vink 16afcb66d0 kodev MINIMAL=1 shouldn't include mime types either. 2019-10-31 09:55:14 +01:00
Joris Vink ca17e08ad9 Add MIMINAL=1 build to kodev.
If the kodev tool is built with MINIMAL=1 it will not compile in
support for creating application skeletons, only to build apps, etc.

Building with MINIMAL=1 drops the openssl linkage.
2019-10-31 09:44:47 +01:00
Joris Vink 46375303cb Allow multiple binds on new server directive. 2019-09-27 20:00:35 +02:00
Joris Vink 7350131232 Allow listening of tls/notls ports at the same time.
Before kore needed to be built with NOTLS=1 to be able to do non TLS
connections. This has been like this for years.

It is time to allow non TLS listeners without having to rebuild Kore.

This commit changes your configuration format and will break existing
applications their config.

Configurations now get listener {} contexts:

listen default {
	bind 127.0.0.1 8888
}

The above will create a listener on 127.0.0.1, port 8888 that will serve
TLS (still the default).

If you want to turn off TLS on that listener, specify "tls no" in that
context.

Domains now need to be attached to a listener:

Eg:
	domain * {
		attach	default
	}

For the Python API this kills kore.bind(), and kore.bind_unix(). They are
replaced with:

	kore.listen("name", ip=None, port=None, path=None, tls=True).
2019-09-27 12:27:04 +02:00
Joris Vink f725ca228c alter python skeleton from kodev create -p.
adds the kore.config.file setting (required a fix for -c) and the
kore.config.deployment option is set to "development".
2019-09-26 19:58:13 +02:00
Joris Vink 555856ab0a fix usage for python builds.
while here, force a module or script as a cli argument and
fix kodev run to pass the config if inside of a module.
2019-09-26 16:41:52 +02:00
Joris Vink f2472ba485 allow python modules to set progname. 2019-09-04 20:37:33 +02:00
Joris Vink 574c9a7084 make sure kodev run works in python modules. 2019-06-13 11:18:10 +02:00
Joris Vink 3114f8d8d0 Improve python experience.
- If Kore is built with PYTHON=1 you can now specify the module that
  should be loaded on the command-line.

     eg: $ kore -frn myapp

- Add skeleton generation for python applications to kodev.

     eg: $ kodev create -p myapp

This should make it a whole lot easier to get started with kore python.
2019-06-12 23:35:43 +02:00
Joris Vink cd80685d9d get rid of pyko 2019-03-21 21:37:16 +01:00
Joris Vink bf1e8e5ffb bump copyright to 2019 2019-02-22 16:57:28 +01:00
Joris Vink fd1ab5879d KODEV_OUTPUT tells kodev the outdir of the binary.
eg:

$ env KODEV_OUTPUT=/tmp kodev build

will place the resulting binary under /tmp/<binary>
2018-11-28 14:24:42 +01:00
Joris Vink 8dd075e71c style 2018-11-28 14:22:27 +01:00
Joris Vink e3efeb9465 Move assets.h into object_dir. 2018-11-28 14:19:32 +01:00
Joris Vink c172d49567 kodev improvements.
- Take CFLAGS, CXXFLAGS and LDFLAGS from environment
  if present and append them to the build.conf cflags

- Allow overriding of the OBJDIR via KORE_OBJDIR.

- Allow overriding of build flavor via KORE_BUILD_FLAVOR.
2018-10-17 11:30:14 +02:00
Joris Vink 6ef8d59f7d more directly include assets.h 2018-08-13 09:16:28 +02:00
Joris Vink 3312a2882f Let KORE_PREFIX override builtin prefix for kodev. 2018-07-17 15:59:59 +02:00