And make CBOR_PRIVATE_API fall back to it.
We also need to provide the file for the old Makefile build too.
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
It doesn't know -Wdiscarded-qualifiers. Reported by @pjonsson on #247.
I really need to switch to CMake - #242
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Allow the user to disable -Werror to avoid the following build failure
with gcc 4.8 raised since version 0.6.0 and
https://github.com/intel/tinycbor/commit/e2a4ed135c4d9101c4df83f2dd033cd249b6ef07:
/home/buildroot/autobuild/instance-1/output-1/host/bin/arm-none-linux-gnueabi-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -I./src -std=gnu99 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1 -Werror=incompatible-pointer-types -Werror=implicit-function-declaration -Werror=int-conversion -fPIC -c -o src/cborerrorstrings.pic.o src/cborerrorstrings.c
cc1: error: -Werror=incompatible-pointer-types: no option -Wincompatible-pointer-types
cc1: error: -Werror=int-conversion: no option -Wint-conversion
Fixes:
- http://autobuild.buildroot.org/results/a9f/a9fe64c42bb96f9e7b4af3050464f6570c1c00fa
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Motivation: half-precision floating point format is used to minimize storage
and traffic mostly. Application level manipulates with single and double
precision usually. So, two routines added to public API to encode/decode given
single precision value in the half precision format
Signed-off-by: S.Phirsov
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
The hosted version makes use of math functions (usually, we don't test
that CBOR_NO_FLOATING_POINT is defined).
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Since we're not (yet) guaranteeing binary compatibility, let's use 0.5
as the "soversion".
This changes the version number stored in the VERSION file so that the
actual library file is "libtinycbor.so.0.5.0". As an indirect
consequence, the release will be tagged "v0.5.0", which sorts after
"v0.5-beta1".
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Freestanding C, as opposed to hosted C (see the macro), is restricted to
a few C headers and usually lacks a libc. In our case, that means we
cannot assume <stdio.h> and FILE* is present, but we do require
<string.h> (memcpy, memcmp).
This commit simply makes it easier for me to test that TinyCBOR still
compiles in freestanding mode. Eventually I need to test with an actual
Zephyr build (issue #40).
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
- Enable BUILD_STATIC by default
- If BUILD_STATIC and BUILD_SHARED are both different from 1, return an
error
- If BUILD_STATIC is disabled, use shared library for binaries
- If both are enabled, use the static library
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Detect if this is an ELF system by checking if /bin/sh is ELF. This can
be configured manually with:
make BUILD_SHARED=0
or
make BUILD_SHARED=1
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Technically, they should be allowed on the BSDs, but it's far easier to
whitelist than blacklist.
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Some people may want to use tinycbor as a shared library instead of
as a static library, so providing a set of .so accordingly.
Even with the static library, I'm having trouble incorporating it
into another shared library, so providing -fPIC option as well.
Signed-off-by: Bertrand Roussel <broussel@sierrawireless.com>
This commit creates the tinycbor-version.h file with the version number
in available to source code.
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
The previous part of the Makefile didn't work properly. Instead of using
the contents of the VERSION file, it updated the file right before the
tagging and always for the next minor release.
Instead, move everything to a Perl script that updates the VERSION file
only after the tagging and sets up for a patch release (which are more
frequent). Updating of the dev branch is left as an exercise for the
reader.
As a bonus, this will work on Windows too without Unix shell tools.
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
This commit allos the use of the VERSION variable to set the version to
be tagged, instead of just incrementing the last digit in the VERSION
file.
It stops creating the .zip and .tar.gz files since those are kept in
GitHub anyway.
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
- Update Makefile.configure to test the availability of fopencookie
- If open_memstream is not available on the system AND funopen or fopencookie are available, compile our own version of open_memstream
- If open_memstream can not be compiled, return a new error (CborErrorJsonNotImplemented)
fixes#42
Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
The installation logic used by the Makefile causes a problem with old
make versions, such as make 3.81. Indeed, the rule "$(DESTDIR)%/" gets
matched even for targets like "$(DESTDIR)$(libdir)/libtinycbor.a". Due
to this, with those old make versions, tinycbor.a is installed as a
directory, and the library is never copied:
make[1]: Entering directory `/home/test/outputs/b1305500555cbb5b959e5be11dee5cf75907f0ce/output/build/tinycbor-v0.3.1'
install -d /home/test/outputs/b1305500555cbb5b959e5be11dee5cf75907f0ce/output/target/usr/bin/cbordump
install -d /home/test/outputs/b1305500555cbb5b959e5be11dee5cf75907f0ce/output/target/usr/lib/libtinycbor.a
install -d /home/test/outputs/b1305500555cbb5b959e5be11dee5cf75907f0ce/output/target/usr/lib/pkgconfig/tinycbor.pc
install -d /home/test/outputs/b1305500555cbb5b959e5be11dee5cf75907f0ce/output/target/usr/include/tinycbor/cbor.h
install -d /home/test/outputs/b1305500555cbb5b959e5be11dee5cf75907f0ce/output/target/usr/include/tinycbor/cborjson.h
make[1]: Leaving directory `/home/test/outputs/b1305500555cbb5b959e5be11dee5cf75907f0ce/output/build/tinycbor-v0.3.1'
To address this, we create the destination directory directly within
the per-file make targets.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
In Makefile, the file descriptor 10 is used to redirect input to .config:
$(MAKE) -f $(SRCDIR)Makefile.configure OUT='>&10' configure 10> $@
This patch replaces this file descriptor from to 10 to 9 as
"Redirections using file descriptors greater than 9 should be used with
care, as they may conflict with file descriptors the shell uses
internally."
(cf. https://www.gnu.org/software/bash/manual/html_node/Redirections.html)
Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Function _cbor_value_dup_string from cborparser.c is using malloc/free
functions, from sdtlib header, so it is not possible to compile the
cborparser in systems without stdlib support. Move this function to a
different c file in order to remove the dependency on stdlib header from
cborparser.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
This fixes issue #4. The code is placed in a new file and function so
that only people who need it will pay the cost of this function. The
impact to existing code is minimal.
Before:
text data bss dec hex filename
945 0 0 945 3b1 cborencoder.o
2743 0 0 2743 ab7 cborparser.o
After:
1026 0 0 1026 424 cborencoder.o
2756 0 0 2756 ac4 cborparser.o
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>