From 0251f7e27db0503421b4f4453987bb1102c1a1b5 Mon Sep 17 00:00:00 2001
From: Endi Sukma Dewata <edewata@redhat.com>
Date: Tue, 25 Sep 2012 00:43:31 -0500
Subject: [PATCH] Added VERSION file.

The CMake scripts have been modified to store the version number
in /usr/share/pki/VERSION and in JAR manifest files. These files
can be read by PKI applications to obtain the version number
without having to query the RPM database.

Fixed warnings in Java.cmake file.

Ticket #339
---
 CMakeLists.txt                                     |  2 -
 base/CMakeLists.txt                                |  9 +++++
 base/ca/src/CMakeLists.txt                         |  9 +++++
 base/ca/src/pki-ca.mf                              |  2 +
 base/common/src/CMakeLists.txt                     | 45 ++++++++++++++++++++++
 base/common/src/pki-certsrv.mf                     |  2 +
 base/common/src/pki-cms.mf                         |  2 +
 base/common/src/pki-cmsbundle.mf                   |  2 +
 base/common/src/pki-cmscore.mf                     |  2 +
 base/common/src/pki-tomcat.mf                      |  2 +
 base/console/src/CMakeLists.txt                    |  9 +++++
 base/console/src/pki-console.mf                    |  2 +
 base/java-tools/src/CMakeLists.txt                 |  9 +++++
 .../src/com/netscape/cmstools/cli/MainCLI.java     | 11 ++++++
 base/java-tools/src/pki-tools.mf                   |  2 +
 base/kra/src/CMakeLists.txt                        |  9 +++++
 base/kra/src/pki-kra.mf                            |  2 +
 base/ocsp/src/CMakeLists.txt                       |  9 +++++
 base/ocsp/src/pki-ocsp.mf                          |  2 +
 base/silent/src/CMakeLists.txt                     |  9 +++++
 base/silent/src/pki-silent.mf                      |  2 +
 base/tks/src/CMakeLists.txt                        |  9 +++++
 base/tks/src/pki-tks.mf                            |  2 +
 base/util/src/CMakeLists.txt                       | 18 +++++++++
 base/util/src/pki-cmsutil.mf                       |  2 +
 base/util/src/pki-nsutil.mf                        |  2 +
 cmake/Modules/Java.cmake                           |  8 ++--
 specs/pki-core.spec                                | 10 +++--
 28 files changed, 184 insertions(+), 10 deletions(-)
 create mode 100644 base/ca/src/pki-ca.mf
 create mode 100644 base/common/src/pki-certsrv.mf
 create mode 100644 base/common/src/pki-cms.mf
 create mode 100644 base/common/src/pki-cmsbundle.mf
 create mode 100644 base/common/src/pki-cmscore.mf
 create mode 100644 base/common/src/pki-tomcat.mf
 create mode 100644 base/console/src/pki-console.mf
 create mode 100644 base/java-tools/src/pki-tools.mf
 create mode 100644 base/kra/src/pki-kra.mf
 create mode 100644 base/ocsp/src/pki-ocsp.mf
 create mode 100644 base/silent/src/pki-silent.mf
 create mode 100644 base/tks/src/pki-tks.mf
 create mode 100644 base/util/src/pki-cmsutil.mf
 create mode 100644 base/util/src/pki-nsutil.mf

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b99211bd439843d3bc30bf8802df57af993750c0..bf61fbc48028f133691d166820ad80951a71bf0b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,7 +65,6 @@ macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source buil
 # add macros
 include(MacroCopyFile)
 include(Java)
-include(UseJava)
 
 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/classes)
 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/dist)
@@ -170,4 +169,3 @@ elseif (APPLICATION_FLAVOR_DOGTAG_PKI_THEME)
 elseif (APPLICATION_FLAVOR_REDHAT_PKI_THEME)
     add_subdirectory(redhat)
 endif ()
-
diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt
index 7340573746f1633f46657c2067aafa711a5aff58..01a7d1d40807b97b8179de3f08992d000cceed08 100644
--- a/base/CMakeLists.txt
+++ b/base/CMakeLists.txt
@@ -34,3 +34,12 @@ if (APPLICATION_FLAVOR_PKI_MIGRATE)
     add_subdirectory(test)
     add_subdirectory(migrate)
 endif (APPLICATION_FLAVOR_PKI_MIGRATE)
