commit 114558b1fac370e0fd028d3175485247aa557eb7
parent 5cc04bcbbb9760570a6b12a8168547ba72191f64
Author: lash <dev@holbrook.no>
Date: Thu, 20 Jun 2024 20:58:33 +0100
Add debian/qemu instructions, correct makes for debian
Diffstat:
10 files changed, 196 insertions(+), 17 deletions(-)
diff --git a/DEPENDENCIES.debian b/DEPENDENCIES.debian
@@ -0,0 +1,29 @@
+git
+make
+gcc
+pkg-config
+libgtk-4-1
+libgtk-4-dev
+libgstreamer-plugins-bad1.0-dev
+libgstreamer1.0-dev
+libb64-dev
+libgcrypt-dev
+libqrencode-dev
+libxdg-basedir-dev
+liblmdb-dev
+libldap-dev
+libzbar-dev
+zlib1g-dev
+libtasn1-6-dev
+libxml2-utils
+python3
+python3-venv
+python3-dev
+pandoc
+asciidoc
+cmake
+g++
+flex
+bison
+bsdextrautils
+lmdb-utils
diff --git a/README b/README
@@ -1,7 +1,6 @@
kee
-This repository is a mirror. The upstream respository is
-git://holbrook.no/kee-gtk4.git
+The upstream respository is git://holbrook.no/kee-gtk4.git
I am building a cryptographically counter-signed IOU application with
linux phones (GTK4, phosh) as the primary targets.
diff --git a/README.qemu.adoc b/README.qemu.adoc
@@ -0,0 +1,145 @@
+Build kee in qemu debian vm
+===========================
+
+Instructions to run kee-gtk4 using qemu and Debian Bookworm (v12) network installer.
+
+Consider these instructions work in progress.
+
+First install qemu
+
+-----
+
+# make disk image for the OS installation
+qemu-img create -f raw debian_12_kee.img 6G
+
+# run and complete the debian OS installer
+# from package choices, choose:
+# * gnome desktop
+# * ssh server
+# * standard system utilities
+# install the grub bootloader to the primary drive
+qemu-system-x86_64 --enable-kvm -m 2G --cdrom=/path/to/debian-12.5.0-amd64-netinst.iso --hda debian_12_kee.img
+
+-----
+
+After reboot, run again with out netinst image:
+
+-----
+
+qemu-system-x86_64 --enable-kvm -m 2G --hda debian_12_kee.img -net user,hostfwd=tcp::10022-:22 -net nic,model=rtl8139
+
+-----
+
+You can now ssh into the VM using local port 10022.
+
+Install packages
+----------------
+
+Below are lists of debian packages required and recommended for working with the project.
+
+Installing all packages requires around 8.5GB.
+
+-----
+
+# build kee
+make
+gcc
+pkg-config
+libgtk-4-1
+libgtk-4-dev
+libgstreamer-plugins-bad1.0-dev
+libgstreamer1.0-dev
+libb64-dev
+libgcrypt-dev
+libqrencode-dev
+libxdg-basedir-dev
+liblmdb-dev
+libldap-dev
+libzbar-dev
+zlib1g-dev
+libtasn1-6-dev
+libxml2-utils
+
+## execute kee tests and make testdata
+python3
+python3-venv
+python3-dev
+
+## build docs
+pandoc
+
+## build the libcmime dependency
+cmake
+g++
+flex
+bison
+
+## recommended for poking around
+bsdextrautils
+lmdb-utils
+
+-----
+
+
+Prepare environment
+-------------------
+
+First build libcmime
+
+-----
+
+mkdir src
+cd src
+git clone git://holbrook.no/kee-gtk4
+git clone -b 0.2.2 git://holbrook.no/ext/c/libcmime
+cd libcmime
+mkdir build
+cd build
+cmake ..
+make install DESTDIR=$(realpath .)
+
+-----
+
+Then the main attraction.
+
+-----
+
+cd ../kee-gtk4
+python3 -m venv .venv
+source .venv/bin/activate
+
+-----
+
+Some environment hacks are needed to include the libcime in the non-standard location, aswell as enabling the application to run with test data.
+
+Save this to a file named `env.sh`
+
+-----
+
+#!/bin/bash
+
+cmime_path=$(realpath ../libcmime/build)
+root_path=$(realpath .)
+
+export PKG_CONFIG_PATH=${cmime_path}/usr/local/lib/pkgconfig:${root_path}
+export LIBRARY_PATH=${cmime_path}/usr/local/lib
+export LD_LIBRARY_PATH=${cmime_path}/usr/local/lib
+export C_INCLUDE_PATH=${cmime_path}/usr/local/include
+export CFLAGS="-g3 -DBEAMENU_N_EXITS=3 -DBEAMENU_N_DST=6 -DRERR"
+export KEE_PATH=${root_path}/testdata
+
+-----
+
+
+
+-----
+
+# bug makes you have to build twice, fails first time
+make gtk
+make gtk
+# same here
+make test
+make test
+
+-----
+
diff --git a/src/Makefile b/src/Makefile
@@ -1,7 +1,7 @@
OBJS := $(patsubst %.c,%.o,$(filter-out main.c,$(wildcard *.c)))
-INCLUDES := `pkg-config --cflags libgcrypt lmdb libxdg-basedir libqrencode zbar` -Iaux/include
+INCLUDES := `pkg-config --cflags libgcrypt lmdb libxdg-basedir libqrencode zbar` -I./aux/include
CFLAGS += $(INCLUDES) -Wall
-LIBS := `pkg-config --libs libgcrypt zlib lmdb libxdg-basedir libqrencode zbar` -lb64 -llash -Lsrc/aux/lib
+LIBS := `pkg-config --libs libgcrypt zlib lmdb libxdg-basedir libqrencode zbar` -L./aux/lib -lb64 -llash
LDFLAGS += $(LIBS)
#all: aux resource $(OBJS)
@@ -17,7 +17,7 @@ asn:
aux:
echo "foo"
- make -C aux all
+ make -C aux install
clean:
rm -vf *.o
diff --git a/src/aux/Makefile b/src/aux/Makefile
@@ -1,10 +1,14 @@
CFLAGS += -I./include
all: prep
- make -C liblash install DESTDIR=`realpath .`
+ make -C liblash
make -C beamenu
make -C beamenu gen
+install: all
+ make -C liblash install DESTDIR=`realpath .`
+ install -m0644 -t include/ beamenu/*.h
+
local:
-make -f Makefile.local
diff --git a/src/cmd/Makefile b/src/cmd/Makefile
@@ -1,12 +1,12 @@
OBJS := $(patsubst %.c,%.o,$(filter-out cli.c,$(wildcard *.c)))
LINKOBJS := $(wildcard ../*.o)
-INCLUDES := -I.. -I../aux/include
-CFLAGS += `pkg-config --cflags zbar` $(INCLUDES) -Wall -DRERR -DRERR_N_PREFIX=2
+INCLUDES := -I. -I.. -I../aux/include
+CFLAGS += `pkg-config --cflags libtasn1 zbar` $(INCLUDES) -Wall -DRERR -DRERR_N_PREFIX=2
LIBS := `pkg-config --libs zlib lmdb libgcrypt libxdg-basedir libqrencode zbar` -lb64 -llash -ltasn1 -lcmime -lldap -L../aux/lib
LDFLAGS += $(LIBS)
all: $(OBJS) cliobj
- gcc $(CFLAGS) $(LIBS) $(LINKOBJS) cli.o -o kee-$@ $<
+ $(CC) $(CFLAGS) $(LINKOBJS) cli.o -o kee-$@ $< $(LDFLAGS)
cliobj:
- gcc $(CFLAGS) -c cli.c -o cli.o
+ $(CC) $(CFLAGS) $(LDFLAGS) -c cli.c -o cli.o
diff --git a/src/gpg.c b/src/gpg.c
@@ -156,7 +156,9 @@ int decrypt(char *outdata, const char *ciphertext, size_t ciphertext_len, const
int r;
gcry_cipher_hd_t h;
gcry_error_t e;
- char outdata_raw[ciphertext_len] = {};
+ char outdata_raw[ciphertext_len];
+
+ memset(outdata_raw, 0, sizeof(outdata_raw));
outdata_raw[0] = 0;
r = create_handle(&h, key, nonce);
diff --git a/src/gtk/Makefile b/src/gtk/Makefile
@@ -1,12 +1,12 @@
OBJS := $(patsubst %.c,%.o,$(filter-out main.c beamenu_defs.c,$(wildcard *.c)))
LINKOBJS := $(wildcard ../*.o) $(OBJS)
-INCLUDES := -I.. -I../aux/include
-CFLAGS += `pkg-config --cflags gtk4 gstreamer-1.0 libtasn1 libqrencode zbar` $(INCLUDES) -g3 -Wall
-LIBS := `pkg-config --libs gtk4 zlib lmdb libgcrypt libxdg-basedir gstreamer-1.0 libtasn1 libqrencode zbar` -lb64 -lcmime -llash -lldap -L../aux/lib
+INCLUDES := -I. -I.. -I../aux/include
+CFLAGS += `pkg-config --cflags gtk4 gstreamer-1.0 libtasn1 libqrencode zbar` $(INCLUDES) -g3 -Wall
+LIBS := `pkg-config --libs gtk4 zlib lmdb libgcrypt libxdg-basedir gstreamer-1.0 libtasn1 libqrencode zbar` -L../aux/lib -lb64 -lcmime -llash -lldap
LDFLAGS += $(LIBS)
all: menu resource $(OBJS)
- $(CC) $(CFLAGS) main.c -o a.out $(LINKOBJS) $(LDFLAGS) ../aux/beamenu/beamenu.o ../aux/beamenu/import.o beamenu_defs.o
+ $(CC) $(CFLAGS) main.c -o a.out $(LINKOBJS) ../aux/beamenu/beamenu.o ../aux/beamenu/import.o beamenu_defs.o $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@ $(LDFLAGS)
diff --git a/src/gtk/tests/Makefile b/src/gtk/tests/Makefile
@@ -5,7 +5,7 @@ LINKOBJS := $(wildcard ../../*.o) $(wildcard ../*.o)
INCLUDES := -I../.. -I..
CFLAGS += `pkg-config --cflags gtk4 gstreamer-1.0 libqrencode` $(INCLUDES) -Wall
#LIBS := `pkg-config --libs gtk4 zlib lmdb libgcrypt libxdg-basedir gstreamer-1.0` -lb64 -lvarint -lcmime -llash
-LIBS := `pkg-config --libs gtk4 zlib lmdb libgcrypt libxdg-basedir gstreamer-1.0 libqrencode` -lb64 -lcmime -llash -ltasn1 -lldap
+LIBS := `pkg-config --libs gtk4 zlib lmdb libgcrypt libxdg-basedir gstreamer-1.0 libqrencode` -L../../aux/lib -lb64 -lcmime -llash -ltasn1 -lldap
LDFLAGS += $(LIBS)
#AUXLIBS := `pkg-config --libs kee`
diff --git a/src/tests/ledger.c b/src/tests/ledger.c
@@ -89,7 +89,7 @@ int test_pair() {
}
out_len = 1024;
- r = kee_ledger_serialize_open(&t.ledger, out, &out_len);
+ r = kee_ledger_serialize_open(&t.ledger, out, &out_len, KEE_LEDGER_STATE_RESPONSE);
if (r) {
return 1;
}