>From f5293bac716a11721ab601ff027ce141230fd501 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Thu, 23 Feb 2017 03:18:50 +0100
Subject: [PATCH] Fixed build problem on RHEL.

The CMake create_symlink commands do not work on RHEL if the
source does not exist yet, so they have been replaced with regular
ln commands.
---
 base/ca/CMakeLists.txt   | 18 +++++++++---------
 base/kra/CMakeLists.txt  | 18 +++++++++---------
 base/ocsp/CMakeLists.txt | 18 +++++++++---------
 base/tks/CMakeLists.txt  | 18 +++++++++---------
 base/tps/CMakeLists.txt  | 18 +++++++++---------
 5 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/base/ca/CMakeLists.txt b/base/ca/CMakeLists.txt
index f8b929982eaba13839a379054425cee69894297f..a5f893720ddbe787bbe5feac8b0d6ff6823c0d1a 100644
--- a/base/ca/CMakeLists.txt
+++ b/base/ca/CMakeLists.txt
@@ -18,14 +18,14 @@ add_custom_target(pki-ca-lib ALL)
 
 add_custom_command(
     TARGET pki-ca-lib
-    COMMAND ${CMAKE_COMMAND} -E make_directory lib
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-nsutil.jar lib/pki-nsutil.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmsutil.jar lib/pki-cmsutil.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-certsrv.jar lib/pki-certsrv.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cms.jar lib/pki-cms.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmscore.jar lib/pki-cmscore.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmsbundle.jar lib/pki-cmsbundle.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-ca.jar lib/pki-ca.jar
+    COMMAND ${CMAKE_COMMAND} -E make_directory webapp/lib
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-nsutil.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-nsutil.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmsutil.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmsutil.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-certsrv.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-certsrv.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cms.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cms.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmscore.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmscore.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmsbundle.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmsbundle.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-ca.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-ca.jar
 )
 
 # install directories
