[PATCH 2 of 2] Use static nss from subrepository on windows
Wald Commits
scm-commit at wald.intevation.org
Mon Jul 28 13:03:55 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1406545425 -7200
# Node ID 8081ed84589d49b1510004a4cf99080eb3cab3d2
# Parent e1bb60a8129b1dd8c431a1ec42699c94089bb042
Use static nss from subrepository on windows
diff -r e1bb60a8129b -r 8081ed84589d CMakeLists.txt
--- a/CMakeLists.txt Mon Jul 28 13:03:00 2014 +0200
+++ b/CMakeLists.txt Mon Jul 28 13:03:45 2014 +0200
@@ -36,7 +36,17 @@
find_package(Qt5Widgets)
-find_package(NSS)
+if (NOT WIN32)
+ find_package(NSS)
+else ()
+ # Use static NSS for Windows
+ if (NOT EXISTS "${CMAKE_SOURCE_DIR}/nss-cmake-static")
+ MESSAGE(FATAL_ERROR "Could not find nss-cmake-static checkout. Please run: \n hg clone https://wald.intevation.org/hg/trustbridge/nss-cmake-static '${CMAKE_SOURCE_DIR}/nss-cmake-static'")
+ endif()
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/nss-cmake-static/")
+ set(NSS_STATIC_PATH "${CMAKE_SOURCE_DIR}/nss-cmake-static")
+ include (nss-cmake-static)
+endif()
# Use cmake's automoc and make sure the generated files are included
set(CMAKE_AUTOMOC ON)
@@ -60,7 +70,7 @@
set(WARN_HARDENING_FLAGS " -Wextra -Wconversion -Wformat-security")
# Hardening flags
-set(HARDENING_FLAGS " -Wall -Werror -fstack-protector-all -fno-exceptions")
+set(HARDENING_FLAGS " -Wall -fstack-protector-all -fno-exceptions")
set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector")
set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4")
set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0")
@@ -99,6 +109,15 @@
add_dependencies(static_check flawfinder)
endif (FLAWFINDER_PATH)
+if(WIN32)
+ add_subdirectory(nss-cmake-static)
+ add_definitions(-D_WIN32_WINNT=0x0600) # Windows vista. NSS defines its own winver.
+endif()
+
+# No chance to compile nss with -Werror
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
+
add_subdirectory(common)
add_subdirectory(cinst)
@@ -113,10 +132,6 @@
add_subdirectory(doc)
# Configure packaging script for testing
-list(GET NSS_LIBRARIES 1 NSS_BASE_DIR)
-get_filename_component(NSS_BASE_DIR ${NSS_BASE_DIR} PATH)
-
-set(NSS_BASE_DIR "${NSS_BASE_DIR}/..")
configure_file (packaging/tmp-createpackage.sh.in packaging/tmp-createpackage.sh @ONLY)
configure_file (packaging/create-dist-package.sh.in packaging/create-dist-package.sh @ONLY)
configure_file (packaging/linux-createpackage.sh.in packaging/linux-createpackage.sh @ONLY)
diff -r e1bb60a8129b -r 8081ed84589d INSTALL
--- a/INSTALL Mon Jul 28 13:03:00 2014 +0200
+++ b/INSTALL Mon Jul 28 13:03:45 2014 +0200
@@ -63,6 +63,7 @@
hg clone https://wald.intevation.org/hg/trustbridge/
cd trustbridge
+ hg clone https://wald.intevation.org/hg/trustbridge/nss-cmake-static
mkdir build-linux
cd build-linux
cmake .. -DCMAKE_PREFIX_PATH=$YOURPREFIX
diff -r e1bb60a8129b -r 8081ed84589d cinst/CMakeLists.txt
--- a/cinst/CMakeLists.txt Mon Jul 28 13:03:00 2014 +0200
+++ b/cinst/CMakeLists.txt Mon Jul 28 13:03:45 2014 +0200
@@ -33,21 +33,21 @@
# ----------------------------------------------------------------------
# Mozilla nss store specific certificate installer:
+set(MOZILLA_SOURCES
+ ${CMAKE_CURRENT_SOURCE_DIR}/nss-secitemlist.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/mozilla.c
+ )
-if(NSS_FOUND)
- include_directories(${NSS_INCLUDE_DIRS})
- set(MOZILLA_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/nss-secitemlist.c
- ${CMAKE_CURRENT_SOURCE_DIR}/mozilla.c
- )
- add_executable(mozilla ${MOZILLA_SOURCES})
- target_link_libraries(mozilla
- trustbridge_common
- ${POLARSSL_LIBRARIES}
- ${NSS_LIBRARIES}
- ${PROFILING_LIBS})
- set_target_properties(mozilla PROPERTIES COMPILE_FLAGS "-std=c99")
- install(TARGETS mozilla DESTINATION bin)
+if(WIN32 OR NSS_FOUND)
+ include_directories(${NSS_INCLUDE_DIRS})
+ add_executable(mozilla ${MOZILLA_SOURCES})
+ target_link_libraries(mozilla
+ trustbridge_common
+ ${POLARSSL_LIBRARIES}
+ ${NSS_LIBRARIES}
+ ${PROFILING_LIBS})
+ set_target_properties(mozilla PROPERTIES COMPILE_FLAGS "-std=c99")
+ install(TARGETS mozilla DESTINATION bin)
else()
message(STATUS "WARNING: Could not find nss. Mozilla cert installer will not be build!")
endif()
diff -r e1bb60a8129b -r 8081ed84589d packaging/create-dist-package.sh.in
--- a/packaging/create-dist-package.sh.in Mon Jul 28 13:03:00 2014 +0200
+++ b/packaging/create-dist-package.sh.in Mon Jul 28 13:03:45 2014 +0200
@@ -4,11 +4,6 @@
set -x
set -e
-if [ ! -d "$WINDOWS_NSSDIR" ]; then
- echo "ERROR: Please set WINDOWS_NSSDIR to the location of your nss binaries"
- exit 1
-fi
-
if [ ! -x `which wine` ]; then
echo "ERROR: Could not find wine."
exit 1
@@ -36,7 +31,6 @@
echo "productname_short=TrustBridge" >> $TMPDIR/meta.ini
echo "description=TrustBridge" >> $TMPDIR/meta.ini
echo "size=$EST_SIZE" >> $TMPDIR/meta.ini
-cp $WINDOWS_NSSDIR/*.dll $TMPDIR/windows
# Create a temporary NSIS file for the uninstaller cration
LC_ALL="de_DE.latin-1" makensis -Dfiles_dir=$TMPDIR/windows \
diff -r e1bb60a8129b -r 8081ed84589d packaging/filelist.nsh
--- a/packaging/filelist.nsh Mon Jul 28 13:03:00 2014 +0200
+++ b/packaging/filelist.nsh Mon Jul 28 13:03:45 2014 +0200
@@ -11,16 +11,3 @@
File "${files_dir}${path_sep}cinst.exe"
File "${files_dir}${path_sep}trustbridge.exe"
File "${files_dir}${path_sep}mozilla.exe"
-
-; NSS: This should ultimately be static
-File "${files_dir}${path_sep}nssckbi.dll"
-File "${files_dir}${path_sep}smime3.dll"
-File "${files_dir}${path_sep}nss3.dll"
-File "${files_dir}${path_sep}nssdbm3.dll"
-File "${files_dir}${path_sep}softokn3.dll"
-File "${files_dir}${path_sep}sqlite3.dll"
-File "${files_dir}${path_sep}freebl3.dll"
-File "${files_dir}${path_sep}nssutil3.dll"
-File "${files_dir}${path_sep}libplc4.dll"
-File "${files_dir}${path_sep}libplds4.dll"
-File "${files_dir}${path_sep}libnspr4.dll"
diff -r e1bb60a8129b -r 8081ed84589d packaging/tmp-createpackage.sh.in
--- a/packaging/tmp-createpackage.sh.in Mon Jul 28 13:03:00 2014 +0200
+++ b/packaging/tmp-createpackage.sh.in Mon Jul 28 13:03:45 2014 +0200
@@ -10,13 +10,10 @@
#NSSDIR is hackish as this will be replaced by static compiling
# anyway
-NSSDIR="@NSS_BASE_DIR@/bin/"
-
TMPDIR=$(mktemp -d)
EXEFILES=$(find . -name cinst.exe -o -name trustbridge.exe -o -name mozilla.exe)
-cp $NSSDIR/*.dll $TMPDIR
cp $EXEFILES $TMPDIR
EST_SIZE=$(du -s $TMPDIR | cut -f 1)
diff -r e1bb60a8129b -r 8081ed84589d ui/tests/CMakeLists.txt
--- a/ui/tests/CMakeLists.txt Mon Jul 28 13:03:00 2014 +0200
+++ b/ui/tests/CMakeLists.txt Mon Jul 28 13:03:45 2014 +0200
@@ -137,7 +137,7 @@
endif()
endif ()
-if (NSS_FOUND)
+if (WIN32 OR NSS_FOUND)
include_directories(${NSS_INCLUDE_DIRS})
set(NSSTEST_SOURCES
${CMAKE_SOURCE_DIR}/cinst/nssstore_linux.c
More information about the Trustbridge-commits
mailing list