add sqlite dependency default tip

Fri, 11 Dec 2020 18:32:54 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 11 Dec 2020 18:32:54 +0100
changeset 4
d8e8f34e65ee
parent 3
c04433993fbb

add sqlite dependency

application/Makefile file | annotate | diff | comparison | revisions
application/browser.c file | annotate | diff | comparison | revisions
application/menu.c file | annotate | diff | comparison | revisions
application/window.c file | annotate | diff | comparison | revisions
configure file | annotate | diff | comparison | revisions
make/project.xml file | annotate | diff | comparison | revisions
--- a/application/Makefile	Fri Dec 11 11:46:19 2020 +0100
+++ b/application/Makefile	Fri Dec 11 18:32:54 2020 +0100
@@ -42,8 +42,8 @@
 all: ../build/bin/mk12
 
 ../build/bin/mk12: $(OBJ) $(BUILD_ROOT)/build/lib/libuitk.a
-	$(LD) -o ../build/bin/mk12$(APP_EXT) $(OBJ) -L$(BUILD_ROOT)/build/lib -luitk -lucx $(LDFLAGS) $(TK_LDFLAGS)
+	$(LD) -o ../build/bin/mk12$(APP_EXT) $(OBJ) -L$(BUILD_ROOT)/build/lib -luitk -lucx $(LDFLAGS) $(NOTE_LDFLAGS) $(TK_LDFLAGS)
 
 ../build/application/%.$(OBJ_EXT): %.c
-	$(CC) $(CFLAGS) $(TK_CFLAGS) -o $@ -c $<
+	$(CC) $(CFLAGS) $(NOTE_CFLAGS) $(TK_CFLAGS) -o $@ -c $<
 
--- a/application/browser.c	Fri Dec 11 11:46:19 2020 +0100
+++ b/application/browser.c	Fri Dec 11 18:32:54 2020 +0100
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 
 UIWIDGET document_browser_create(UiObject *obj) {
-    ui_layout_width(obj, 250);
+    ui_layout_width(obj, 220);
     UIWIDGET browser = ui_drawingarea(obj, browser_draw, NULL);
     return browser;
 }
--- a/application/menu.c	Fri Dec 11 11:46:19 2020 +0100
+++ b/application/menu.c	Fri Dec 11 18:32:54 2020 +0100
@@ -40,6 +40,7 @@
 
 static void create_main_menu(void) {
     ui_menu("File");
+    ui_menuitem_st(UI_STOCK_NEW, NULL, NULL);
     ui_menuitem_st(UI_STOCK_OPEN, NULL, NULL);
     
     ui_menu("Edit");
@@ -61,6 +62,8 @@
     ui_toolitem_toggle("singleview", "S", NULL, tb_singleview);
     ui_toolitem_toggle("dualview", "D", NULL, tb_dualview);
     
+    ui_toolitem_st("new-note", UI_STOCK_NEW, NULL, NULL);
+    
     tb_sidebar->value = 1;
     tb_singleview->value = 0;
     tb_dualview->value = 1;
@@ -70,6 +73,7 @@
     ui_toolbar_add_default("singleview");
     ui_toolbar_add_default("dualview");
     ui_toolbar_add_default("@separator");
+    ui_toolbar_add_default("new-note");
 }
 
 void menu_init(void) {
--- a/application/window.c	Fri Dec 11 11:46:19 2020 +0100
+++ b/application/window.c	Fri Dec 11 18:32:54 2020 +0100
@@ -32,6 +32,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 UiObject* window_create(void) {
     UiObject *obj = ui_window("Note", NULL);
--- a/configure	Fri Dec 11 11:46:19 2020 +0100
+++ b/configure	Fri Dec 11 18:32:54 2020 +0100
@@ -352,6 +352,28 @@
 	echo no
 	return 1
 }
+dependency_sqlite()
+{
+    printf "checking for sqlite... "
+    # dependency sqlite 
+    while true
+    do
+        if [ -z "$PKG_CONFIG" ]; then
+        	break
+        fi
+		$PKG_CONFIG sqlite3
+        if [ $? -ne 0 ] ; then
+            break
+        fi
+        CFLAGS="$CFLAGS `$PKG_CONFIG --cflags sqlite3`"
+        LDFLAGS="$LDFLAGS `$PKG_CONFIG --libs sqlite3`"
+		echo yes
+        return 0
+    done
+	
+	echo no
+	return 1
+}
 dependency_gtk3()
 {
     printf "checking for gtk3... "
@@ -721,6 +743,31 @@
     echo "TK_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
 fi
 
+# Target: note
+CFLAGS=
+LDFLAGS=
+CXXFLAGS=
+
+dependency_sqlite
+if [ $? -ne 0 ]; then
+	DEPENDENCIES_FAILED="$DEPENDENCIES_FAILED sqlite "
+	ERROR=1
+fi
+
+# Features
+
+
+echo >> $TEMP_DIR/config.mk
+if [ ! -z "${CFLAGS}" ]; then
+    echo "NOTE_CFLAGS  += $CFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${CXXFLAGS}" ]; then
+    echo "NOTE_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk
+fi
+if [ ! -z "${LDFLAGS}" ]; then
+    echo "NOTE_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk
+fi
+
 if [ $ERROR -ne 0 ]; then
 	echo
 	echo "Error: Unresolved dependencies"
--- a/make/project.xml	Fri Dec 11 11:46:19 2020 +0100
+++ b/make/project.xml	Fri Dec 11 18:32:54 2020 +0100
@@ -58,6 +58,10 @@
 		<make>PACKAGE_SCRIPT = package_unix.sh</make>
 	</dependency>
 	
+	<dependency name="sqlite">
+		<pkgconfig>sqlite3</pkgconfig>
+	</dependency>
+	
 	<target name="tk">
 		<option arg="toolkit">
 			<!--
@@ -105,5 +109,9 @@
 			<default value="motif" />
 		</option>
 	</target>
+	
+	<target name="note">
+		<dependencies>sqlite</dependencies>
+	</target>
 </project>
 

mercurial