Linux HOWTOs

About | Home | Search

HOWTO: jansson
Description: C library for encoding, decoding and manipulating JSON data
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything

# Jansson 2.12
# ============
# Changes in 2.12
# Release announcement for 2.12
# Jansson 2.12 Documentation

# If you are going to generate HTML documentation (see below), install/update
# Sphinx:
su -c "pip install -U Sphinx"

# Get it
test -f installed/jansson-2.12.tar.bz2 &&
 mv -f installed/jansson-2.12.tar.bz2 .
test ! -f jansson-2.12.tar.bz2 &&

# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "645d72cc5dbebd4df608d33988e55aa42a7661039e19a379fcbe5c79d1aee1\
d2  jansson-2.12.tar.bz2" | sha256sum -c

# Verify tarball w/ gpg:
(gpg --list-keys D058434C > /dev/null 2>&1 || gpg --recv-keys D058434C) &&
  gpg --verify jansson-2.12.tar.bz2.asc && rm jansson-2.12.tar.bz2.asc

# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "jansson-*" -exec rm -r {} \;
tar xjvf ~/jansson-2.12.tar.bz2
cd jansson-2.12
test $UID = 0 && chown -R root:root .

# Configure the build
test $(uname -m) = 'x86_64' && ./configure --libdir=/usr/local/lib64
test $(uname -m) != 'x86_64' && ./configure

# Build it

# Test the build
make check

# Generate HTML documentation
# Requires Sphinx (as root: 'pip install -U Sphinx')
# View with 'lynx doc/_build/html/index.html' (or go to the docs URL above)
make html

# Become root to install it

# Install it
make install

# Become your non-root user again

# Save the source for later
mkdir -p -m 0700 installed
rm -f installed/jansson-*.tar.*
mv -f jansson-2.12.tar.bz2 installed/

# If you ever want to uninstall Jansson, this should do it:
test -d src/jansson-* && ( cd src/jansson-* ; make uninstall )
( /usr/local/include ; rm -f jansson.h jansson_config.h )
test -d /usr/local/lib64 &&
 rm -f /usr/local/lib64/libjanson.* /usr/local/lib64/pkgconfig/janson.pc)
rm -f /usr/local/lib/libjanson.* /usr/local/lib/pkgconfig/janson.pc
find ~/src -maxdepth 1 -type d -name "jansson-*" -exec rm -r {} \;
rm -f ~/installed/jansson-*.tar.*

Back to the list

Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>