Fix sgauth build (css embedding).
authorMaksym Mamontov <madf@madf.info>
Tue, 7 Jan 2020 20:05:20 +0000 (22:05 +0200)
committerMaksym Mamontov <madf@madf.info>
Tue, 7 Jan 2020 20:05:20 +0000 (22:05 +0200)
sgauth/CMakeLists.txt
sgauth/make_css.sh [deleted file]
sgauth/web.cpp

index fc41d49..1c346b7 100644 (file)
@@ -3,6 +3,11 @@ set ( CPP_FILES main.cpp settings_impl.cpp web.cpp )
 set ( THREADS_PREFER_PTHREAD_FLAG ON )
 find_package ( Threads REQUIRED )
 
+file ( READ sgauth.css CSS_DATA )
+configure_file ( css.h.in css.h ESCAPE_QUOTES @ONLY )
+
+set ( CMAKE_INCLUDE_CURRENT_DIR ON )
+
 add_executable ( sgauth ${CPP_FILES} )
 
 target_link_libraries ( sgauth conffiles ia crypto common Threads::Threads )
diff --git a/sgauth/make_css.sh b/sgauth/make_css.sh
deleted file mode 100755 (executable)
index b4de011..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-OUT_FILE=css.h
-
-
-echo "const char * css =" > $OUT_FILE
-echo "\"/*------*/\\\\n\"" >> $OUT_FILE
-sed -e 's/$/\\n"/g' -e 's/^/"/g' sgauth.css >> $OUT_FILE
-echo ";" >> $OUT_FILE
-
index 8c23482..a162acc 100644 (file)
@@ -426,7 +426,7 @@ const char * replyHeader =
 const char * replyFooter= "\n\n";
 
 send(outerSocket, replyHeader, strlen(replyHeader), 0);
-send(outerSocket, css, strlen(css), 0);
+send(outerSocket, SGAuth::css, strlen(SGAuth::css), 0);
 send(outerSocket, replyFooter, strlen(replyFooter), 0);
 
 return 0;