Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Xalan-C 1.12 #381

Merged
merged 2 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
"zlib:x64-windows-v${{ matrix.toolset }}"
"boost-test:x86-windows-v${{ matrix.toolset }}"
"boost-test:x64-windows-v${{ matrix.toolset }}"
vcpkgGitCommitId: 18376a2f2ce989e022db5c1199b468e43f7c1a79
vcpkgGitCommitId: d417ae59d6e9aa20d9f812b5deb966645c54687d
- name: Install dependencies
run: choco install doxygen.install swig -y > $null
- name: Build xsd
Expand Down
9 changes: 5 additions & 4 deletions build-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ case "$@" in
ARCH="armeabi-v7a"
;;
esac
: ${ANDROID_NDK_HOME:="${PWD}/android-ndk-r21e"}
TARGET_PATH=/Library/libdigidocpp.${TARGET}
CMAKEARGS="
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=21 \
-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=${TARGET_PATH} \
-DCMAKE_ANDROID_ARCH_ABI=${ARCH} \
-DCMAKE_FIND_ROOT_PATH=${TARGET_PATH};/usr/local \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=21 \
-DANDROID_ABI=${ARCH} \
-DBoost_INCLUDE_DIR=NOTFOUND \
-DDOXYGEN_EXECUTABLE=NOTFOUND \
-DBUILD_TOOLS=NO \
Expand Down
211 changes: 115 additions & 96 deletions etc/Doxyfile.in

Large diffs are not rendered by default.

