office-gobmx/ure/source/uretest/Makefile.pln
Stephan Bergmann 40f2aee658 Provide unoidl-write also for the SDK
...after the new types.rdb format that unoidl-write generates has been used
internally since LibreOffice 4.1 in 2013; following up on
6db34b6b33 "Directly build UNOIDL .rdb files from
.idl files" and its "The legacy tools idlc, regcompare, regmerge, and regview
are still contained in the URE or SDK for now."

The tools idlc and regmerge are deprecated but still shipped in the SDK for now.
The plan is to drop them completely for LO 7.5.

odk/examples/ and ure/source/uretest/ are adapted to use unoidl-write instead of
idlc and regmerge:

* unoidl-write does not use a C preprocessor and the # directives in .idl files,
  it supports reading a single .idl file (containing an arbitrary number of
  declarations) or a directory tree where each directory corresponds to a UNOIDL
  module of the same name and each .idl file contains the declaration of the
  (non-module) UNOIDL entity of the same name.  For some of the odk/examples/,
  that required moving individual .idl files into sub-directories named after
  the respective modules.  In odk/settings/std.mk, definitinos of IDL and
  REGMERGE have been replaced with a new UNOIDLWRITE.

* unoidl-write always enforces reserved UNOIDL identifier restrictions (see
  04af4e4f55 "[API CHANGE] Fix all bad UNOIDL
  identifiers across offapi" and 6201792406
  "Enforce the UNOIDL identifier scheme") (which idlc only enforced optionally
  with -cid -we).  That required renaming "my_module" in
  odk/examples/DevelopersGuide/Components/CppComponent/.

* The new types.rdb format is not compatibly with LibreOffice < 4.1.  Clients
  generating extensions containing such files are advised to use appropriate
  LibreOffice-minimal-version elements.

Change-Id: I1a248fd96e86ecbf407f829bc100d44bfe7f4e7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130533
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-02-25 16:46:26 +01:00

276 lines
12 KiB
Text

