Bring packaging process up to date for OpenOffice 2.3.
authorMatt McCutchen <matt@mattmccutchen.net>
Tue, 8 Jan 2008 02:05:59 +0000 (21:05 -0500)
committerMatt McCutchen <matt@mattmccutchen.net>
Tue, 8 Jan 2008 02:05:59 +0000 (21:05 -0500)
I noticed that installing Measurements 1 into OpenOffice 2.3 gave an error and
the demo spreadsheet did not work.  Evidently something about extensions was
changed between earlier OpenOffice 2.x and OpenOffice 2.3.  I rearranged the
packaging process to follow the CalcAddins example in the SDK.  Now the types
and the implementation are in the same jar.

.classpath
.gitignore
Makefile
README
pkg/META-INF/manifest.xml [deleted file]
src/META-INF/manifest.xml [new file with mode: 0644]

index e0a9d41..e2507c7 100644 (file)
@@ -3,7 +3,7 @@
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="src" path="test"/>
        <classpathentry combineaccessrules="false" kind="src" path="/ooo-api"/>
-       <classpathentry kind="lib" path="idl-classes"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-1.5.0-sun-1.5.0.06-1jpp"/>
+       <classpathentry kind="lib" path="bin-types"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="output" path="bin"/>
 </classpath>
index 92c166d..5c52c44 100644 (file)
@@ -1,8 +1,5 @@
-*.urd
-/types.rdb
-pkg/types.rdb
-pkg/types.jar
-pkg/component.jar
 /bin
-/idl-classes
-measurements.uno.pkg
+/bin-types
+/measurements.oxt
+/pkg
+/urd
index 680b515..78a8851 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,44 +1,45 @@
+NAME:=measurements
 empty:=
-
 OO:=/usr/lib/openoffice.org
 
-#export PATH+=:$(OO)/sdk/linux/bin
-#export LD_LIBRARY_PATH=$(OO)/program
-
-#IDL_TYPES:=net/mattmccutchen/measurements/XExampleAddIn
 IDL_TYPES:=net/mattmccutchen/measurements/XMeasurementsAddIn
 
-all: measurements.uno.pkg
+all: $(NAME).oxt
+
+# Compile src -> bin using Eclipse's Java Builder.
+
+urd/%.urd: src/%.idl
+       mkdir -p $(dir $@)
+       idlc -C -I$(OO)/sdk/idl -O$(dir $@) $<
 
-%.urd: %.idl
-       idlc -I$(OO)/sdk/idl $<
+%/.:
+       mkdir -p $*
 
-types.rdb: $(patsubst %,src/%.urd,$(IDL_TYPES))
+pkg/$(NAME).uno.rdb: $(patsubst %,urd/%.urd,$(IDL_TYPES)) pkg/.
        regmerge $@ /UCR $^
 
-.PHONY: idl-classes
-idl-classes: types.rdb
-       rm -rf idl-classes
-       mkdir -p $(addprefix idl-classes/,$(dir $(IDL_TYPES)))
+.PHONY: bin-types
+bin-types: pkg/$(NAME).uno.rdb
+       rm -rf $@
+       mkdir -p $(addprefix $@/,$(dir $(IDL_TYPES)))
 # javamaker is temperamental and demands the ./
-       javamaker -O./idl-classes -T$(subst /,.,$(subst $(empty) ,;,$(IDL_TYPES))) -nD -BUCR $(OO)/program/types.rdb types.rdb
+       javamaker -BUCR -nD -T$(subst /,.,$(subst $(empty) ,;,$(IDL_TYPES))) -O./$@ $(OO)/program/types.rdb $<
 
-pkg/types.rdb: types.rdb
-       cat $< >$@
-
-.PHONY: pkg/types.jar
-pkg/types.jar: idl-classes
-       cd idl-classes && fastjar -cMf ../$@ $(addsuffix .class,$(IDL_TYPES))
+# We collect both types and implementation into this jar.
+# It seems that the manifest has to be first, so handle it specially.
+.PHONY: pkg/$(NAME).uno.jar
+pkg/$(NAME).uno.jar: bin-types pkg/.
+       cd bin && fastjar -cMf ../$@ META-INF/MANIFEST.MF
+       cd bin-types && fastjar -uMf ../$@ $(addsuffix .class,$(IDL_TYPES))
+       cd bin && find . -name '*.class' | LC_COLLATE=C sort | fastjar -uMf ../$@ -@
 
-.PHONY: pkg/component.jar
-pkg/component.jar:
-       cd bin && find . -name '*.class' -or -wholename './META-INF/MANIFEST.MF' | LC_COLLATE=C sort | fastjar -cMf ../$@ -@
+PKG_FILES:=META-INF/manifest.xml $(NAME).uno.jar $(NAME).uno.rdb
 
-PKG_FILES:=META-INF/manifest.xml types.rdb types.jar component.jar
+pkg/META-INF/manifest.xml: src/META-INF/manifest.xml pkg/META-INF/.
+       cat $< >$@
 
-measurements.uno.pkg: $(addprefix pkg/,$(PKG_FILES))
+$(NAME).oxt: $(addprefix pkg/,$(PKG_FILES))
        cd pkg && fastjar -cMf ../$@ $(PKG_FILES)
 
 clean:
-       rm -rf idl-classes types.rdb pkg/{types.rdb,types.jar,component.jar}
-       find src -name '*.urd' -delete
+       rm -rf urd bin-types pkg $(NAME).oxt
diff --git a/README b/README
index f12ed6c..1257e7e 100644 (file)
--- a/README
+++ b/README
@@ -3,7 +3,7 @@ functions for tracking units of measure and significant figures.
 
 See: http://mattmccutchen.net/measurements/
 
-This is version 1.
+This is version 1.1.
 
 Legal
 -----
diff --git a/pkg/META-INF/manifest.xml b/pkg/META-INF/manifest.xml
deleted file mode 100644 (file)
index 91c55c3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<manifest:manifest>
-       <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB" manifest:full-path="types.rdb"/>
-       <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=Java" manifest:full-path="types.jar"/>
-       <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Java" manifest:full-path="component.jar"/>
-</manifest:manifest>
diff --git a/src/META-INF/manifest.xml b/src/META-INF/manifest.xml
new file mode 100644 (file)
index 0000000..080b1f8
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
+<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
+       <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB" manifest:full-path="measurements.uno.rdb"/>
+       <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Java" manifest:full-path="measurements.uno.jar"/>
+</manifest:manifest>