16 changes: 4 additions & 12 deletions examples/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,19 @@ task schemaZip(type:Zip) {
task copyLibs {
println "Copy jniLibs"
copy {
from fileTree(libsPath + '.androidarm') {
include 'lib/libdigidoc_java.so', 'arm-linux-androideabi/lib/armv7-a/libc++_shared.so'
}.files
from libsPath + '.androidarm/lib/libdigidoc_java.so'
into 'src/main/jniLibs/armeabi-v7a'
}
copy {
from fileTree(libsPath + '.androidarm64') {
include 'lib/libdigidoc_java.so', 'aarch64-linux-android/lib/libc++_shared.so'
}.files
from libsPath + '.androidarm64/lib/libdigidoc_java.so'
into 'src/main/jniLibs/arm64-v8a'
}
copy {
from fileTree(libsPath + '.androidx86') {
include 'lib/libdigidoc_java.so', 'i686-linux-android/lib/libc++_shared.so'
}.files
from libsPath + '.androidx86/lib/libdigidoc_java.so'
into 'src/main/jniLibs/x86'
}
copy {
from fileTree(libsPath + '.androidx86_64') {
include 'lib/libdigidoc_java.so', 'x86_64-linux-android/lib64/libc++_shared.so'
}.files
from libsPath + '.androidx86_64/lib/libdigidoc_java.so'
into 'src/main/jniLibs/x86_64'
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public class MainActivity extends Activity {
static private String cache;

static {
System.loadLibrary("c++_shared");
System.loadLibrary("digidoc_java");
}

Expand Down
2 changes: 1 addition & 1 deletion examples/ios/libdigidocpp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
4E7663901B5A37AC00672ACF /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1200;
LastUpgradeCheck = 1230;
ORGANIZATIONNAME = RIA;
TargetAttributes = {
4E7663971B5A37AC00672ACF = {
Expand Down
16 changes: 8 additions & 8 deletions libdigidocpp.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<File Source="$(var.VCPKG_X86)\libssl-1_1.dll"/>
<File Source="$(var.VCPKG_X86)\zlib1.dll"/>
<File Source="$(var.VCPKG_X86)\xerces-c_3_2.dll"/>
<File Source="$(var.VCPKG_X86)\Xalan-C_1_11.dll"/>
<File Source="$(var.VCPKG_X86)\XalanMessages_1_11.dll"/>
<File Source="$(var.VCPKG_X86)\Xalan-C_1_12.dll"/>
<File Source="$(var.VCPKG_X86)\XalanMessages_1_12.dll"/>
<File Source="$(var.VCPKG_X86)\xsec_2_0.dll"/>
<File Source="$(var.libdigidocpp)\x86\bin\digidocpp.dll"/>
<?ifdef var.swig ?>
Expand All @@ -55,8 +55,8 @@
<File Source="$(var.VCPATH)\Debug_NonRedist\x86\Microsoft.VC$(var.VCVER).DebugCRT\msvcp140d.dll"/>
<File Source="$(var.VCPATH)\Debug_NonRedist\x86\Microsoft.VC$(var.VCVER).DebugCRT\vcruntime140d.dll"/>
<File Source="$(var.VCPKG_X86D)\xerces-c_3_2D.dll"/>
<File Source="$(var.VCPKG_X86D)\Xalan-C_1_11D.dll"/>
<File Source="$(var.VCPKG_X86D)\XalanMessages_1_11D.dll"/>
<File Source="$(var.VCPKG_X86D)\Xalan-C_1_12D.dll"/>
<File Source="$(var.VCPKG_X86D)\XalanMessages_1_12D.dll"/>
<File Source="$(var.VCPKG_X86D)\xsec_2_0D.dll"/>
<File Source="$(var.libdigidocpp)\x86\bin\digidoc-tool.pdb"/>
<File Source="$(var.libdigidocpp)\x86\bin\digidocpp.lib"/>
Expand Down Expand Up @@ -97,8 +97,8 @@
<File Source="$(var.VCPKG_X64)\libssl-1_1-x64.dll"/>
<File Source="$(var.VCPKG_X64)\zlib1.dll" Id="zlib1_64.dll"/>
<File Source="$(var.VCPKG_X64)\xerces-c_3_2.dll" Id="xerces_c_3_2.dll_64"/>
<File Source="$(var.VCPKG_X64)\Xalan-C_1_11.dll" Id="Xalan_C_1_11.dll_64"/>
<File Source="$(var.VCPKG_X64)\XalanMessages_1_11.dll" Id="XalanMessages_1_11.dll_64"/>
<File Source="$(var.VCPKG_X64)\Xalan-C_1_12.dll" Id="Xalan_C_1_12.dll_64"/>
<File Source="$(var.VCPKG_X64)\XalanMessages_1_12.dll" Id="XalanMessages_1_12.dll_64"/>
<File Source="$(var.VCPKG_X64)\xsec_2_0.dll" Id="xsec_2_0.dll_64"/>
<File Source="$(var.libdigidocpp)\x64\bin\digidocpp.dll" Id="digidocpp.dll_64"/>
<?ifdef var.swig ?>
Expand All @@ -113,8 +113,8 @@
<File Source="$(var.VCPATH)\Debug_NonRedist\x86\Microsoft.VC$(var.VCVER).DebugCRT\msvcp140d.dll" Id="msvcp140d_64.dll"/>
<File Source="$(var.VCPATH)\Debug_NonRedist\x86\Microsoft.VC$(var.VCVER).DebugCRT\vcruntime140d.dll" Id="vcruntime140d_64.dll"/>
<File Source="$(var.VCPKG_X64D)\xerces-c_3_2D.dll" Id="xerces_c_3_2D.dll_64"/>
<File Source="$(var.VCPKG_X64D)\Xalan-C_1_11D.dll" Id="Xalan_C_1_11D.dll_64"/>
<File Source="$(var.VCPKG_X64D)\XalanMessages_1_11D.dll" Id="XalanMessages_1_11D.dll_64"/>
<File Source="$(var.VCPKG_X64D)\Xalan-C_1_12D.dll" Id="Xalan_C_1_12D.dll_64"/>
<File Source="$(var.VCPKG_X64D)\XalanMessages_1_12D.dll" Id="XalanMessages_1_12D.dll_64"/>
<File Source="$(var.VCPKG_X64D)\xsec_2_0D.dll" Id="xsec_2_0D.dll_64"/>
<File Source="$(var.libdigidocpp)\x64\bin\digidoc-tool.pdb" Id="digidoc_tool.pdb_64"/>
<File Source="$(var.libdigidocpp)\x64\bin\digidocpp.lib" Id="digidocpp.lib_64"/>
Expand Down
Binary file modified patches/MsgCreator
Binary file not shown.
45 changes: 0 additions & 45 deletions patches/xalan-CMakeLists.txt

This file was deleted.

101 changes: 56 additions & 45 deletions prepare_osx_build_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
set -e

XERCES_DIR=xerces-c-3.2.3
XALAN_DIR=xalan_c-1.12
XMLSEC_DIR=xml-security-c-2.0.2
XSD=xsd-4.0.0-i686-macosx
OPENSSL_DIR=openssl-1.1.1k
LIBXML2_DIR=libxml2-2.9.10
ANDROID_NDK=android-ndk-r18b
ANDROID_NDK=android-ndk-r21e
FREETYPE_DIR=freetype-2.10.1
FONTCONFIG_DIR=fontconfig-2.13.1
PODOFO_DIR=podofo-0.9.4
Expand All @@ -33,38 +34,41 @@ case "$@" in
*)
ARCH=arm
ARCH_ABI="armeabi-v7a"
CROSS_COMPILE=arm-linux-androideabi
CROSS_COMPILE=armv7a-linux-androideabi
;;
esac
echo "Building for Android ${ARCH}"

: ${ANDROID_NDK_HOME:="${PWD}/${ANDROID_NDK}"}
if [ ! -d "${ANDROID_NDK_HOME}" ]; then
if [ ! -f ${ANDROID_NDK}-darwin-x86_64.zip ]; then
curl -O -L https://dl.google.com/android/repository/${ANDROID_NDK}-darwin-x86_64.zip
fi
unzip -qq ${ANDROID_NDK}-darwin-x86_64.zip
fi

TARGET_PATH=/Library/libdigidocpp.android${ARCH}
SYSROOT=${TARGET_PATH}/sysroot
export ANDROID_NDK_HOME=${TARGET_PATH}
export PATH=${TARGET_PATH}/bin:$PATH
export CC=clang
export CXX=clang++
export CFLAGS=""
ABI=21
export ANDROID_NDK_HOME
export PATH=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin:$PATH
export AR=llvm-ar
export CC=${CROSS_COMPILE}${ABI}-clang
export AS=${CC}
export CXX=${CROSS_COMPILE}${ABI}-clang++
export RANLIB=llvm-ranlib
export STRIP=llvm-strip
export CFLAGS="-I${TARGET_PATH}/include"
export CXXFLAGS="${CFLAGS} -std=gnu++11 -Wno-null-conversion"
export LIBS="-liconv"
CONFIGURE="--host=${CROSS_COMPILE} --enable-static --disable-shared --with-sysroot=${SYSROOT} --disable-dependency-tracking --with-pic"
export LIBS="-L${TARGET_PATH}/lib -liconv"
CONFIGURE="--host=${CROSS_COMPILE} --enable-static --disable-shared --disable-dependency-tracking --with-pic"
ARCHS=${ARCH}

if [ ! -f ${ANDROID_NDK}-darwin-x86_64.zip ]; then
curl -O -L https://dl.google.com/android/repository/${ANDROID_NDK}-darwin-x86_64.zip
fi
if [ ! -d ${TARGET_PATH} ]; then
rm -rf ${ANDROID_NDK}
unzip -qq ${ANDROID_NDK}-darwin-x86_64.zip
cd ${ANDROID_NDK}
sudo ./build/tools/make_standalone_toolchain.py \
--arch=${ARCH} --api=21 --stl=libc++ --install-dir=${TARGET_PATH}
cd -

#iconv for xerces
sudo cp patches/android-iconv/iconv.h ${SYSROOT}/usr/include/
sudo ${CROSS_COMPILE}-gcc -I${SYSROOT}/usr/include -std=c99 -o ${SYSROOT}/usr/lib/libiconv.o -c patches/android-iconv/iconv.c
sudo ${CROSS_COMPILE}-ar rcs ${SYSROOT}/usr/lib/libiconv.a ${SYSROOT}/usr/lib/libiconv.o
sudo mkdir -p ${TARGET_PATH}/include ${TARGET_PATH}/lib
sudo cp patches/android-iconv/iconv.h ${TARGET_PATH}/include/
sudo ${CC} -I${TARGET_PATH}/include -std=c99 -o ${TARGET_PATH}/lib/libiconv.o -c patches/android-iconv/iconv.c
sudo ${AR} rcs ${TARGET_PATH}/lib/libiconv.a ${TARGET_PATH}/lib/libiconv.o
fi
;;
*simulator*)
Expand Down Expand Up @@ -123,27 +127,33 @@ function xerces {
}

function xalan {
echo Building xalan-c-1.11
if [ ! -f xalan_c-1.11-src.tar.gz ]; then
curl -O -L https://archive.apache.org/dist/xalan/xalan-c/sources/xalan_c-1.11-src.tar.gz
echo Building ${XALAN_DIR}
if [ ! -f ${XALAN_DIR}.tar.gz ]; then
curl -O -L https://archive.apache.org/dist/xalan/xalan-c/sources/${XALAN_DIR}.tar.gz
fi
rm -rf xalan-c-1.11
tar xf xalan_c-1.11-src.tar.gz
cd xalan-c-1.11/c
cp ../../patches/xalan-CMakeLists.txt src/CMakeLists.txt
cp ../../patches/MsgCreator src
rm -rf ${XALAN_DIR}
tar xf ${XALAN_DIR}.tar.gz
cd ${XALAN_DIR}
sed -ie 's!add_subdirectory(samples)!!' CMakeLists.txt
sed -ie 's!add_subdirectory(Tests)!!' CMakeLists.txt
sed -ie 's!add_subdirectory(docs/doxygen)!!' CMakeLists.txt
sed -ie 's!add_subdirectory(src/xalanc/TestXSLT)!!' CMakeLists.txt
sed -ie 's!add_subdirectory(src/xalanc/TestXPath)!!' CMakeLists.txt
sed -n '1102,1500!p' src/xalanc/CMakeLists.txt > tmp
mv tmp src/xalanc/CMakeLists.txt
case "${ARGS}" in
*android*)
cmake \
-DCMAKE_SYSTEM_NAME=Android \
-DCMAKE_SYSTEM_VERSION=21 \
-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=${TARGET_PATH} \
-DCMAKE_ANDROID_ARCH_ABI=${ARCH_ABI} \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=${ABI} \
-DANDROID_ABI=${ARCH_ABI} \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DXercesC_ROOT=${TARGET_PATH} \
-DCMAKE_FIND_ROOT_PATH=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=NO \
src && make -s && sudo make install
.
make -s MsgCreator || cp ../patches/MsgCreator src/xalanc/Utils/MsgCreator
make -s && sudo make install
;;
*ios*|*simulator*)
cmake \
Expand All @@ -152,23 +162,23 @@ function xalan {
-DCMAKE_OSX_SYSROOT=${SYSROOT} \
-DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DXercesC_ROOT=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=NO \
src && make -s && sudo make install
. && make -s MsgCreator
cp ../patches/MsgCreator src/xalanc/Utils/MsgCreator
make -s && sudo make install
;;
*)
cmake \
-DCMAKE_MACOSX_RPATH=NO \
-DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DXercesC_ROOT=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=YES \
src && make -s && sudo make install
sudo install_name_tool -id ${TARGET_PATH}/lib/libxalanMsg.111.0.dylib ${TARGET_PATH}/lib/libxalanMsg.*.dylib
sudo install_name_tool -id ${TARGET_PATH}/lib/libxalan-c.111.0.dylib \
-change libxalanMsg.111.0.dylib ${TARGET_PATH}/lib/libxalanMsg.111.0.dylib ${TARGET_PATH}/lib/libxalan-c.*.dylib
. && make -s && sudo make install
sudo install_name_tool -id ${TARGET_PATH}/lib/libxalanMsg.112.dylib ${TARGET_PATH}/lib/libxalanMsg.*.0.dylib
sudo install_name_tool -id ${TARGET_PATH}/lib/libxalan-c.112.dylib \
-change libxalanMsg.112.dylib ${TARGET_PATH}/lib/libxalanMsg.112.dylib ${TARGET_PATH}/lib/libxalan-c.*.0.dylib
;;
esac
cd -
Expand All @@ -185,6 +195,7 @@ function xml_security {
patch -Np1 -i ../patches/vcpkg-ports/xml-security-c/002_xml-security-c-SHA3.patch
sed -ie 's!as_fn_error $? "cannot run test program while cross compiling!$as_echo_n "cannot run test program while cross compiling!' configure
sed -ie 's!#define XSEC_EXPORT!#define XSEC_EXPORT __attribute__ ((visibility("default")))!' xsec/framework/XSECDefs.hpp
sed -ie 's!XALAN_USING_XALAN(\(.*\))!using xalanc::\1;!' xsec/*/*.cpp* xsec/*/*.hpp
CFLAGS="${CFLAGS} -fvisibility=hidden" \
CXXFLAGS="${CXXFLAGS} -fvisibility=hidden -fvisibility-inlines-hidden" \
xerces_CFLAGS="-I${TARGET_PATH}/include" xerces_LIBS="-L${TARGET_PATH}/lib -lxalanMsg -lxalan-c -lxerces-c" \
Expand Down Expand Up @@ -246,7 +257,7 @@ function openssl {
sed -ie 's!, "test"!!' Configure
case "${ARGS}" in
*android*)
./Configure android-${ARCH} --prefix=${TARGET_PATH} --openssldir=${TARGET_PATH}/ssl no-hw no-engine no-tests no-shared
./Configure android-${ARCH} -D__ANDROID_API__=${ABI} --prefix=${TARGET_PATH} --openssldir=${TARGET_PATH}/ssl no-hw no-engine no-tests no-shared
make -s
sudo make install_sw
;;
Expand Down
12 changes: 6 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ elseif(ANDROID)
find_package(Iconv)
target_link_libraries(digidocpp PRIVATE Iconv::Iconv)
set_property(SOURCE minizip/ioapi.c APPEND PROPERTY COMPILE_DEFINITIONS IOAPI_NO_64)
set_property(TARGET minizip digidocpp_priv digidocpp APPEND PROPERTY COMPILE_DEFINITIONS __ANDROID_API__=${CMAKE_SYSTEM_VERSION})
endif()

source_group( "Resources" FILES "${CMAKE_CURRENT_BINARY_DIR}/digidocpp.conf;${CMAKE_SOURCE_DIR}/etc/798.p12" )
Expand All @@ -337,31 +336,32 @@ if( FRAMEWORK )
COMMAND install_name_tool -id 'libxerces-c.dylib'
$<TARGET_FILE_DIR:digidocpp>/Libraries/libxerces-c.dylib
COMMAND install_name_tool -id 'libxalanMsg.dylib'
-change '${LIBPATH}/libxerces-c-3.2.dylib' '@loader_path/libxerces-c.dylib'
$<TARGET_FILE_DIR:digidocpp>/Libraries/libxalanMsg.dylib
COMMAND install_name_tool -id 'libxalan-c.dylib'
-change '${LIBPATH}/libxalanMsg.111.0.dylib' '@loader_path/libxalanMsg.dylib'
-change '${LIBPATH}/libxalanMsg.112.dylib' '@loader_path/libxalanMsg.dylib'
-change '${LIBPATH}/libxerces-c-3.2.dylib' '@loader_path/libxerces-c.dylib'
$<TARGET_FILE_DIR:digidocpp>/Libraries/libxalan-c.dylib
COMMAND install_name_tool -id 'libxml-security-c.dylib'
-change '${LIBPATH}/libcrypto.1.1.dylib' '@loader_path/libcrypto.dylib'
-change '${LIBPATH}/libssl.1.1.dylib' '@loader_path/libssl.dylib'
-change '${LIBPATH}/libxerces-c-3.2.dylib' '@loader_path/libxerces-c.dylib'
-change '${LIBPATH}/libxalan-c.111.0.dylib' '@loader_path/libxalan-c.dylib'
-change '${LIBPATH}/libxalanMsg.111.0.dylib' '@loader_path/libxalanMsg.dylib'
-change '${LIBPATH}/libxalan-c.112.dylib' '@loader_path/libxalan-c.dylib'
-change '${LIBPATH}/libxalanMsg.112.dylib' '@loader_path/libxalanMsg.dylib'
$<TARGET_FILE_DIR:digidocpp>/Libraries/libxml-security-c.dylib
COMMAND install_name_tool
-change '${LIBPATH}/libcrypto.1.1.dylib' '@loader_path/Libraries/libcrypto.dylib'
-change '${LIBPATH}/libssl.1.1.dylib' '@loader_path/Libraries/libssl.dylib'
-change '${LIBPATH}/libxerces-c-3.2.dylib' '@loader_path/Libraries/libxerces-c.dylib'
-change '${LIBPATH}/libxml-security-c.20.dylib' '@loader_path/Libraries/libxml-security-c.dylib'
-change '${LIBPATH}/libxalan-c.111.0.dylib' '@loader_path/Libraries/libxalan-c.dylib'
-change '${LIBPATH}/libxalan-c.112.dylib' '@loader_path/Libraries/libxalan-c.dylib'
$<TARGET_FILE:digidocpp>
COMMAND install_name_tool
-change '${LIBPATH}/libcrypto.1.1.dylib' '@executable_path/../Libraries/libcrypto.dylib'
-change '${LIBPATH}/libssl.1.1.dylib' '@executable_path/../Libraries/libssl.dylib'
-change '${LIBPATH}/libxerces-c-3.2.dylib' '@executable_path/../Libraries/libxerces-c.dylib'
-change '${LIBPATH}/libxml-security-c.20.dylib' '@executable_path/../Libraries/libxml-security-c.dylib'
-change '${LIBPATH}/libxalan-c.111.0.dylib' '@executable_path/../Libraries/libxalan-c.dylib'
-change '${LIBPATH}/libxalan-c.112.dylib' '@executable_path/../Libraries/libxalan-c.dylib'
$<TARGET_FILE_DIR:digidocpp>/Resources/digidoc-tool
COMMAND touch $<TARGET_FILE:digidoc-tool>
)
Expand Down