#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to you under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0 .
#
# The following variable must be set (see README):
#SDK_HOME := /opt/libreoffice/basis3.1/sdk
# The following variables can be set, if necessary (see README):
#URE_HOME := /opt/libreoffice
#GCCS_COMPAT := LD_PRELOAD=/lib/libgcc_s.so.1
URE_HOME ?= /opt/libreoffice
.DELETE_ON_ERROR:
.PHONY: check
check: test-cpptest test-javatest test-javanative test-clientserver
.PHONY: test-cpptest
test-cpptest: out.pln/cppmain.uno.so out.pln/types.rdb out.pln/services.rdb
$(GCCS_COMPAT) $(URE_HOME)/program/uno \
-c test.cpp.cppmain.Component -l file://$(PWD)/$< \
-env:URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \
-env:URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb
.PHONY: test-javatest
test-javatest: out.pln/javamain.uno.jar out.pln/types.rdb out.pln/services.rdb
$(GCCS_COMPAT) $(URE_HOME)/program/uno \
-c test.java.javamain.Component -l file://$(PWD)/$< \
-env:URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \
-env:URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb
.PHONY: test-javanative
test-javanative: out.pln/runner.jar out.pln/javanative.jar \
out.pln/types.rdb out.pln/services.rdb
URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \
URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb \
$(GCCS_COMPAT) LD_LIBRARY_PATH=$(URE_HOME)/program java \
-jar out.pln/runner.jar file://$(URE_HOME)/program/classes/ \
file://$(PWD)/out.pln/javanative.jar
.PHONY: test-clientserver
test-clientserver: out.pln/cppserver.uno.so out.pln/types.rdb \
out.pln/services.rdb out.pln/runner.jar out.pln/javaclient.jar
$(GCCS_COMPAT) $(URE_HOME)/program/uno -c test.cpp.cppserver.Component \
-l file://$(PWD)/out.pln/cppserver.uno.so \
-env:URE_MORE_TYPES=file://$(PWD)/out.pln/types.rdb \
-env:URE_MORE_SERVICES=file://$(PWD)/out.pln/services.rdb \
-u 'uno:pipe,name=ure_test;urp;server' --singleaccept &
sleep 5 && \
java -jar out.pln/runner.jar file://$(URE_HOME)/program/classes/ \
file://$(PWD)/out.pln/javaclient.jar \
'uno:pipe,name=ure_test;urp;server'
.PHONY: clean
clean:
rm -rf out.pln
out.pln/cppmain.uno.so: out.pln/cppmain.o | out.pln out.pln/lib/libuno_cppu.so \
out.pln/lib/libuno_cppuhelpergcc3.so out.pln/lib/libuno_sal.so \
out.pln/lib/libuno_salhelpergcc3.so
g++ -shared -o $@ -Wl,-z,defs -Wl,--fatal-warnings $< -Lout.pln/lib \
-luno_cppu -luno_cppuhelpergcc3 -luno_sal -luno_salhelpergcc3
out.pln/cppmain.o: cppmain.cc out.pln/cpputypes.cppumaker.flag \
out.pln/types.cppumaker.flag | out.pln
g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \
-I $(SDK_HOME)/include -I out.pln/include/cpputypes \
-I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $<
out.pln/cpptest.uno.so: out.pln/cpptest.o | out.pln out.pln/lib/libuno_cppu.so \
out.pln/lib/libuno_cppuhelpergcc3.so out.pln/lib/libuno_sal.so
g++ -shared -o $@ -Wl,-z,defs -Wl,--fatal-warnings $< -Lout.pln/lib \
-luno_cppu -luno_cppuhelpergcc3 -luno_sal
out.pln/cpptest.o: cpptest.cc out.pln/cpputypes.cppumaker.flag \
out.pln/types.cppumaker.flag | out.pln
g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \
-I $(SDK_HOME)/include -I out.pln/include/cpputypes \
-I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $<
out.pln/cppserver.uno.so: out.pln/cppserver.o | out.pln \
out.pln/lib/libuno_cppu.so out.pln/lib/libuno_cppuhelpergcc3.so \
out.pln/lib/libuno_sal.so
g++ -shared -o $@ -Wl,-z,defs -Wl,--fatal-warnings $< -Lout.pln/lib \
-luno_cppu -luno_cppuhelpergcc3 -luno_sal
out.pln/cppserver.o: cppserver.cc out.pln/cpputypes.cppumaker.flag \
out.pln/types.cppumaker.flag | out.pln
g++ -c -o $@ -fpic -fvisibility=hidden -Wall -Wno-ctor-dtor-privacy \
-I $(SDK_HOME)/include -I out.pln/include/cpputypes \
-I out.pln/include/types -DCPPU_ENV=gcc3 -DLINUX -DUNX $<
out.pln/cpputypes.cppumaker.flag: | out.pln
LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/cppumaker \
-O./out.pln/include/cpputypes \
'-Tcom.sun.star.beans.Introspection;com.sun.star.beans.theIntrospection;com.sun.star.bridge.BridgeFactory;com.sun.star.bridge.UnoUrlResolver;com.sun.star.connection.Acceptor;com.sun.star.connection.Connector;com.sun.star.io.Pipe;com.sun.star.io.TextInputStream;com.sun.star.io.TextOutputStream;com.sun.star.java.JavaVirtualMachine;com.sun.star.lang.DisposedException;com.sun.star.lang.EventObject;com.sun.star.lang.XMain;com.sun.star.lang.XMultiComponentFactory;com.sun.star.lang.XMultiServiceFactory;com.sun.star.lang.XSingleComponentFactory;com.sun.star.lang.XSingleServiceFactory;com.sun.star.lang.XTypeProvider;com.sun.star.loader.Java;com.sun.star.loader.SharedLibrary;com.sun.star.reflection.ProxyFactory;com.sun.star.registry.ImplementationRegistration;com.sun.star.registry.SimpleRegistry;com.sun.star.registry.XRegistryKey;com.sun.star.script.Converter;com.sun.star.script.Invocation;com.sun.star.security.AccessController;com.sun.star.security.Policy;com.sun.star.uno.DeploymentException;com.sun.star.uno.Exception;com.sun.star.uno.NamingService;com.sun.star.uno.RuntimeException;com.sun.star.uno.XAggregation;com.sun.star.uno.XComponentContext;com.sun.star.uno.XCurrentContext;com.sun.star.uno.XInterface;com.sun.star.uno.XWeak;com.sun.star.uri.ExternalUriReferenceTranslator;com.sun.star.uri.UriReferenceFactory;com.sun.star.uri.VndSunStarPkgUrlReferenceFactory;com.sun.star.util.theMacroExpander' \
$(URE_HOME)/program/types.rdb
touch $@
out.pln/types.cppumaker.flag: out.pln/types.rdb | out.pln
LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/cppumaker \
-O./out.pln/include/types ./$< -X$(URE_HOME)/program/types.rdb
touch $@
out.pln/javamain.uno.jar: \
out.pln/class/javamain/test/java/javamain/JavaMain.class \
out.pln/javamain.mf | out.pln
jar cfm $@ out.pln/javamain.mf -C out.pln/class/javamain test
out.pln/javamain.mf: javamain.mf.template | out.pln
sed -e 's~^Class-Path:$$~& tester.jar~' \
-e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@
out.pln/class/javamain/test/java/javamain/JavaMain.class: JavaMain.java \
out.pln/tester.jar | out.pln/class
rm -rf out.pln/class/javamain
mkdir out.pln/class/javamain
javac -classpath \
$(URE_HOME)/program/classes/libreoffice.jar:out.pln/tester.jar \
-sourcepath . -d out.pln/class/javamain $<
out.pln/runner.jar: out.pln/class/runner/test/java/runner/Runner.class \
out.pln/runner.mf | out.pln
jar cfm $@ out.pln/runner.mf -C out.pln/class/runner test
out.pln/runner.mf: runner.mf.template | out.pln
sed -e \
's~^Class-Path:$$~& file://$(URE_HOME)/program/classes/unoloader.jar~' \
-e 's~^UNO-Type-Path:$$~& ~' $< > $@
out.pln/class/runner/test/java/runner/Runner.class: Runner.java | out.pln/class
rm -rf out.pln/class/runner
mkdir out.pln/class/runner
javac -classpath $(URE_HOME)/program/classes/unoloader.jar \
-sourcepath . -d out.pln/class/runner $<
out.pln/tester.jar: out.pln/class/tester/test/java/tester/Tester.class \
out.pln/tester.mf | out.pln
jar cfm $@ out.pln/tester.mf -C out.pln/class/tester test
out.pln/tester.mf: tester.mf.template | out.pln
sed -e 's~^Class-Path:$$~& types.jar~' \
-e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@
out.pln/class/tester/test/java/tester/Tester.class: Tester.java \
out.pln/types.jar | out.pln/class
rm -rf out.pln/class/tester
mkdir out.pln/class/tester
javac -classpath \
$(URE_HOME)/program/classes/libreoffice.jar:out.pln/types.jar \
-sourcepath . -d out.pln/class/tester $<
out.pln/javatest.uno.jar: \
out.pln/class/javatest/test/java/javatest/JavaTest.class \
out.pln/javatest.mf | out.pln
jar cfm $@ out.pln/javatest.mf -C out.pln/class/javatest test
out.pln/javatest.mf: javatest.mf.template | out.pln
sed -e 's~^Class-Path:$$~& types.jar~' \
-e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@
out.pln/class/javatest/test/java/javatest/JavaTest.class: JavaTest.java \
out.pln/types.jar | out.pln/class
rm -rf out.pln/class/javatest
mkdir out.pln/class/javatest
javac -classpath \
$(URE_HOME)/program/classes/libreoffice.jar:out.pln/types.jar \
-sourcepath . -d out.pln/class/javatest $<
out.pln/javanative.jar: \
out.pln/class/javanative/test/java/javanative/JavaNative.class \
out.pln/javanative.mf | out.pln
jar cfm $@ out.pln/javanative.mf -C out.pln/class/javanative test
out.pln/javanative.mf: javanative.mf.template | out.pln
sed -e 's~^Class-Path:$$~& tester.jar~' \
-e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@
out.pln/class/javanative/test/java/javanative/JavaNative.class: \
JavaNative.java out.pln/tester.jar | out.pln/class
rm -rf out.pln/class/javanative
mkdir out.pln/class/javanative
javac -classpath \
$(URE_HOME)/program/classes/libreoffice.jar:out.pln/tester.jar \
-sourcepath . -d out.pln/class/javanative $<
out.pln/javaclient.jar: \
out.pln/class/javaclient/test/java/javaclient/JavaClient.class \
out.pln/javaclient.mf | out.pln
jar cfm $@ out.pln/javaclient.mf -C out.pln/class/javaclient test
out.pln/javaclient.mf: javaclient.mf.template | out.pln
sed -e 's~^Class-Path:$$~& types.jar~' \
-e 's~^UNO-Type-Path:$$~& types.jar~' $< > $@
out.pln/class/javaclient/test/java/javaclient/JavaClient.class: \
JavaClient.java out.pln/types.jar | out.pln/class
rm -rf out.pln/class/javaclient
mkdir out.pln/class/javaclient
javac -classpath \
$(URE_HOME)/program/classes/libreoffice.jar:out.pln/types.jar \
-sourcepath . -d out.pln/class/javaclient $<
out.pln/types.jar: out.pln/types.javamaker.flag out.pln/types.mf | out.pln
jar cfm $@ out.pln/types.mf -C out.pln/class/types test
out.pln/types.mf: types.mf.template | out.pln
sed -e 's~^Class-Path:$$~& ~' -e 's~^UNO-Type-Path:$$~& \<\>~' $< > $@
out.pln/types.javamaker.flag: out.pln/types.rdb | out.pln out.pln/class
rm -rf out.pln/class/types
LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/javamaker \
-O./out.pln/class/types ./$< -X$(URE_HOME)/program/types.rdb
touch $@
out.pln/types.rdb: types.idl | out.pln
LD_LIBRARY_PATH=$(URE_HOME)/program $(SDK_HOME)/bin/unoidl-write \
$(URE_HOME)/program/types.rdb $< $@
out.pln/services.rdb: services.rdb.in | out.pln/cpptest.uno.so \
out.pln/javatest.uno.jar out.pln
sed -e s/@SHAREDLIB_EXT@/so/ < $^ > $@
out.pln/lib/libuno_cppu.so: | out.pln/lib
ln -fs $(URE_HOME)/program/libuno_cppu.so.3 $@
out.pln/lib/libuno_cppuhelpergcc3.so: | out.pln/lib
ln -fs $(URE_HOME)/program/libuno_cppuhelpergcc3.so.3 $@
out.pln/lib/libuno_sal.so: | out.pln/lib
ln -fs $(URE_HOME)/program/libuno_sal.so.3 $@
out.pln/lib/libuno_salhelpergcc3.so: | out.pln/lib
ln -fs $(URE_HOME)/program/libuno_salhelpergcc3.so.3 $@
out.pln:
mkdir $@
out.pln/class: | out.pln
mkdir $@
out.pln/lib: | out.pln
mkdir $@