+
+file(WRITE VERSION ${APPLICATION_VERSION})
+
+install(
+    FILES
+        VERSION
+    DESTINATION
+        ${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}
+)
diff --git a/base/ca/src/CMakeLists.txt b/base/ca/src/CMakeLists.txt
index 09cea8ac27168e1c9c61febedb45cc82cb098321..9bfbb23a2d3863718051dd3c0d33297b2e176b02 100644
--- a/base/ca/src/CMakeLists.txt
+++ b/base/ca/src/CMakeLists.txt
@@ -46,9 +46,18 @@ javac(pki-ca-classes
         symkey pki-nsutil pki-cmsutil pki-certsrv pki-cms pki-cmscore
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-ca.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-ca.mf
+)
+
 jar(pki-ca-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-ca-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-ca.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
diff --git a/base/ca/src/pki-ca.mf b/base/ca/src/pki-ca.mf
new file mode 100644
index 0000000000000000000000000000000000000000..056f7bc081a1688cba4cd7cd586652a2b4650242
--- /dev/null
+++ b/base/ca/src/pki-ca.mf
@@ -0,0 +1,2 @@
+Name: pki-ca
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/common/src/CMakeLists.txt b/base/common/src/CMakeLists.txt
index fb4f5675ea74de52ea122946d390cb807045071a..516c7ad2de0acc067d51a66d71b304c871a487c2 100644
--- a/base/common/src/CMakeLists.txt
+++ b/base/common/src/CMakeLists.txt
@@ -136,9 +136,18 @@ javac(pki-certsrv-classes
         pki-nsutil pki-cmsutil
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-certsrv.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-certsrv.mf
+)
+
 jar(pki-certsrv-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-certsrv-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-certsrv.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
@@ -187,9 +196,18 @@ javac(pki-cms-classes
         pki-nsutil pki-cmsutil pki-certsrv
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-cms.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-cms.mf
+)
+
 jar(pki-cms-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-cms-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-cms.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
@@ -232,9 +250,18 @@ javac(pki-tomcat-classes
         pki-cms
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-tomcat.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-tomcat.mf
+)
+
 jar(pki-tomcat-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-tomcat-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-tomcat.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
@@ -281,9 +308,18 @@ javac(pki-cmscore-classes
         pki-nsutil pki-cmsutil pki-certsrv pki-cms pki-tomcat
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-cmscore.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-cmscore.mf
+)
+
 jar(pki-cmscore-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-cmscore-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-cmscore.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
@@ -313,9 +349,18 @@ set(PKI_CMSCORE_JAR ${CMAKE_BINARY_DIR}/dist/pki-cmscore.jar CACHE INTERNAL "pki
 
 
 # build pki-cmsbundle
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-cmsbundle.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-cmsbundle.mf
+)
+
 jar(pki-cmsbundle-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-cmsbundle-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-cmsbundle.mf
     FILES
         LogMessages.properties
         UserMessages.properties
diff --git a/base/common/src/pki-certsrv.mf b/base/common/src/pki-certsrv.mf
new file mode 100644
index 0000000000000000000000000000000000000000..fe2ed1ffef99a22ba8081d775e056b82ef22c874
--- /dev/null
+++ b/base/common/src/pki-certsrv.mf
@@ -0,0 +1,2 @@
+Name: pki-certsrv
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/common/src/pki-cms.mf b/base/common/src/pki-cms.mf
new file mode 100644
index 0000000000000000000000000000000000000000..2c6f8010f179222495343d65044aaaab290c9ebe
--- /dev/null
+++ b/base/common/src/pki-cms.mf
@@ -0,0 +1,2 @@
+Name: pki-cms
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/common/src/pki-cmsbundle.mf b/base/common/src/pki-cmsbundle.mf
new file mode 100644
index 0000000000000000000000000000000000000000..84d6f0e7a40256a309c29171c0a61bd58dccc71d
--- /dev/null
+++ b/base/common/src/pki-cmsbundle.mf
@@ -0,0 +1,2 @@
+Name: pki-cmsbundle
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/common/src/pki-cmscore.mf b/base/common/src/pki-cmscore.mf
new file mode 100644
index 0000000000000000000000000000000000000000..1b1a03f5094795009885392da67292e9106d8d36
--- /dev/null
+++ b/base/common/src/pki-cmscore.mf
@@ -0,0 +1,2 @@
+Name: pki-cmscore
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/common/src/pki-tomcat.mf b/base/common/src/pki-tomcat.mf
new file mode 100644
index 0000000000000000000000000000000000000000..a6e4889b84847144e3d65b684cefbb3b557ae9cb
--- /dev/null
+++ b/base/common/src/pki-tomcat.mf
@@ -0,0 +1,2 @@
+Name: pki-tomcat
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/console/src/CMakeLists.txt b/base/console/src/CMakeLists.txt
index 335411e39b36cec1ed002959b7da251cb5e683dd..f53f2ddd798d81c785e13f6ef8a82a427511f559 100644
--- a/base/console/src/CMakeLists.txt
+++ b/base/console/src/CMakeLists.txt
@@ -98,10 +98,19 @@ javac(pki-console-classes
         ${CMAKE_BINARY_DIR}/classes
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-console.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-console.mf
+)
+
 # package console classes and resources
 jar(pki-console-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-console-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-console.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
diff --git a/base/console/src/pki-console.mf b/base/console/src/pki-console.mf
new file mode 100644
index 0000000000000000000000000000000000000000..91ec08905f83a1ff837e01aa9933f6128475fedd
--- /dev/null
+++ b/base/console/src/pki-console.mf
@@ -0,0 +1,2 @@
+Name: pki-console
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/java-tools/src/CMakeLists.txt b/base/java-tools/src/CMakeLists.txt
index c01b425a657e1265f4964b9499d73154ebda8fe3..d2169e1c2ff5cb95e11657162698598c85e9202b 100644
--- a/base/java-tools/src/CMakeLists.txt
+++ b/base/java-tools/src/CMakeLists.txt
@@ -97,9 +97,18 @@ javac(pki-tools-classes
         pki-nsutil pki-cmsutil pki-certsrv
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-tools.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-tools.mf
+)
+
 jar(pki-tools-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-tools-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-tools.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
diff --git a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
index a6350e5d8b42e127d773e295805bbfdf6a1a48b9..44ccf95110364e44427af4daee49f35308b89dab 100644
--- a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
@@ -50,6 +50,11 @@ public class MainCLI extends CLI {
         addModule(new UserCLI(this));
     }
 
+    public void printVersion() {
+        Package pkg = MainCLI.class.getPackage();
+        System.out.println("PKI Command-Line Interface "+pkg.getImplementationVersion());
+    }
+
     public void printHelp() {
 
         formatter.printHelp(name+" [OPTIONS..] <command> [ARGS..]", options);
@@ -118,6 +123,7 @@ public class MainCLI extends CLI {
 
         options.addOption("v", false, "Verbose");
         options.addOption(null, "help", false, "Help");
+        options.addOption(null, "version", false, "Version");
     }
 
     public void parseOptions(CommandLine cmd) throws URISyntaxException {
@@ -170,6 +176,11 @@ public class MainCLI extends CLI {
 
             String[] cmdArgs = cmd.getArgs();
 
+            if (cmd.hasOption("version")) {
+                printVersion();
+                System.exit(1);
+            }
+
             if (cmdArgs.length == 0 || cmd.hasOption("help")) {
                 printHelp();
                 System.exit(1);
diff --git a/base/java-tools/src/pki-tools.mf b/base/java-tools/src/pki-tools.mf
new file mode 100644
index 0000000000000000000000000000000000000000..3cf1821aa6c1c7dff5b248e06f77a81214e6dc3d
--- /dev/null
+++ b/base/java-tools/src/pki-tools.mf
@@ -0,0 +1,2 @@
+Name: pki-tools
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/kra/src/CMakeLists.txt b/base/kra/src/CMakeLists.txt
index 5f5e3f01662cf3939e2901cd750fa358ed220d51..1d4f75b698164c946185b837f5abdc4b6a8cc290 100644
--- a/base/kra/src/CMakeLists.txt
+++ b/base/kra/src/CMakeLists.txt
@@ -91,9 +91,18 @@ javac(pki-kra-classes
         symkey pki-nsutil pki-cmsutil pki-certsrv pki-cms pki-cmscore
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-kra.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-kra.mf
+)
+
 jar(pki-kra-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-kra-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-kra.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
diff --git a/base/kra/src/pki-kra.mf b/base/kra/src/pki-kra.mf
new file mode 100644
index 0000000000000000000000000000000000000000..3234421e7dd149b3642941d1a6994156e2e79bfa
--- /dev/null
+++ b/base/kra/src/pki-kra.mf
@@ -0,0 +1,2 @@
+Name: pki-kra
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/ocsp/src/CMakeLists.txt b/base/ocsp/src/CMakeLists.txt
index 34b1ec4c26155eb237661d31dc0083f1b4bd3d38..2ea6a15362e5fcdff083cc58420c3cf1e993db58 100644
--- a/base/ocsp/src/CMakeLists.txt
+++ b/base/ocsp/src/CMakeLists.txt
@@ -91,9 +91,18 @@ javac(pki-ocsp-classes
         symkey pki-nsutil pki-cmsutil pki-certsrv pki-cms pki-cmscore
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-ocsp.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-ocsp.mf
+)
+
 jar(pki-ocsp-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-ocsp-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-ocsp.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
diff --git a/base/ocsp/src/pki-ocsp.mf b/base/ocsp/src/pki-ocsp.mf
new file mode 100644
index 0000000000000000000000000000000000000000..999e7d992056b19d9ad991b8ebd33559c171b6d8
--- /dev/null
+++ b/base/ocsp/src/pki-ocsp.mf
@@ -0,0 +1,2 @@
+Name: pki-ocsp
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/silent/src/CMakeLists.txt b/base/silent/src/CMakeLists.txt
index 0240439ce1fdf2bc0ea2c540cecbf6ef203f923d..00e1c4e463abe6e4b6286be1909912cc39381d37 100644
--- a/base/silent/src/CMakeLists.txt
+++ b/base/silent/src/CMakeLists.txt
@@ -39,9 +39,18 @@ javac(pki-silent-classes
         symkey pki-cmsutil pki-nsutil pki-certsrv pki-cms
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-silent.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-silent.mf
+)
+
 jar(pki-silent-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-silent-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-silent.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
diff --git a/base/silent/src/pki-silent.mf b/base/silent/src/pki-silent.mf
new file mode 100644
index 0000000000000000000000000000000000000000..5b66b7ffcf21ba33946abfb61ef2e42e0cd2998b
--- /dev/null
+++ b/base/silent/src/pki-silent.mf
@@ -0,0 +1,2 @@
+Name: pki-silent
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/tks/src/CMakeLists.txt b/base/tks/src/CMakeLists.txt
index 10660f51111ab0c2e0daa8e734b23873ae4deb57..cb901c446a6f8abb0292cca3e9ccd60d46001bc2 100644
--- a/base/tks/src/CMakeLists.txt
+++ b/base/tks/src/CMakeLists.txt
@@ -92,9 +92,18 @@ javac(pki-tks-classes
         symkey pki-nsutil pki-cmsutil pki-certsrv pki-cms pki-cmscore
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-tks.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-tks.mf
+)
+
 jar(pki-tks-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-tks-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-tks.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
diff --git a/base/tks/src/pki-tks.mf b/base/tks/src/pki-tks.mf
new file mode 100644
index 0000000000000000000000000000000000000000..a9f3a3e50d04ed7f217e729fb0074f36750ebb49
--- /dev/null
+++ b/base/tks/src/pki-tks.mf
@@ -0,0 +1,2 @@
+Name: pki-tks
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/util/src/CMakeLists.txt b/base/util/src/CMakeLists.txt
index 0f8eb496fb1e0f592776eb01d63442e33b608ba0..a39d9d828168abcfcfd3525f2ea4d9c875f11342 100644
--- a/base/util/src/CMakeLists.txt
+++ b/base/util/src/CMakeLists.txt
@@ -57,9 +57,18 @@ javac(pki-nsutil-classes
         ${CMAKE_BINARY_DIR}/classes
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-nsutil.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-nsutil.mf
+)
+
 jar(pki-nsutil-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-nsutil-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-nsutil.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
@@ -101,9 +110,18 @@ javac(pki-cmsutil-classes
         pki-nsutil
 )
 
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/pki-cmsutil.mf
+    ${CMAKE_CURRENT_BINARY_DIR}/pki-cmsutil.mf
+)
+
 jar(pki-cmsutil-jar
     CREATE
         ${CMAKE_BINARY_DIR}/dist/pki-cmsutil-${APPLICATION_VERSION}.jar
+    OPTIONS
+        m
+    PARAMS
+        ${CMAKE_CURRENT_BINARY_DIR}/pki-cmsutil.mf
     INPUT_DIR
         ${CMAKE_BINARY_DIR}/classes
     FILES
diff --git a/base/util/src/pki-cmsutil.mf b/base/util/src/pki-cmsutil.mf
new file mode 100644
index 0000000000000000000000000000000000000000..87382b9aa7a70b1dab32b193108ba75bbe311e99
--- /dev/null
+++ b/base/util/src/pki-cmsutil.mf
@@ -0,0 +1,2 @@
+Name: pki-cmsutil
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/base/util/src/pki-nsutil.mf b/base/util/src/pki-nsutil.mf
new file mode 100644
index 0000000000000000000000000000000000000000..272200d679a2cc6bb04c01f493e5fe4fd75139d1
--- /dev/null
+++ b/base/util/src/pki-nsutil.mf
@@ -0,0 +1,2 @@
+Name: pki-nsutil
+Implementation-Version: ${APPLICATION_VERSION}
\ No newline at end of file
diff --git a/cmake/Modules/Java.cmake b/cmake/Modules/Java.cmake
index b0e561a2c69665bc69fdfa35e2b0ed0cf239a6f5..ea74df74b528198d36497ada0728691afe9951bd 100644
--- a/cmake/Modules/Java.cmake
+++ b/cmake/Modules/Java.cmake
@@ -177,7 +177,7 @@ function(jar target)
                 -Dexclude="${exclude_${i}}"
                 -P ${CMAKE_MODULE_PATH}/JavaFileList.cmake
             COMMAND ${CMAKE_Java_ARCHIVE}
-                -${operation}${options} ${params}
+                ${operation}${options} ${params}
                 @${file_list_${i}}
             WORKING_DIRECTORY ${input_dir_${i}}
         )
@@ -227,7 +227,7 @@ function(javadoc target)
 
             endif(param STREQUAL "SOURCEPATH")
 
-        endif(arg MATCHES "(SOURCEPATH|CLASSPATH|FILES|PACKAGES|SUBPACKAGES|EXCLUDE|DEST|DEPENDS)")
+        endif(arg MATCHES "(SOURCEPATH|CLASSPATH|FILES|PACKAGES|SUBPACKAGES|EXCLUDE|OPTIONS|DEST|DEPENDS)")
 
     endforeach(arg)
 
@@ -243,7 +243,7 @@ function(javadoc target)
         foreach (option ${options})
            set(command ${command} ${option})
         endforeach(option ${options})
-    endif(sourcepath)
+    endif(options)
 
     if (sourcepath)
         set(tmp)
@@ -265,7 +265,7 @@ function(javadoc target)
         set(tmp)
         foreach (package ${subpackages})
            set(tmp "${tmp}:${package}")
-        endforeach(path)
+        endforeach(package)
         set(command ${command} -subpackages ${tmp})
     endif(subpackages)
 
diff --git a/specs/pki-core.spec b/specs/pki-core.spec
index cddb0ebcf3d0f2de76adfbf25ef975ceae7bde9f..feef82ab26e6bb4a156195ed27cbb506eef12b0e 100644
--- a/specs/pki-core.spec
+++ b/specs/pki-core.spec
@@ -14,7 +14,7 @@ distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 
 Name:             pki-core
 Version:          10.0.0
-Release:          %{?relprefix}34%{?prerel}%{?dist}
+Release:          %{?relprefix}35%{?prerel}%{?dist}
 Summary:          Certificate System - PKI Core Components
 URL:              http://pki.fedoraproject.org/
 License:          GPLv2
@@ -1039,6 +1039,8 @@ fi
 %files -n pki-base
 %defattr(-,root,root,-)
 %doc base/common/LICENSE
+%dir %{_datadir}/pki
+%{_datadir}/pki/VERSION
 %dir %{_javadir}/pki
 %{_javadir}/pki/pki-cmsutil-%{version}.jar
 %{_javadir}/pki/pki-cmsutil.jar
@@ -1056,7 +1058,6 @@ fi
 %{_bindir}/setpin
 %{_bindir}/sslget
 %{_bindir}/tkstool
-%dir %{_datadir}/pki
 %{_datadir}/pki/native-tools/
 %{_bindir}/AtoB
 %{_bindir}/AuditVerify
@@ -1092,7 +1093,6 @@ fi
 %dir %{python_sitelib}/pki
 %{python_sitelib}/pki/_*
 %{python_sitelib}/pki/deployment/
-%dir %{_datadir}/pki
 %dir %{_datadir}/pki/deployment
 %{_datadir}/pki/deployment/config/
 %dir %{_datadir}/pki/deployment/spawn
@@ -1134,7 +1134,6 @@ fi
 %{_bindir}/pkicreate
 %{_bindir}/pkiremove
 %{_bindir}/pki-setup-proxy
-%dir %{_datadir}/pki
 %dir %{_datadir}/pki/scripts
 %{_datadir}/pki/scripts/pkicommon.pm
 %{_datadir}/pki/scripts/functions
@@ -1299,6 +1298,9 @@ fi
 
 
 %changelog
+* Tue Sep 25 2012 Endi S. Dewata <edewata@redhat.com> 10.0.0-0.35.a1
+- Added VERSION file
+
 * Mon Sep 24 2012 Endi S. Dewata <edewata@redhat.com> 10.0.0-0.34.a1
 - Merged pki-setup into pki-server
 
-- 
1.7.11.2

