diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-03-31 10:38:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 10:38:17 +0200 |
commit | 98bb861553e797a3f91c199fa3b1a143bd73f33b (patch) | |
tree | ffe2936989c22640752de3b1cdf99e10ce82b2de | |
parent | a37f65471c2b69fa588cbf8e9794ff1fe6d04605 (diff) | |
parent | 6fc4b6c133e9bc7b7dc060b61be98d88bf578032 (diff) |
Merge pull request #61 from jow-/debian
Debian package build
-rw-r--r-- | .github/workflows/debian.yml | 31 | ||||
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | CMakeLists.txt | 27 | ||||
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | debian/control | 70 | ||||
-rw-r--r-- | debian/copyright | 20 | ||||
-rw-r--r-- | debian/libucode-dev.install | 2 | ||||
-rw-r--r-- | debian/libucode.install | 1 | ||||
-rwxr-xr-x | debian/rules | 12 | ||||
-rw-r--r-- | debian/source/format | 1 | ||||
-rw-r--r-- | debian/ucode-modules.install | 1 | ||||
-rw-r--r-- | debian/ucode.install | 1 | ||||
-rw-r--r-- | include/ucode/util.h | 26 |
13 files changed, 190 insertions, 14 deletions
diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml new file mode 100644 index 0000000..db132fd --- /dev/null +++ b/.github/workflows/debian.yml @@ -0,0 +1,31 @@ +name: Build .deb package + +on: + push: {} + tags: + - 'v*.*.*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + path: ucode/ + + - name: Install dependencies + run: | + sudo apt update + sudo apt install devscripts build-essential lintian libjson-c-dev debhelper-compat debhelper + + - name: Build package + run: | + cd ucode/ + touch ucc utpl + dpkg-buildpackage -b -us -uc + + - name: Archive code coverage results + uses: actions/upload-artifact@v3 + with: + name: deb + path: '*ucode*.deb' @@ -6,9 +6,10 @@ install_manifest.txt parser.[ch] parser.out contrib/lemon -ucode -utpl -ucc +/ucode +/utpl +/ucc *.so* tests/cram/*.t.err +tests/cram/.venv examples/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 3409f02..be8a394 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,16 +76,21 @@ IF (NOT FMOD_FUNCTION_EXISTS) TARGET_LINK_LIBRARIES(libucode m) ENDIF() -SET(CMAKE_REQUIRED_LIBRARIES json-c) -CHECK_SYMBOL_EXISTS(json_object_array_shrink "json.h" HAVE_ARRAY_SHRINK) -IF(HAVE_ARRAY_SHRINK) - ADD_DEFINITIONS(-DHAVE_ARRAY_SHRINK) -ELSE() - CHECK_SYMBOL_EXISTS(json_object_array_shrink "json-c/json.h" HAVE_ARRAY_SHRINK2) - IF(HAVE_ARRAY_SHRINK2) - ADD_DEFINITIONS(-DHAVE_ARRAY_SHRINK) - ENDIF() +SET(CMAKE_REQUIRED_INCLUDES ${JSONC_INCLUDE_DIRS}) +SET(CMAKE_REQUIRED_LIBRARIES ${JSONC_LINK_LIBRARIES}) +CHECK_SYMBOL_EXISTS(json_tokener_get_parse_end "json-c/json.h" HAVE_PARSE_END) +IF(HAVE_PARSE_END) + ADD_DEFINITIONS(-DHAVE_PARSE_END) +ENDIF() +CHECK_SYMBOL_EXISTS(json_object_new_array_ext "json-c/json.h" HAVE_ARRAY_EXT) +IF(HAVE_ARRAY_EXT) + ADD_DEFINITIONS(-DHAVE_ARRAY_EXT) +ENDIF() +CHECK_SYMBOL_EXISTS(json_object_new_uint64 "json-c/json.h" HAVE_JSON_UINT64) +IF(HAVE_JSON_UINT64) + ADD_DEFINITIONS(-DHAVE_JSON_UINT64) ENDIF() +UNSET(CMAKE_REQUIRED_INCLUDES) UNSET(CMAKE_REQUIRED_LIBRARIES) SET(LIBRARIES "") @@ -217,11 +222,11 @@ INSTALL(TARGETS libucode LIBRARY DESTINATION lib) INSTALL(TARGETS ${LIBRARIES} LIBRARY DESTINATION lib/ucode) ADD_CUSTOM_TARGET(utpl ALL COMMAND ${CMAKE_COMMAND} -E create_symlink ucode utpl) -INSTALL(FILES utpl DESTINATION bin) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/utpl DESTINATION bin) IF(COMPILE_SUPPORT) ADD_CUSTOM_TARGET(ucc ALL COMMAND ${CMAKE_COMMAND} -E create_symlink ucode ucc) - INSTALL(FILES ucc DESTINATION bin) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ucc DESTINATION bin) ENDIF() FILE(GLOB UCODE_HEADERS "include/ucode/*.h") diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..66697c9 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +ucode (0.0.20220322-1) UNRELEASED; urgency=medium + + * Initial release. + + -- Paul Spooren <mail@aparcar.org> Sun, 20 Mar 2022 07:13:26 -0700 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..5e9d7f3 --- /dev/null +++ b/debian/control @@ -0,0 +1,70 @@ +Source: ucode +Maintainer: Paul Spooren <mail@aparcar.org> +Section: misc +Priority: optional +Standards-Version: 0.0.20220322-1 +Build-Depends: debhelper-compat (= 12), libjson-c-dev + +Package: ucode +Architecture: any +Multi-Arch: foreign +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Tiny scripting language with ECMA script syntax + Ucode is a tiny script language featuring ECMA script syntax, builtin JSON + support and templating using Jinja inspired markup. The ucode VM is provided + as shared library with a C API allowing embedding into host applications and + interchanging data between ucode and C programs. The ucode VM can also be + used as stand-alone multi purpose scripting language through the provided + ucode cli interpreter. + . + This package contains the ucode command line interpreter, which is required + to develop, debug and precompile ucode scripts. + +Package: ucode-modules +Architecture: any +Multi-Arch: foreign +Depends: libucode (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Extension modules for the ucode language + Ucode is a tiny script language featuring ECMA script syntax, builtin JSON + support and templating using Jinja inspired markup. The ucode VM is provided + as shared library with a C API allowing embedding into host applications and + interchanging data between ucode and C programs. The ucode VM can also be + used as stand-alone multi purpose scripting language through the provided + ucode cli interpreter. + . + This package contains various native ucode extensions which provide further + functionality such as filesystem access, math functions etc. + +Package: libucode +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} +Section: libs +Description: Shared library for the ucode interpreter + Ucode is a tiny script language featuring ECMA script syntax, builtin JSON + support and templating using Jinja inspired markup. The ucode VM is provided + as shared library with a C API allowing embedding into host applications and + interchanging data between ucode and C programs. The ucode VM can also be + used as stand-alone multi purpose scripting language through the provided + ucode cli interpreter. + . + This package contains the libucode VM runtime, it should not be needed to + install it explicitly. + +Package: libucode-dev +Architecture: any +Multi-Arch: same +Depends: libucode (= ${binary:Version}), libc6-dev|libc-dev, ${misc:Depends} +Section: libdevel +Description: Development files for the ucode VM library + Ucode is a tiny script language featuring ECMA script syntax, builtin JSON + support and templating using Jinja inspired markup. The ucode VM is provided + as shared library with a C API allowing embedding into host applications and + interchanging data between ucode and C programs. The ucode VM can also be + used as stand-alone multi purpose scripting language through the provided + ucode cli interpreter. + . + This package contains the development header to interface with the libucode + VM runtime, which is required when developing programs or extensions using + the ucode C API. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..4bbf4cc --- /dev/null +++ b/debian/copyright @@ -0,0 +1,20 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: github.com/jow-/ucode +Source: https://github.com/jow-/ucode + +Files: * +Copyright: 2021 Jo-Philipp Wich <jo@main.io> +License: ISC + +License: ISC + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. diff --git a/debian/libucode-dev.install b/debian/libucode-dev.install new file mode 100644 index 0000000..d67dd0b --- /dev/null +++ b/debian/libucode-dev.install @@ -0,0 +1,2 @@ +usr/include/ucode +usr/lib/libucode.so diff --git a/debian/libucode.install b/debian/libucode.install new file mode 100644 index 0000000..b51a4d9 --- /dev/null +++ b/debian/libucode.install @@ -0,0 +1 @@ +usr/lib/libucode.so.* diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..a55477a --- /dev/null +++ b/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f +%: + dh $@ + +override_dh_auto_configure: + dh_auto_configure -- \ + -D SOVERSION=$(shell dpkg-parsechangelog | sed -rne 's/^Version: 0\.0\.([0-9]+).*$$/\1/p') \ + -D NL80211_SUPPORT=OFF \ + -D RTNL_SUPPORT=OFF \ + -D UBUS_SUPPORT=OFF \ + -D UCI_SUPPORT=OFF \ + -D ULOOP_SUPPORT=OFF diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/ucode-modules.install b/debian/ucode-modules.install new file mode 100644 index 0000000..7f12d08 --- /dev/null +++ b/debian/ucode-modules.install @@ -0,0 +1 @@ +usr/lib/ucode/*.so diff --git a/debian/ucode.install b/debian/ucode.install new file mode 100644 index 0000000..094fc8d --- /dev/null +++ b/debian/ucode.install @@ -0,0 +1 @@ +usr/bin/u* diff --git a/include/ucode/util.h b/include/ucode/util.h index 3203499..35c1e56 100644 --- a/include/ucode/util.h +++ b/include/ucode/util.h @@ -159,4 +159,30 @@ static inline struct printbuf *xprintbuf_new(void) { return pb; } + +/* json-c compat */ + +#ifndef HAVE_PARSE_END +static inline size_t json_tokener_get_parse_end(struct json_tokener *tok) { + return (size_t)tok->char_offset; +} +#endif + +#ifndef HAVE_ARRAY_EXT +static inline struct json_object *json_object_new_array_ext(int size) { + (void) size; + return json_object_new_array(); +} +#endif + +#ifndef HAVE_JSON_UINT64 +static inline struct json_object *json_object_new_uint64(uint64_t i) { + return json_object_new_int64((int64_t)i); +} + +static inline uint64_t json_object_get_uint64(const struct json_object *obj) { + return (uint64_t)json_object_get_int64(obj); +} +#endif + #endif /* UCODE_UTIL_H */ |