summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2009-07-03 01:20:23 -0400
committerKohei Yoshida <kyoshida@novell.com>2009-07-03 01:20:23 -0400
commit33327ab1eeda4647a4b479f4663fcd81d9421a6e (patch)
tree1663ebd5e4803218564d94cbf688a88e6aa6439f
parent09715d9740e8fbbdcedf2a7e50c924fbed04a8bd (diff)
Now the extension is complete. DataPilot now offers the 3rd option.
-rwxr-xr-xbin/make_manifest.py98
-rw-r--r--cmake/CMakeLists.txt29
2 files changed, 119 insertions, 8 deletions
diff --git a/bin/make_manifest.py b/bin/make_manifest.py
new file mode 100755
index 0000000..b8a3084
--- /dev/null
+++ b/bin/make_manifest.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+
+import xml.dom.minidom, sys, os, os.path
+
+def error (msg, abortAfter=True):
+ sys.stderr.write(msg + "\n")
+ if abortAfter:
+ sys.exit(1)
+
+def printNode (node, level=0):
+ outstr = ''
+ if level == 0:
+ outstr += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ indent = " "*level
+ childCount = len(node.childNodes)
+ nodeName = node.localName
+ if node.prefix:
+ nodeName = node.prefix + ":" + nodeName
+ outstr += indent + '<'
+ outstr += nodeName
+
+ for key in node.attributes.keys():
+ attr = node.attributes[key]
+ if attr.prefix == None:
+ outstr += " %s:%s=\"%s\""%(attr.prefix, attr.localName, attr.value)
+ else:
+ outstr += " %s:%s=\"%s\""%(attr.prefix, attr.localName, attr.value)
+
+ if childCount == 0:
+ outstr += "/>\n"
+ else:
+ outstr += ">\n"
+
+ for child in node.childNodes:
+ outstr += printNode(child, level+1)
+
+ outstr += indent + "</%s>\n"%nodeName
+
+ return outstr
+
+
+def insertFileEntry (doc, parentNode, mediaType, fullPath):
+ elem = doc.createElementNS(None, "manifest:file-entry")
+ elem.setAttributeNS(None, "manifest:media-type", mediaType)
+ elem.setAttributeNS(None, "manifest:full-path", fullPath)
+ parentNode.appendChild(elem)
+
+
+def maybeMakeDir (filepath):
+ dirpath = os.path.dirname(filepath)
+ if len(dirpath) == 0:
+ return
+
+ if os.path.isdir(dirpath):
+ # directory already exists.
+ return
+
+ os.makedirs(dirpath)
+
+
+def main (args):
+ if len(args) < 3:
+ # We need at least the manifest.xml path (1st arg) and shared lib name (2nd arg).
+ error("need at least two arguments")
+
+ outpath = args[1]
+ libname = args[2]
+ platform = ''
+ if len(args) >= 4:
+ platform = args[3]
+
+ impl = xml.dom.minidom.getDOMImplementation()
+ doc = impl.createDocument(None, "manifest", None)
+ root = doc.documentElement
+ root.prefix = "manifest"
+ root.setAttributeNS(None, "xmlns:manifest", "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0")
+ insertFileEntry(doc, root, "text/xml", "description.xml")
+
+ # entry for the uno shared library.
+ mediaType = "application/vnd.sun.star.uno-component;type=native"
+ if len(platform) > 0:
+ mediaType += ";platform=%s"%platform
+ insertFileEntry(doc, root, mediaType, libname)
+
+ insertFileEntry(doc, root, "application/vnd.sun.star.uno-typelibrary;type=RDB", "sapconnector.uno.rdb")
+# insertFileEntry(doc, root, "application/vnd.sun.star.configuration-data", "Addons.xcu")
+# insertFileEntry(doc, root, "application/vnd.sun.star.configuration-data", "ProtocolHandler.xcu")
+# insertFileEntry(doc, root, "application/vnd.sun.star.package-bundle-description;locale=en-US", "translation/en-US/readme.txt")
+# insertFileEntry(doc, root, "application/vnd.sun.star.help", "help")
+
+ outstr = printNode(root)
+ maybeMakeDir(outpath)
+ file = open(outpath, 'w')
+ file.write(outstr)
+ file.close()
+
+if __name__ == '__main__':
+ main(sys.argv)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 194125a..03e7c53 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -1,15 +1,17 @@
+
cmake_minimum_required(VERSION 2.6)
project(DP_SOURCE_EXTENSION)
-set(TARGET_NAME test)
+set(TARGET_NAME sapconnector.uno)
set(SHARED_LIB_NAME lib${TARGET_NAME}.so)
set(RDB_NAME ${TARGET_NAME}.rdb)
+set(PKG_NAME ${TARGET_NAME}.oxt)
set(CMAKE_VERBOSE_MAKEFILE false)
set_directory_properties(
- PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${RDB_NAME})
+ PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${RDB_NAME};${PKG_NAME}")
-set(URE_BINDIR /usr/lib/ooo3/ure/bin)
+set(URE_BINDIR /usr/lib/ooo3/ure/bin ../bin)
set(URE_LIBDIR /usr/lib/ooo3/solver/lib)
include_directories(../inc /usr/lib/ooo3/solver/inc /usr/lib/ooo3/solver/inc/offuh)
@@ -21,14 +23,25 @@ set(CMAKE_BUILD_TYPE debug)
set(CMAKE_C_FLAGS_DEBUG "-g -Wall")
set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
set(CMAKE_SHARED_LINKER_FLAGS "-shared -Wl,-soname,${SHARED_LIB_NAME} -Wl,--no-undefined")
-add_library(test SHARED ../source/dpsource.cxx)
+add_library(${TARGET_NAME} SHARED ../source/dpsource.cxx)
-target_link_libraries(test uno_cppuhelpergcc3 uno_sal uno_cppu)
+target_link_libraries(${TARGET_NAME} uno_cppuhelpergcc3 uno_sal uno_cppu)
find_program(REGCOMP_EXEC NAMES regcomp PATHS ${URE_BINDIR})
-message(${REGCOMP_EXEC})
-message(${CMAKE_CURRENT_SOURCE_DIR})
add_custom_command(
- TARGET test POST_BUILD
+ TARGET ${TARGET_NAME} POST_BUILD
COMMAND ${REGCOMP_EXEC} -register -r ${RDB_NAME} -c ${CMAKE_CURRENT_SOURCE_DIR}/${SHARED_LIB_NAME}
)
+
+add_custom_command(
+ TARGET ${TARGET_NAME} POST_BUILD
+ COMMAND ../bin/make_manifest.py META-INF/manifest.xml ${SHARED_LIB_NAME} Linux_x86
+)
+
+find_program(ZIP_EXEC NAMES zip)
+add_custom_command(
+ TARGET ${TARGET_NAME} POST_BUILD
+ COMMAND ${ZIP_EXEC} -j ${PKG_NAME} ${RDB_NAME} ${SHARED_LIB_NAME} description.xml
+ COMMAND ${ZIP_EXEC} -r ${PKG_NAME} META-INF/manifest.xml
+)
+