@@ -40,7 +40,7 @@ install(
 
 install(
     DIRECTORY
-        ${CMAKE_CURRENT_BINARY_DIR}/lib/
+        ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/
     DESTINATION
         ${DATA_INSTALL_DIR}/ca/webapps/ca/WEB-INF/lib
 )
diff --git a/base/kra/CMakeLists.txt b/base/kra/CMakeLists.txt
index 96e198a213ec57a70c57fb3f60bea65dd5dd8d47..0bcb7066ab84d864a10cdf7ad3bc8266633958b3 100644
--- a/base/kra/CMakeLists.txt
+++ b/base/kra/CMakeLists.txt
@@ -18,14 +18,14 @@ add_custom_target(pki-kra-lib ALL)
 
 add_custom_command(
     TARGET pki-kra-lib
-    COMMAND ${CMAKE_COMMAND} -E make_directory lib
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-nsutil.jar lib/pki-nsutil.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmsutil.jar lib/pki-cmsutil.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-certsrv.jar lib/pki-certsrv.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cms.jar lib/pki-cms.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmscore.jar lib/pki-cmscore.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmsbundle.jar lib/pki-cmsbundle.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-kra.jar lib/pki-kra.jar
+    COMMAND ${CMAKE_COMMAND} -E make_directory webapp/lib
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-nsutil.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-nsutil.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmsutil.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmsutil.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-certsrv.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-certsrv.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cms.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cms.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmscore.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmscore.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmsbundle.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmsbundle.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-kra.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-kra.jar
 )
 
 # install directories
@@ -40,7 +40,7 @@ install(
 
 install(
     DIRECTORY
-        ${CMAKE_CURRENT_BINARY_DIR}/lib/
+        ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/
     DESTINATION
         ${DATA_INSTALL_DIR}/kra/webapps/kra/WEB-INF/lib
 )
diff --git a/base/ocsp/CMakeLists.txt b/base/ocsp/CMakeLists.txt
index 78f7a80b94e1d05aa17e97eb9780f69952e970ab..38efd4677f8d64ec62124ab9d5cb61a2f2f4e4bb 100644
--- a/base/ocsp/CMakeLists.txt
+++ b/base/ocsp/CMakeLists.txt
@@ -18,14 +18,14 @@ add_custom_target(pki-ocsp-lib ALL)
 
 add_custom_command(
     TARGET pki-ocsp-lib
-    COMMAND ${CMAKE_COMMAND} -E make_directory lib
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-nsutil.jar lib/pki-nsutil.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmsutil.jar lib/pki-cmsutil.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-certsrv.jar lib/pki-certsrv.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cms.jar lib/pki-cms.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmscore.jar lib/pki-cmscore.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmsbundle.jar lib/pki-cmsbundle.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-ocsp.jar lib/pki-ocsp.jar
+    COMMAND ${CMAKE_COMMAND} -E make_directory webapp/lib
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-nsutil.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-nsutil.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmsutil.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmsutil.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-certsrv.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-certsrv.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cms.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cms.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmscore.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmscore.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmsbundle.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmsbundle.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-ocsp.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-ocsp.jar
 )
 
 # install directories
@@ -40,7 +40,7 @@ install(
 
 install(
     DIRECTORY
-        ${CMAKE_CURRENT_BINARY_DIR}/lib/
+        ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/
     DESTINATION
         ${DATA_INSTALL_DIR}/ocsp/webapps/ocsp/WEB-INF/lib
 )
diff --git a/base/tks/CMakeLists.txt b/base/tks/CMakeLists.txt
index f46b4aa210e6dfed672fac599b9394b67462ea9b..789005779bbc222c9123552e1ab4ea9bd37b830d 100644
--- a/base/tks/CMakeLists.txt
+++ b/base/tks/CMakeLists.txt
@@ -18,14 +18,14 @@ add_custom_target(pki-tks-lib ALL)
 
 add_custom_command(
     TARGET pki-tks-lib
-    COMMAND ${CMAKE_COMMAND} -E make_directory lib
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-nsutil.jar lib/pki-nsutil.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmsutil.jar lib/pki-cmsutil.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-certsrv.jar lib/pki-certsrv.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cms.jar lib/pki-cms.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmscore.jar lib/pki-cmscore.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmsbundle.jar lib/pki-cmsbundle.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-tks.jar lib/pki-tks.jar
+    COMMAND ${CMAKE_COMMAND} -E make_directory webapp/lib
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-nsutil.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-nsutil.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmsutil.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmsutil.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-certsrv.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-certsrv.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cms.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cms.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmscore.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmscore.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmsbundle.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmsbundle.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-tks.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-tks.jar
 )
 
 # install directories
@@ -40,7 +40,7 @@ install(
 
 install(
     DIRECTORY
-        ${CMAKE_CURRENT_BINARY_DIR}/lib/
+        ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/
     DESTINATION
         ${DATA_INSTALL_DIR}/tks/webapps/tks/WEB-INF/lib
 )
diff --git a/base/tps/CMakeLists.txt b/base/tps/CMakeLists.txt
index 863a2a9db8eb9f32657ae88cba564b32539c89e6..652f0c9142d0058efe03387baf8237ef8c717031 100644
--- a/base/tps/CMakeLists.txt
+++ b/base/tps/CMakeLists.txt
@@ -20,14 +20,14 @@ add_custom_target(pki-tps-lib ALL)
 
 add_custom_command(
     TARGET pki-tps-lib
-    COMMAND ${CMAKE_COMMAND} -E make_directory lib
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-nsutil.jar lib/pki-nsutil.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmsutil.jar lib/pki-cmsutil.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-certsrv.jar lib/pki-certsrv.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cms.jar lib/pki-cms.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmscore.jar lib/pki-cmscore.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-cmsbundle.jar lib/pki-cmsbundle.jar
-    COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/java/pki/pki-tps.jar lib/pki-tps.jar
+    COMMAND ${CMAKE_COMMAND} -E make_directory webapp/lib
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-nsutil.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-nsutil.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmsutil.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmsutil.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-certsrv.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-certsrv.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cms.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cms.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmscore.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmscore.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-cmsbundle.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-cmsbundle.jar
+    COMMAND /usr/bin/ln -sf /usr/share/java/pki/pki-tps.jar ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/pki-tps.jar
 )
 
 # install manual pages
@@ -54,7 +54,7 @@ install(
 
 install(
     DIRECTORY
-        ${CMAKE_CURRENT_BINARY_DIR}/lib/
+        ${CMAKE_CURRENT_BINARY_DIR}/webapp/lib/
     DESTINATION
         ${DATA_INSTALL_DIR}/tps/webapps/tps/WEB-INF/lib
 )
-- 
2.9.3

