]> OCCT Git - occt.git/commitdiff
0032735: Configuration, scripts - add batch scripts building 3rdparty libraries CR32735
authorkgv <kgv@opencascade.com>
Wed, 15 Dec 2021 22:58:50 +0000 (01:58 +0300)
committerkgv <kgv@opencascade.com>
Thu, 16 Dec 2021 11:53:16 +0000 (14:53 +0300)
Added scripts building:
- FreeType for macOS/iOS/Android targets.
- Draco for macOS/Linux/Android/wasm targets.
- liblzma for macOS/Android targets.
- Tcl for Android/wasm targets.

14 files changed:
adm/scripts/bullet/android_bullet_build.bat [new file with mode: 0644]
adm/scripts/bullet/ios_bullet_build.sh [new file with mode: 0644]
adm/scripts/bullet/macos_bullet_build.sh [new file with mode: 0644]
adm/scripts/draco/android_draco_build.bat [new file with mode: 0644]
adm/scripts/draco/linux_draco_build.sh [new file with mode: 0644]
adm/scripts/draco/macos_draco_build.sh [new file with mode: 0644]
adm/scripts/draco/wasm_draco_build.bat [new file with mode: 0644]
adm/scripts/freetype/android_freetype_build.bat [new file with mode: 0644]
adm/scripts/freetype/ios_freetype_build.sh [new file with mode: 0644]
adm/scripts/freetype/macos_freetype_build.sh [new file with mode: 0644]
adm/scripts/liblzma/android_liblzma_build.sh [new file with mode: 0644]
adm/scripts/liblzma/macos_liblzma_build.sh [new file with mode: 0644]
adm/scripts/tcl/android_tcl_build.sh [new file with mode: 0644]
adm/scripts/tcl/wasm_tcl_build.sh [new file with mode: 0644]

diff --git a/adm/scripts/bullet/android_bullet_build.bat b/adm/scripts/bullet/android_bullet_build.bat
new file mode 100644 (file)
index 0000000..2413e5a
--- /dev/null
@@ -0,0 +1,142 @@
+@echo OFF
+
+rem Auxiliary script for semi-automated building of Bullet for Android platform.
+rem Script should be placed into root of Bullet repository, edited with paths
+rem to CMake, 3rd-parties, Android NDK and MinGW64 make tool.
+
+rem CMake toolchain definition should be cloned from the following git repository:
+rem https://github.com/taka-no-me/android-cmake
+
+set "aBulletSrc=%~dp0"
+set aNbJobs=%NUMBER_OF_PROCESSORS%
+
+call c:\TDM-GCC-64\mingwvars.bat
+set "PATH=c:\CMake\bin;%PATH%"
+set "anNdkPath=c:/android-ndk-r12"
+set "aToolchain=c:/android-cmake-master/android.toolchain.cmake"
+
+set "toPack=1"
+
+set /p aBulletVersion=<%aBulletSrc%VERSION
+echo "aBulletVersion=%aBulletVersion%"
+
+call :cmakeGenerate "15" "armeabi-v7a"
+call :cmakeGenerate "15" "x86"
+call :cmakeGenerate "21" "arm64-v8a"
+call :cmakeGenerate "21" "x86_64"
+
+set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
+if ["%THE_7Z_PATH%"] == [""] set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
+if not exist "%THE_7Z_PATH%" set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
+if not exist "%THE_7Z_PATH%" set "THE_7Z_PATH=%ProgramFiles%\7-Zip\7z.exe"
+
+set "anArchName=bullet-%aBulletVersion%-android"
+set "aTarget=%~dp0work\%anArchName%"
+
+if "%toPack%"=="1" (
+  echo Creating archive %anArchName%.7z
+  rmdir /S /Q "%aTarget%"
+  if not exist "%aTarget%\libs" ( mkdir "%aTarget%\libs" )
+  if exist "%~dp0work/%anArchName%.7z" del "%~dp0work/%anArchName%.7z"
+  xcopy /S /Y "%~dp0work\android-armeabi-v7a-gcc\include\*" "%aTarget%\"
+  xcopy /S /Y "%~dp0work\android-armeabi-v7a-gcc\libs\*"    "%aTarget%\libs\"
+  xcopy /S /Y "%~dp0work\android-arm64-v8a-gcc\libs\*"      "%aTarget%\libs\"
+  xcopy /S /Y "%~dp0work\android-x86-gcc\libs\*"            "%aTarget%\libs\"
+  xcopy /S /Y "%~dp0work\android-x86_64-gcc\libs\*"         "%aTarget%\libs\"
+  xcopy /Y "%aBulletSrc%README.md"                          "%aTarget%\"
+  xcopy /Y "%aBulletSrc%LICENSE.txt"                        "%aTarget%\"
+
+  "%THE_7Z_PATH%" a -r %THE_7Z_PARAMS% "%~dp0work/%anArchName%.7z" "%aTarget%"
+)
+
+if not ["%1"] == ["-nopause"] (
+  pause
+)
+
+goto :eof
+
+:cmakeGenerate
+set "anApi=%1"
+set "anAbi=%2"
+set "aPlatformAndCompiler=android-%anAbi%-gcc"
+set "aWorkDir=work\%aPlatformAndCompiler%-make"
+set "aLogFile=%~dp0build-%anAbi%.log"
+if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
+if     exist "%aLogFile%" ( del   "%aLogFile%" )
+
+pushd "%aWorkDir%"
+
+set STARTTIME=%TIME%
+echo Configuring Bullet for Android %anAbi% (API level %anApi%)...
+cmake -G "MinGW Makefiles" ^
+ -D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
+ -D ANDROID_NDK:FILEPATH="%anNdkPath%" ^
+ -D CMAKE_BUILD_TYPE:STRING="Release" ^
+ -D ANDROID_ABI:STRING="%anAbi%" ^
+ -D ANDROID_NATIVE_API_LEVEL:STRING="%anApi%" ^
+ -D ANDROID_STL:STRING="gnustl_shared" ^
+ -D BUILD_LIBRARY_TYPE:STRING="Static" ^
+ -D CMAKE_INSTALL_PREFIX:PATH="%~dp0work/%aPlatformAndCompiler%" ^
+ -D LIBRARY_OUTPUT_PATH:PATH="%~dp0work/%aPlatformAndCompiler%/libs/%anAbi%" ^
+ -D LIB_DESTINATION:STRING="libs/%anAbi%" ^
+ -D INCLUDE_INSTALL_DIR:STRING="%~dp0work/%aPlatformAndCompiler%/include/bullet" ^
+ -D BUILD_BULLET3:BOOL="ON" ^
+ -D BUILD_CPU_DEMOS:BOOL="OFF" ^
+ -D BUILD_EXTRAS:BOOL="OFF" ^
+ -D BUILD_BULLET2_DEMOS:BOOL="OFF" ^
+ -D BUILD_OPENGL3_DEMOS:BOOL="OFF" ^
+ -D BUILD_PYBULLET:BOOL="OFF" ^
+ -D BUILD_SHARED_LIBS:BOOL="OFF" ^
+ -D BUILD_UNIT_TESTS:BOOL="OFF" ^
+ -D BULLET2_USE_THREAD_LOCKS:BOOL="OFF" ^
+ -D USE_GLUT:BOOL="OFF" ^
+ -D USE_DOUBLE_PRECISION:BOOL="OFF" ^
+ -D USE_CUSTOM_VECTOR_MATH:BOOL="OFF" ^
+ -D USE_GRAPHICAL_BENCHMARK:BOOL="OFF" ^
+ -D USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD:BOOL="OFF" ^
+ "%aBulletSrc%"
+
+if errorlevel 1 (
+  popd
+  pause
+  exit /B
+  goto :eof
+)
+
+mingw32-make clean
+
+echo Building Bullet...
+mingw32-make -j %aNbJobs% 2>> %aLogFile%
+type %aLogFile%
+if errorlevel 1 (
+  popd
+  pause
+  exit /B
+  goto :eof
+)
+echo Installing Bullet into %~dp0work/%aPlatformAndCompiler%...
+mingw32-make install 2>> %aLogFile%
+
+set ENDTIME=%TIME%
+rem handle time before 10AM (win10 - remove empty space at the beginning)
+if "%STARTTIME:~0,1%"==" " set "STARTTIME=%STARTTIME:~1%"
+if   "%ENDTIME:~0,1%"==" " set   "ENDTIME=%ENDTIME:~1%"
+rem handle time before 10AM (win7 - add 0 at the beginning)
+if "%STARTTIME:~1,1%"==":" set "STARTTIME=0%STARTTIME%"
+if   "%ENDTIME:~1,1%"==":" set   "ENDTIME=0%ENDTIME%"
+rem convert hours:minutes:seconds:ms into duration
+set /A STARTTIME=(1%STARTTIME:~0,2%-100)*360000 + (1%STARTTIME:~3,2%-100)*6000 + (1%STARTTIME:~6,2%-100)*100 + (1%STARTTIME:~9,2%-100)
+set /A   ENDTIME=  (1%ENDTIME:~0,2%-100)*360000 +   (1%ENDTIME:~3,2%-100)*6000 +   (1%ENDTIME:~6,2%-100)*100 +   (1%ENDTIME:~9,2%-100)
+set /A DURATION=%ENDTIME%-%STARTTIME%
+if %ENDTIME% LSS %STARTTIME% set set /A DURATION=%STARTTIME%-%ENDTIME%
+set /A DURATIONH=%DURATION% / 360000
+set /A DURATIONM=(%DURATION% - %DURATIONH%*360000) / 6000
+set /A DURATIONS=(%DURATION% - %DURATIONH%*360000 - %DURATIONM%*6000) / 100
+if %DURATIONH% LSS 10 set DURATIONH=0%DURATIONH%
+if %DURATIONM% LSS 10 set DURATIONM=0%DURATIONM%
+if %DURATIONS% LSS 10 set DURATIONS=0%DURATIONS%
+echo Building time: %DURATIONH%:%DURATIONM%:%DURATIONS% for %anAbi%
+echo Building time: %DURATIONH%:%DURATIONM%:%DURATIONS% >> %aLogFile%
+
+popd
+goto :eof
diff --git a/adm/scripts/bullet/ios_bullet_build.sh b/adm/scripts/bullet/ios_bullet_build.sh
new file mode 100644 (file)
index 0000000..a8a31a3
--- /dev/null
@@ -0,0 +1,144 @@
+#!/bin/bash
+
+# Auxiliary script for semi-automated building building of Bullet for iOS platform.
+# Script should be placed into root of Bullet repository, edited with paths to CMake.
+# https://github.com/bulletphysics/bullet3/releases
+
+# WARNING! The following line should be removed from CMakeLists.txt in Bullet for building for iOS:
+# FIND_PACKAGE(PythonLibs ${PYTHON_VERSION_STRING} EXACT)
+
+# CMake toolchain definition should be cloned from the following git repository:
+# https://github.com/leetal/ios-cmake
+
+# go to the script directory
+aScriptPath=${BASH_SOURCE%/*}
+if [ -d "$aScriptPath" ]; then cd "$aScriptPath"; fi
+aScriptPath="$PWD"
+aProjName=${PWD##*/}
+
+aBulletSrc=$aScriptPath
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
+
+PATH=/Applications/CMake.app/Contents/bin:$PATH
+
+aToolchain=$HOME/ios-cmake.git/ios.toolchain.cmake
+
+# build stages to perform
+toSimulator=0
+toCMake=1
+toClean=1
+toMake=1
+toInstall=1
+toPack=1
+
+export MACOSX_DEPLOYMENT_TARGET=
+export IPHONEOS_DEPLOYMENT_TARGET=8.0
+
+anAbi=arm64
+aPlatform=OS
+aPlatformAndCompiler=ios-$anAbi-clang
+if [[ $toSimulator == 1 ]]; then
+  anAbi=x86_64
+  aPlatform=SIMULATOR64
+  aPlatformAndCompiler=ios-simulator64-clang
+fi
+aWorkDir=work/$aProjName-${aPlatformAndCompiler}-make
+aDestDir=$aBulletSrc/work/$aProjName-$aPlatformAndCompiler
+aLogFile=$aBulletSrc/build-${aPlatformAndCompiler}.log
+
+mkdir -p $aWorkDir
+rm    -f $aLogFile
+
+pushd $aWorkDir
+
+aTimeZERO=$SECONDS
+set -o pipefail
+
+function logDuration {
+  if [[ $1 == 1 ]]; then
+    aDur=$(($4 - $3))
+    echo $2 time: $aDur sec>> $aLogFile
+  fi
+}
+
+# (re)generate Make files
+if [[ $toCMake == 1 ]]; then
+  echo Configuring Bullet for iOS...
+  cmake -G "Unix Makefiles" \
+  -D CMAKE_TOOLCHAIN_FILE:FILEPATH="$aToolchain" \
+  -D IOS_PLATFORM:STRING="$aPlatform" \
+  -D IOS_ARCH:STRING="$anAbi" \
+  -D IOS_DEPLOYMENT_TARGET:STRING="$IPHONEOS_DEPLOYMENT_TARGET" \
+  -D CMAKE_BUILD_TYPE:STRING="Release" \
+  -D BUILD_LIBRARY_TYPE:STRING="Static" \
+  -D CMAKE_INSTALL_PREFIX:PATH="$aDestDir" \
+  -D CMAKE_INSTALL_PREFIX:PATH="%~dp0work/%aPlatformAndCompiler%" \
+  -D LIBRARY_OUTPUT_PATH:PATH="$aDestDir/lib" \
+  -D LIB_DESTINATION:STRING="lib" \
+  -D INCLUDE_INSTALL_DIR:STRING="$aDestDir/include/bullet" \
+  -D BUILD_BULLET3:BOOL="ON" \
+  -D BUILD_CPU_DEMOS:BOOL="OFF" \
+  -D BUILD_EXTRAS:BOOL="OFF" \
+  -D BUILD_BULLET2_DEMOS:BOOL="OFF" \
+  -D BUILD_OPENGL3_DEMOS:BOOL="OFF" \
+  -D BUILD_PYBULLET:BOOL="OFF" \
+  -D BUILD_SHARED_LIBS:BOOL="OFF" \
+  -D BUILD_UNIT_TESTS:BOOL="OFF" \
+  -D BULLET2_USE_THREAD_LOCKS:BOOL="OFF" \
+  -D USE_GLUT:BOOL="OFF" \
+  -D USE_DOUBLE_PRECISION:BOOL="OFF" \
+  -D USE_CUSTOM_VECTOR_MATH:BOOL="OFF" \
+  -D USE_GRAPHICAL_BENCHMARK:BOOL="OFF" \
+  -D USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD:BOOL="OFF" \
+ "$aBulletSrc" 2>&1 | tee -a $aLogFile
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+fi
+aTimeGEN=$SECONDS
+logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
+
+# clean up from previous build
+if [[ $toClean == 1 ]]; then
+  make clean
+fi
+
+# build the project
+if [[ $toMake == 1 ]]; then
+  echo Building...
+  make -j $aNbJobs 2>&1 | tee -a $aLogFile
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+fi
+aTimeBUILD=$SECONDS
+logDuration $toMake "Building"       $aTimeGEN  $aTimeBUILD
+logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
+
+# install the project
+if [[ $toInstall == 1 ]]; then
+  echo Installing into $aBulletSrc/work/$aPlatformAndCompiler...
+  make install 2>&1 | tee -a $aLogFile
+  xcodebuild -version > $aDestDir/config.log
+  clang --version >> $aDestDir/config.log
+  echo IPHONEOS_DEPLOYMENT_TARGET=$IPHONEOS_DEPLOYMENT_TARGET>> $aDestDir/config.log
+  cp -f $aBulletSrc/VERSION $aDestDir/VERSION
+  cp -f $aBulletSrc/LICENSE.txt $aDestDir/LICENSE.txt
+fi
+aTimeINSTALL=$SECONDS
+logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
+
+# create an archive
+if [[ $toPack == 1 ]]; then
+  anArchName=$aProjName-$aPlatformAndCompiler.tar.bz2
+  echo Creating an archive $aBulletSrc/work/$anArchName...
+  rm $aBulletSrc/work/$anArchName &>/dev/null
+  pushd $aDestDir
+  tar -jcf $aBulletSrc/work/$anArchName *
+  popd
+fi
+aTimePACK=$SECONDS
+logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
+
+# finished
+DURATION=$(($aTimePACK - $aTimeZERO))
+echo Total time: $DURATION sec
+logDuration 1 "Total" $aTimeZERO $aTimePACK
+
+popd
diff --git a/adm/scripts/bullet/macos_bullet_build.sh b/adm/scripts/bullet/macos_bullet_build.sh
new file mode 100644 (file)
index 0000000..719179c
--- /dev/null
@@ -0,0 +1,124 @@
+#!/bin/bash
+
+# Auxiliary script for semi-automated building building of Bullet for macOS platform.
+# Script should be placed into root of bullet repository, edited with paths to CMake.
+# https://github.com/bulletphysics/bullet3/releases
+
+# go to the script directory
+aScriptPath=${BASH_SOURCE%/*}
+if [ -d "$aScriptPath" ]; then cd "$aScriptPath"; fi
+aScriptPath="$PWD"
+aProjName=${PWD##*/}
+
+aBulletSrc=$aScriptPath
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
+
+PATH=/Applications/CMake.app/Contents/bin:$PATH
+
+# build stages to perform
+toCMake=1
+toClean=1
+toMake=1
+toInstall=1
+toPack=1
+
+export MACOSX_DEPLOYMENT_TARGET=10.10
+anAbi=arm64
+#anAbi=x86_64
+aPlatformAndCompiler=macos-$anAbi
+aWorkDir=work/$aProjName-${aPlatformAndCompiler}-make
+aDestDir=$aBulletSrc/work/$aProjName-$aPlatformAndCompiler
+aLogFile=$aBulletSrc/build-${aPlatformAndCompiler}.log
+
+mkdir -p $aWorkDir
+rm    -f $aLogFile
+
+pushd $aWorkDir
+
+aTimeZERO=$SECONDS
+set -o pipefail
+
+function logDuration {
+  if [[ $1 == 1 ]]; then
+    aDur=$(($4 - $3))
+    echo $2 time: $aDur sec>> $aLogFile
+  fi
+}
+
+# (re)generate Make files
+if [[ $toCMake == 1 ]]; then
+  echo Configuring Bullet for OS X...
+  cmake -G "Unix Makefiles" \
+  -D CMAKE_BUILD_TYPE:STRING="Release" \
+  -D BUILD_LIBRARY_TYPE:STRING="Static" \
+  -D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
+  -D CMAKE_INSTALL_PREFIX:PATH="$aDestDir" \
+  -D LIBRARY_OUTPUT_PATH:PATH="$aDestDir/lib" \
+  -D LIB_DESTINATION:STRING="lib" \
+  -D INCLUDE_INSTALL_DIR:STRING="$aDestDir/include/bullet" \
+  -D BUILD_BULLET3:BOOL="ON" \
+  -D BUILD_CPU_DEMOS:BOOL="OFF" \
+  -D BUILD_EXTRAS:BOOL="OFF" \
+  -D BUILD_BULLET2_DEMOS:BOOL="OFF" \
+  -D BUILD_OPENGL3_DEMOS:BOOL="OFF" \
+  -D BUILD_PYBULLET:BOOL="OFF" \
+  -D BUILD_SHARED_LIBS:BOOL="OFF" \
+  -D BUILD_UNIT_TESTS:BOOL="OFF" \
+  -D BULLET2_USE_THREAD_LOCKS:BOOL="OFF" \
+  -D USE_GLUT:BOOL="OFF" \
+  -D USE_DOUBLE_PRECISION:BOOL="OFF" \
+  -D USE_CUSTOM_VECTOR_MATH:BOOL="OFF" \
+  -D USE_GRAPHICAL_BENCHMARK:BOOL="OFF" \
+  -D USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD:BOOL="OFF" \
+ "$aBulletSrc" 2>&1 | tee -a $aLogFile
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+fi
+aTimeGEN=$SECONDS
+logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
+
+# clean up from previous build
+if [[ $toClean == 1 ]]; then
+  make clean
+fi
+
+# build the project
+if [[ $toMake == 1 ]]; then
+  echo Building...
+  make -j $aNbJobs 2>&1 | tee -a $aLogFile
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+fi
+aTimeBUILD=$SECONDS
+logDuration $toMake "Building"       $aTimeGEN  $aTimeBUILD
+logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
+
+# install the project
+if [[ $toInstall == 1 ]]; then
+  echo Installing into $aBulletSrc/work/$aPlatformAndCompiler...
+  make install 2>&1 | tee -a $aLogFile
+  xcodebuild -version > $aDestDir/config.log
+  clang --version >> $aDestDir/config.log
+  echo MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET>> $aDestDir/config.log
+  cp -f $aBulletSrc/VERSION $aDestDir/VERSION
+  cp -f $aBulletSrc/LICENSE.txt $aDestDir/LICENSE.txt
+fi
+aTimeINSTALL=$SECONDS
+logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
+
+# create an archive
+if [[ $toPack == 1 ]]; then
+  anArchName=$aProjName-$aPlatformAndCompiler.tar.bz2
+  echo Creating an archive $aBulletSrc/work/$anArchName...
+  rm $aBulletSrc/work/$anArchName &>/dev/null
+  pushd $aDestDir
+  tar -jcf $aBulletSrc/work/$anArchName *
+  popd
+fi
+aTimePACK=$SECONDS
+logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
+
+# finished
+DURATION=$(($aTimePACK - $aTimeZERO))
+echo Total time: $DURATION sec
+logDuration 1 "Total" $aTimeZERO $aTimePACK
+
+popd
diff --git a/adm/scripts/draco/android_draco_build.bat b/adm/scripts/draco/android_draco_build.bat
new file mode 100644 (file)
index 0000000..8c7820c
--- /dev/null
@@ -0,0 +1,101 @@
+@echo OFF
+
+rem Auxiliary script for semi-automated building of Draco library for Android platform.
+rem https://github.com/google/draco
+
+set "aDracoSrc=%~dp0"
+set "aBuildRoot=%aDracoSrc%\work"
+
+set aNbJobs=%NUMBER_OF_PROCESSORS%
+
+rem Paths to 3rd-party tools and libraries
+call c:\TDM-GCC-64\mingwvars.bat
+set "aCmakeBin=c:\CMake\bin"
+set "anNdkPath=c:/android-ndk-r12"
+
+set "PATH=%aCmakeBin%;%PATH%"
+set "aCompiler=gcc"
+set "aCppLib=gnustl_shared"
+if not exist "%anNdkPath%/sources/cxx-stl/gnu-libstdc++" (
+  if exist "%anNdkPath%/sources/cxx-stl/llvm-libc++" (
+    set "aCompiler=clang"
+    set "aCppLib=c++_shared"
+  )
+)
+
+set "aDestDir=%aBuildRoot%\draco-android-%aCompiler%"
+rmdir /S /Q "%aDestDir%"
+if not exist "%aDestDir%" ( mkdir "%aDestDir%" )
+if not exist "%aDestDir%\include" ( mkdir "%aDestDir%\include" )
+if not exist "%aDestDir%\libs"    ( mkdir "%aDestDir%\libs" )
+xcopy /Y "%aDracoSrc%\LICENSE"   "%aDestDir%\"
+xcopy /Y "%aDracoSrc%\README.md" "%aDestDir%\"
+
+call :cmakeGenerate "15" "armeabi-v7a"
+call :cmakeGenerate "15" "x86"
+call :cmakeGenerate "21" "arm64-v8a"
+call :cmakeGenerate "21" "x86_64"
+
+set "anArchName=draco-android"
+echo Creating archive %anArchName%.7z
+if exist "%aBuildRoot%/%anArchName%.7z" del "%aBuildRoot%/%anArchName%.7z"
+set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
+set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
+"%THE_7Z_PATH%" a -r %THE_7Z_PARAMS% "%aBuildRoot%/%anArchName%.7z" "%aDestDir%"
+
+pause
+
+goto :eof
+
+:cmakeGenerate
+set "anApi=%~1"
+set "anAbi=%~2"
+set "aPlatformAndCompiler=android-%anAbi%-%aCompiler%"
+set "aWorkDir=%aBuildRoot%\draco-%aPlatformAndCompiler%-make"
+set "aLogFile=%aBuildRoot%\build-%aPlatformAndCompiler%.log"
+if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
+if     exist "%aLogFile%" ( del   "%aLogFile%" )
+
+pushd "%aWorkDir%"
+
+echo Configuring Draco for Android %anAbi%, API level %anApi%...
+cmake -G "MinGW Makefiles" ^
+ -D CMAKE_SYSTEM_NAME:STRING="Android" ^
+ -D CMAKE_ANDROID_NDK="%anNdkPath%" ^
+ -D CMAKE_BUILD_TYPE:STRING="Release" ^
+ -D CMAKE_ANDROID_ARCH_ABI:STRING="%anAbi%" ^
+ -D CMAKE_SYSTEM_VERSION:STRING="%anApi%" ^
+ -D CMAKE_ANDROID_STL_TYPE="%aCppLib%" ^
+ -D BUILD_LIBRARY_TYPE:STRING="Static" ^
+ -D CMAKE_INSTALL_PREFIX:PATH="%aBuildRoot%/draco-%aPlatformAndCompiler%" ^
+ -D LIBRARY_OUTPUT_PATH:PATH="%aBuildRoot%/draco-%aPlatformAndCompiler%/libs/%anAbi%" ^
+ "%aDracoSrc%"
+
+if errorlevel 1 (
+  popd
+  pause
+  exit /B
+  goto :eof
+)
+
+mingw32-make clean
+
+echo Building...
+mingw32-make -j %aNbJobs% 2>> "%aLogFile%"
+if errorlevel 1 (
+  type %aLogFile%
+  popd
+  pause
+  exit /B
+  goto :eof
+)
+type %aLogFile%
+
+echo Installing Draco into %aBuildRoot%/draco-%aPlatformAndCompiler%...
+mingw32-make install 2>> %aLogFile%
+
+xcopy /S /Y "%aBuildRoot%\draco-%aPlatformAndCompiler%\include\*" "%aDestDir%\include\"
+xcopy /S /Y "%aBuildRoot%\draco-%aPlatformAndCompiler%\libs\*"    "%aDestDir%\libs\"
+
+popd
+goto :eof
diff --git a/adm/scripts/draco/linux_draco_build.sh b/adm/scripts/draco/linux_draco_build.sh
new file mode 100644 (file)
index 0000000..31ef41b
--- /dev/null
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+# Auxiliary script for semi-automated building of Draco for Linux platform.
+# Script should be placed into root of Draco repository, edited with paths to CMake.
+# https://github.com/google/draco
+
+# go to the script directory
+aScriptPath=${BASH_SOURCE%/*}
+if [ -d "$aScriptPath" ]; then cd "$aScriptPath"; fi
+aScriptPath="$PWD"
+aProjName=${PWD##*/}
+
+aDracoSrc=$aScriptPath
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
+
+# CMake should be up-to-date
+#PATH=~/develop/local/bin:$PATH
+
+# build stages to perform
+toCMake=1
+toClean=1
+toMake=1
+toInstall=1
+toPack=1
+
+aPlatformAndCompiler=lin64-gcc
+aWorkDir=work/$aProjName-${aPlatformAndCompiler}-make
+aDestDir=$aDracoSrc/work/$aProjName-$aPlatformAndCompiler
+aLogFile=$aDracoSrc/build-${aPlatformAndCompiler}.log
+
+mkdir -p $aWorkDir
+rm    -f $aLogFile
+
+pushd $aWorkDir
+
+aTimeZERO=$SECONDS
+set -o pipefail
+
+function logDuration {
+  if [[ $1 == 1 ]]; then
+    aDur=$(($4 - $3))
+    echo $2 time: $aDur sec>> $aLogFile
+  fi
+}
+
+# (re)generate Make files
+if [[ $toCMake == 1 ]]; then
+  echo Configuring Draco for Linux...
+  cmake -G "Unix Makefiles" \
+  -D CMAKE_BUILD_TYPE:STRING="Release" \
+  -D CMAKE_INSTALL_PREFIX:PATH="$aDestDir" \
+  -D BUILD_DOCS:BOOL="OFF" \
+  -D BUILD_LIBRARY_TYPE:STRING="Static" \
+  "$aDracoSrc" 2>&1 | tee -a $aLogFile
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+fi
+aTimeGEN=$SECONDS
+logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
+
+# clean up from previous build
+if [[ $toClean == 1 ]]; then
+  make clean
+fi
+
+# build the project
+if [[ $toMake == 1 ]]; then
+  echo Building...
+  make -j $aNbJobs 2>&1 | tee -a $aLogFile
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+fi
+aTimeBUILD=$SECONDS
+logDuration $toMake "Building"       $aTimeGEN  $aTimeBUILD
+logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
+
+# install the project
+if [[ $toInstall == 1 ]]; then
+  echo Installing into $aDracoSrc/work/$aPlatformAndCompiler...
+  make install 2>&1 | tee -a $aLogFile
+  gcc --version >> $aDestDir/config.log
+  cp -f $aDracoSrc/LICENSE $aDestDir/LICENSE
+fi
+aTimeINSTALL=$SECONDS
+logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
+
+# create an archive
+if [[ $toPack == 1 ]]; then
+  anArchName=$aProjName-$aPlatformAndCompiler.tar.bz2
+  echo Creating an archive $aDracoSrc/work/$anArchName...
+  rm $aDracoSrc/work/$anArchName &>/dev/null
+  pushd $aDestDir
+  tar -jcf $aDracoSrc/work/$anArchName *
+  popd
+fi
+aTimePACK=$SECONDS
+logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
+
+# finished
+DURATION=$(($aTimePACK - $aTimeZERO))
+echo Total time: $DURATION sec
+logDuration 1 "Total" $aTimeZERO $aTimePACK
+
+popd
diff --git a/adm/scripts/draco/macos_draco_build.sh b/adm/scripts/draco/macos_draco_build.sh
new file mode 100644 (file)
index 0000000..030f8be
--- /dev/null
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+# Auxiliary script for semi-automated building building of Draco for macOS platform.
+# Script should be placed into root of Draco repository, edited with paths to CMake.
+# https://github.com/google/draco
+
+# go to the script directory
+aScriptPath=${BASH_SOURCE%/*}
+if [ -d "$aScriptPath" ]; then cd "$aScriptPath"; fi
+aScriptPath="$PWD"
+aProjName=${PWD##*/}
+
+aDracoSrc=$aScriptPath
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
+
+PATH=/Applications/CMake.app/Contents/bin:$PATH
+
+# build stages to perform
+toCMake=1
+toClean=1
+toMake=1
+toInstall=1
+toPack=1
+
+export MACOSX_DEPLOYMENT_TARGET=10.10
+anAbi=arm64
+#anAbi=x86_64
+aPlatformAndCompiler=macos-$anAbi
+aWorkDir=work/$aProjName-${aPlatformAndCompiler}-make
+aDestDir=$aDracoSrc/work/$aProjName-$aPlatformAndCompiler
+aLogFile=$aDracoSrc/build-${aPlatformAndCompiler}.log
+
+mkdir -p $aWorkDir
+rm    -f $aLogFile
+
+pushd $aWorkDir
+
+aTimeZERO=$SECONDS
+set -o pipefail
+
+function logDuration {
+  if [[ $1 == 1 ]]; then
+    aDur=$(($4 - $3))
+    echo $2 time: $aDur sec>> $aLogFile
+  fi
+}
+
+# (re)generate Make files
+if [[ $toCMake == 1 ]]; then
+  echo Configuring Draco for macOS...
+  cmake -G "Unix Makefiles" \
+  -D CMAKE_BUILD_TYPE:STRING="Release" \
+  -D BUILD_LIBRARY_TYPE:STRING="Static" \
+  -D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
+  -D CMAKE_INSTALL_PREFIX:PATH="$aDestDir" \
+ "$aDracoSrc" 2>&1 | tee -a $aLogFile
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+fi
+aTimeGEN=$SECONDS
+logDuration $toCMake "Generation" $aTimeZERO $aTimeGEN
+
+# clean up from previous build
+if [[ $toClean == 1 ]]; then
+  make clean
+fi
+
+# build the project
+if [[ $toMake == 1 ]]; then
+  echo Building...
+  make -j $aNbJobs 2>&1 | tee -a $aLogFile
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+fi
+aTimeBUILD=$SECONDS
+logDuration $toMake "Building"       $aTimeGEN  $aTimeBUILD
+logDuration $toMake "Total building" $aTimeZERO $aTimeBUILD
+
+# install the project
+if [[ $toInstall == 1 ]]; then
+  echo Installing into $aDracoSrc/work/$aPlatformAndCompiler...
+  make install 2>&1 | tee -a $aLogFile
+  xcodebuild -version > $aDestDir/config.log
+  clang --version >> $aDestDir/config.log
+  echo MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET>> $aDestDir/config.log
+  cp -f $aDracoSrc/README.md $aDestDir/README.md
+  cp -f $aDracoSrc/LICENSE   $aDestDir/LICENSE
+fi
+aTimeINSTALL=$SECONDS
+logDuration $toInstall "Install" $aTimeBUILD $aTimeINSTALL
+
+# create an archive
+if [[ $toPack == 1 ]]; then
+  anArchName=$aProjName-$aPlatformAndCompiler.tar.bz2
+  echo Creating an archive $aDracoSrc/work/$anArchName...
+  rm $aDracoSrc/work/$anArchName &>/dev/null
+  pushd $aDestDir
+  tar -jcf $aDracoSrc/work/$anArchName *
+  popd
+fi
+aTimePACK=$SECONDS
+logDuration $toPack "Packing archive" $aTimeINSTALL $aTimePACK
+
+# finished
+DURATION=$(($aTimePACK - $aTimeZERO))
+echo Total time: $DURATION sec
+logDuration 1 "Total" $aTimeZERO $aTimePACK
+
+popd
diff --git a/adm/scripts/draco/wasm_draco_build.bat b/adm/scripts/draco/wasm_draco_build.bat
new file mode 100644 (file)
index 0000000..8d3a864
--- /dev/null
@@ -0,0 +1,107 @@
+@echo OFF
+
+rem Auxiliary script for semi-automated building of Draco library as WebAssembly library.
+rem https://github.com/google/draco
+
+set "aDracoSrc=%~dp0"
+set "aBuildRoot=%aDracoSrc%\work"
+
+set aNbJobs=%NUMBER_OF_PROCESSORS%
+
+rem Paths to 3rd-party tools and libraries
+set "aCmakeBin=c:\CMake\bin"
+set "EMSDK_ROOT=c:\emsdk"
+set "EMSCRIPTEN=%EMSDK_ROOT%/upstream/emscripten"
+set "PATH=%EMSDK_ROOT%\python\3.9.2-1_64bit;%PATH%"
+
+rem Build stages to perform
+set "toCMake=1"
+set "toClean=1"
+set "toMake=1"
+set "toInstall=1"
+set "toDebug=0"
+
+call "%EMSDK_ROOT%\emsdk_env.bat"
+set "aToolchain=%EMSDK%/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
+if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
+
+set "aBuildType=Release"
+set "aBuildTypePrefix="
+if ["%toDebug%"] == ["1"] (
+  set "aBuildType=Debug"
+  set "aBuildTypePrefix=-debug"
+)
+
+call :cmakeGenerate
+if not ["%1"] == ["-nopause"] (
+  pause
+)
+
+goto :eof
+
+:cmakeGenerate
+set "aPlatformAndCompiler=wasm32%aBuildTypePrefix%"
+set "aWorkDir=%aBuildRoot%\draco-%aPlatformAndCompiler%-make"
+set "aDestDir=%aBuildRoot%\draco-%aPlatformAndCompiler%"
+set "aLogFile=%aBuildRoot%\draco-%aPlatformAndCompiler%-build.log"
+if ["%toCMake%"] == ["1"] (
+  if ["%toClean%"] == ["1"] (
+    rmdir /S /Q %aWorkDir%"
+    rmdir /S /Q %aDestDir%"
+  )
+)
+if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
+if     exist "%aLogFile%" ( del   "%aLogFile%" )
+
+pushd "%aWorkDir%"
+
+if ["%toCMake%"] == ["1"] (
+  cmake -G "MinGW Makefiles" ^
+ -D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
+ -D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
+ -D CMAKE_INSTALL_PREFIX:PATH="%aDestDir%" ^
+ -D BUILD_LIBRARY_TYPE:STRING="Static" ^
+ -D DRACO_WASM:BOOL="ON" ^
+ -D DRACO_JS_GLUE:BOOL="OFF" ^
+ "%aDracoSrc%"
+
+rem -D DRACO_POINT_CLOUD_COMPRESSION:BOOL="OFF" ^
+rem -D DRACO_MESH_COMPRESSION:BOOL="OFF" ^
+  if errorlevel 1 (
+    popd
+    pause
+    exit /B
+    goto :eof
+  )
+)
+if ["%toClean%"] == ["1"] (
+  mingw32-make clean
+)
+
+if ["%toMake%"] == ["1"] (
+  echo Building...
+  mingw32-make -j %aNbJobs% 2>> "%aLogFile%"
+  if errorlevel 1 (
+    type "%aLogFile%"
+    popd
+    pause
+    exit /B
+    goto :eof
+  )
+  type "%aLogFile%"
+)
+
+if ["%toInstall%"] == ["1"] (
+  mingw32-make install 2>> "%aLogFile%"
+  if errorlevel 1 (
+    type "%aLogFile%"
+    popd
+    pause
+    exit /B
+    goto :eof
+  )
+)
+popd
+
+goto :eof
diff --git a/adm/scripts/freetype/android_freetype_build.bat b/adm/scripts/freetype/android_freetype_build.bat
new file mode 100644 (file)
index 0000000..b5f23b5
--- /dev/null
@@ -0,0 +1,139 @@
+@echo OFF
+
+rem Auxiliary script for semi-automated building of FreeType for Android platform.
+rem Script should be placed into root of FreeType repository, edited with paths
+rem to CMake, 3rd-parties, Android NDK and MinGW64 make tool.
+
+rem CMake toolchain definition should be cloned from the following git repository:
+rem https://github.com/taka-no-me/android-cmake
+
+rem CMake can be downloaded from official site:
+rem https://cmake.org/download/
+
+rem Android NDK can be downloaded from official site:
+rem https://developer.android.com/ndk/downloads
+
+set "aFreeTypeSrc=%~dp0"
+set aNbJobs=%NUMBER_OF_PROCESSORS%
+
+call c:\TDM-GCC-64\mingwvars.bat
+set "PATH=c:\CMake\bin;%PATH%"
+set "anNdkPath=c:/android-ndk-r12"
+set "aToolchain=c:/android-cmake-master/android.toolchain.cmake"
+
+set "toPack=1"
+
+set "FREETYPE_MAJOR=0"
+set "FREETYPE_MINOR=0"
+set "FREETYPE_PATCH=0"
+for /f "tokens=3" %%i in ('findstr /b /c:"#define FREETYPE_MAJOR" "%aFreeTypeSrc%\include\freetype\freetype.h"') do ( set "FREETYPE_MAJOR=%%i" )
+for /f "tokens=3" %%i in ('findstr /b /c:"#define FREETYPE_MINOR" "%aFreeTypeSrc%\include\freetype\freetype.h"') do ( set "FREETYPE_MINOR=%%i" )
+for /f "tokens=3" %%i in ('findstr /b /c:"#define FREETYPE_PATCH" "%aFreeTypeSrc%\include\freetype\freetype.h"') do ( set "FREETYPE_PATCH=%%i" )
+set "aFreeTypeVersion=%FREETYPE_MAJOR%.%FREETYPE_MINOR%.%FREETYPE_PATCH%"
+echo "aFreeTypeVersion=%aFreeTypeVersion%"
+
+call :cmakeGenerate "15" "armeabi-v7a"
+call :cmakeGenerate "15" "x86"
+call :cmakeGenerate "21" "arm64-v8a"
+call :cmakeGenerate "21" "x86_64"
+
+set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on"
+if ["%THE_7Z_PATH%"] == [""] set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
+if not exist "%THE_7Z_PATH%" set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe"
+if not exist "%THE_7Z_PATH%" set "THE_7Z_PATH=%ProgramFiles%\7-Zip\7z.exe"
+
+set "anArchName=freetype-%aFreeTypeVersion%-android"
+set "aTarget=%~dp0work\%anArchName%"
+
+if "%toPack%"=="1" (
+  echo Creating archive %anArchName%.7z
+  rmdir /S /Q "%aTarget%"
+  if not exist "%aTarget%\libs" ( mkdir "%aTarget%\libs" )
+  if exist "%~dp0work/%anArchName%.7z" del "%~dp0work/%anArchName%.7z"
+  xcopy /S /Y /I "%~dp0work\android-armeabi-v7a-gcc\include\freetype2"  "%aTarget%\include"
+  xcopy /Y "%~dp0work\android-armeabi-v7a-gcc\lib\*.so" "%aTarget%\libs\armeabi-v7a\"
+  xcopy /Y "%~dp0work\android-arm64-v8a-gcc\lib\*.so"   "%aTarget%\libs\arm64-v8a\"
+  xcopy /Y "%~dp0work\android-x86-gcc\lib\*.so"         "%aTarget%\libs\x86\"
+  xcopy /Y "%~dp0work\android-x86_64-gcc\lib\*.so"      "%aTarget%\libs\x86_64\"
+  xcopy /Y "%aFreeTypeSrc%\README"                      "%aTarget%\"
+  xcopy /Y "%aFreeTypeSrc%\docs\FTL.TXT"                "%aTarget%\"
+  xcopy /Y "%aFreeTypeSrc%\docs\GPLv2.TXT"              "%aTarget%\"
+  xcopy /Y "%aFreeTypeSrc%\docs\LICENSE.TXT"            "%aTarget%\"
+
+  "%THE_7Z_PATH%" a -r %THE_7Z_PARAMS% "%~dp0work/%anArchName%.7z" "%aTarget%"
+)
+
+if not ["%1"] == ["-nopause"] (
+  pause
+)
+
+goto :eof
+
+:cmakeGenerate
+set "anApi=%1"
+set "anAbi=%2"
+set "aPlatformAndCompiler=android-%anAbi%-gcc"
+set "aWorkDir=work\%aPlatformAndCompiler%-make"
+set "aLogFile=%~dp0build-%anAbi%.log"
+if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" )
+if     exist "%aLogFile%" ( del   "%aLogFile%" )
+
+pushd "%aWorkDir%"
+
+set STARTTIME=%TIME%
+echo Configuring OCCT for Android %anAbi% (API level %anApi%)...
+cmake -G "MinGW Makefiles" ^
+ -D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
+ -D ANDROID_NDK:FILEPATH="%anNdkPath%" ^
+ -D ANDROID_ABI:STRING="%anAbi%" ^
+ -D ANDROID_NATIVE_API_LEVEL:STRING="%anApi%" ^
+ -D ANDROID_STL:STRING="gnustl_shared" ^
+ -D CMAKE_BUILD_TYPE:STRING="Release" ^
+ -D BUILD_SHARED_LIBS:BOOL="TRUE" ^
+ -D CMAKE_INSTALL_PREFIX:PATH="%~dp0work/%aPlatformAndCompiler%" ^
+ "%aFreeTypeSrc%"
+
+if errorlevel 1 (
+  popd
+  pause
+  exit /B
+  goto :eof
+)
+
+mingw32-make clean
+
+echo Building FreeType...
+mingw32-make -j %aNbJobs% 2>> %aLogFile%
+type %aLogFile%
+if errorlevel 1 (
+  popd
+  pause
+  exit /B
+  goto :eof
+)
+echo Installing FreeType into %~dp0work/%aPlatformAndCompiler%...
+mingw32-make install 2>> %aLogFile%
+
+set ENDTIME=%TIME%
+rem handle time before 10AM (win10 - remove empty space at the beginning)
+if "%STARTTIME:~0,1%"==" " set "STARTTIME=%STARTTIME:~1%"
+if   "%ENDTIME:~0,1%"==" " set   "ENDTIME=%ENDTIME:~1%"
+rem handle time before 10AM (win7 - add 0 at the beginning)
+if "%STARTTIME:~1,1%"==":" set "STARTTIME=0%STARTTIME%"
+if   "%ENDTIME:~1,1%"==":" set   "ENDTIME=0%ENDTIME%"
+rem convert hours:minutes:seconds:ms into duration
+set /A STARTTIME=(1%STARTTIME:~0,2%-100)*360000 + (1%STARTTIME:~3,2%-100)*6000 + (1%STARTTIME:~6,2%-100)*100 + (1%STARTTIME:~9,2%-100)
+set /A   ENDTIME=  (1%ENDTIME:~0,2%-100)*360000 +   (1%ENDTIME:~3,2%-100)*6000 +   (1%ENDTIME:~6,2%-100)*100 +   (1%ENDTIME:~9,2%-100)
+set /A DURATION=%ENDTIME%-%STARTTIME%
+if %ENDTIME% LSS %STARTTIME% set set /A DURATION=%STARTTIME%-%ENDTIME%
+set /A DURATIONH=%DURATION% / 360000
+set /A DURATIONM=(%DURATION% - %DURATIONH%*360000) / 6000
+set /A DURATIONS=(%DURATION% - %DURATIONH%*360000 - %DURATIONM%*6000) / 100
+if %DURATIONH% LSS 10 set DURATIONH=0%DURATIONH%
+if %DURATIONM% LSS 10 set DURATIONM=0%DURATIONM%
+if %DURATIONS% LSS 10 set DURATIONS=0%DURATIONS%
+echo Building time: %DURATIONH%:%DURATIONM%:%DURATIONS% for %anAbi%
+echo Building time: %DURATIONH%:%DURATIONM%:%DURATIONS% >> %aLogFile%
+
+popd
+goto :eof
diff --git a/adm/scripts/freetype/ios_freetype_build.sh b/adm/scripts/freetype/ios_freetype_build.sh
new file mode 100644 (file)
index 0000000..24fc262
--- /dev/null
@@ -0,0 +1,103 @@
+#!/bin/bash
+
+# Auxiliary script for building FreeType library for iOS platform.
+
+aScriptDir=${BASH_SOURCE%/*}
+if [ -d "$aScriptDir" ]; then cd "$aScriptDir"; fi
+aScriptDir="$PWD"
+
+aFreeType=freetype-2.10.4
+aFreeTypeSrc=${aScriptDir}/${aFreeType}-src
+
+PATH=/Applications/CMake.app/Contents/bin:$PATH
+PLATFORMPATH="/Applications/Xcode.app/Contents/Developer/Platforms"
+export IPHONEOS_DEPLOYMENT_TARGET=8.0
+
+rm -r -f ${aFreeType}-ios
+mkdir -p ${aFreeType}-ios/lib
+rm -r -f ${aFreeType}-iPhoneSimulator
+mkdir -p ${aFreeType}-iPhoneSimulator/lib
+
+function buildArchCmake {
+  anAbi=$1
+  aPlatformSdk=$2
+  aSysRoot=$PLATFORMPATH/${aPlatformSdk}.platform/Developer/SDKs/${aPlatformSdk}.sdk
+
+  aPlatformAndCompiler=${aPlatformSdk}-${anAbi}-clang
+  
+  aWorkDir="${aScriptDir}/${aFreeType}-${aPlatformAndCompiler}-make"
+  aDestDir="${aScriptDir}/${aFreeType}-${aPlatformAndCompiler}"
+  aLogFile="${aScriptDir}/${aFreeType}-build-${aPlatformAndCompiler}.log"
+
+  rm -r -f "$aWorkDir"
+  rm -r -f "$aDestDir"
+  mkdir -p "$aWorkDir"
+  mkdir -p "$aDestDir"
+  rm -f "$aLogFile"
+
+  pushd ${aWorkDir}
+  cmake -G "Unix Makefiles" \
+  -D CMAKE_SYSTEM_NAME="iOS" \
+  -D CMAKE_OSX_ARCHITECTURES:STRING="$anAbi" \
+  -D CMAKE_OSX_DEPLOYMENT_TARGET:STRING="$IPHONEOS_DEPLOYMENT_TARGET" \
+  -D CMAKE_OSX_SYSROOT:PATH="$aSysRoot" \
+  -D CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS:BOOL="OFF" \
+  -D CMAKE_BUILD_TYPE:STRING="Release" \
+  -D CMAKE_INSTALL_PREFIX:PATH="$aDestDir" \
+  -D BUILD_SHARED_LIBS:BOOL="OFF" \
+  -D FT_WITH_ZLIB:BOOL="OFF" \
+  -D FT_WITH_BZIP2:BOOL="OFF" \
+  -D FT_WITH_PNG:BOOL="OFF" \
+  -D FT_WITH_HARFBUZZ:BOOL="OFF" \
+  -D FT_WITH_BROTLI:BOOL="OFF" \
+  "$aFreeTypeSrc" 2>&1 | tee -a "$aLogFile"
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+  
+  make clean
+
+  echo Building...
+  make 2>&1 | tee -a "$aLogFile"
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+
+  make install
+  echo Installing into $aDestDir...
+  make install 2>&1 | tee -a "$aLogFile"
+
+  popd
+}
+
+buildArchCmake arm64  iPhoneOS
+buildArchCmake arm64  iPhoneSimulator
+buildArchCmake x86_64 iPhoneSimulator
+
+aTargName=ios
+cp -rf ./${aFreeType}-src/include      ${aFreeType}-${aTargName}/
+cp ./${aFreeType}-src/docs/FTL.TXT     ${aFreeType}-${aTargName}/
+cp ./${aFreeType}-src/docs/GPLv2.TXT   ${aFreeType}-${aTargName}/
+cp ./${aFreeType}-src/docs/LICENSE.TXT ${aFreeType}-${aTargName}/
+cp ./${aFreeType}-src/docs/CHANGES     ${aFreeType}-${aTargName}/
+cp ./${aFreeType}-src/docs/README      ${aFreeType}-${aTargName}/
+lipo -create -output ${aFreeType}-${aTargName}/lib/libfreetype.a ${aFreeType}-iPhoneOS-arm64-clang/lib/libfreetype.a 
+lipo -info ${aFreeType}-${aTargName}/lib/libfreetype.a
+
+anArchName=${aFreeType}-${aTargName}.tar.bz2
+rm ${aDestDir}/../${anArchName} &>/dev/null
+pushd "./${aFreeType}-${aTargName}"
+tar -jcf ${aScriptDir}/${anArchName} *
+popd
+
+aTargName=iPhoneSimulator
+cp -rf ./${aFreeType}-src/include      ${aFreeType}-${aTargName}/
+cp ./${aFreeType}-src/docs/FTL.TXT     ${aFreeType}-${aTargName}/
+cp ./${aFreeType}-src/docs/GPLv2.TXT   ${aFreeType}-${aTargName}/
+cp ./${aFreeType}-src/docs/LICENSE.TXT ${aFreeType}-${aTargName}/
+cp ./${aFreeType}-src/docs/CHANGES     ${aFreeType}-${aTargName}/
+cp ./${aFreeType}-src/docs/README      ${aFreeType}-${aTargName}/
+lipo -create -output ${aFreeType}-${aTargName}/lib/libfreetype.a ${aFreeType}-iPhoneSimulator-arm64-clang/lib/libfreetype.a ${aFreeType}-iPhoneSimulator-x86_64-clang/lib/libfreetype.a
+lipo -info ${aFreeType}-${aTargName}/lib/libfreetype.a
+
+anArchName=${aFreeType}-${aTargName}.tar.bz2
+rm ${aDestDir}/../${anArchName} &>/dev/null
+pushd "./${aFreeType}-${aTargName}"
+tar -jcf ${aScriptDir}/${anArchName} *
+popd
diff --git a/adm/scripts/freetype/macos_freetype_build.sh b/adm/scripts/freetype/macos_freetype_build.sh
new file mode 100644 (file)
index 0000000..c96039c
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+aFreeType=freetype-2.10.4
+
+export MACOSX_DEPLOYMENT_TARGET=10.10
+rm -r -f ${aFreeType}-macos
+mkdir -p ${aFreeType}-macos/lib
+
+function buildArch {
+  anArch=$1
+  pushd ./${aFreeType}-src
+  ./configure CFLAGS="-mmacosx-version-min=10.10 -arch $anArch" LDFLAGS="-Wl,-install_name,@executable_path/../Frameworks/libfreetype.6.dylib" --enable-shared --enable-static
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+  make clean
+  make
+  aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+
+  rm -r -f ../${aFreeType}-macos-$anArch
+  mkdir -p ../${aFreeType}-macos-$anArch/lib
+  cp -rf ./include      ../${aFreeType}-macos-$anArch/
+  cp ./docs/FTL.TXT     ../${aFreeType}-macos-$anArch/
+  cp ./docs/GPLv2.TXT   ../${aFreeType}-macos-$anArch/
+  cp ./docs/LICENSE.TXT ../${aFreeType}-macos-$anArch/
+  cp ./docs/CHANGES     ../${aFreeType}-macos-$anArch/
+  cp ./docs/README      ../${aFreeType}-macos-$anArch/
+
+  cp ./objs/.libs/libfreetype.a       ../${aFreeType}-macos-$anArch/lib/
+  cp ./objs/.libs/libfreetype.6.dylib ../${aFreeType}-macos-$anArch/lib/
+  cp ./objs/.libs/libfreetype.la      ../${aFreeType}-macos-$anArch/lib/
+  #cp ./objs/.libs/libfreetype.dylib   ../${aFreeType}-macos-$anArch/lib/
+  ln -s libfreetype.6.dylib ../${aFreeType}-macos-$anArch/lib/libfreetype.dylib
+  popd
+}
+
+for anArchIter in x86_64 arm64
+do
+  buildArch $anArchIter 
+done
+
+cp -rf ./${aFreeType}-src/include      ${aFreeType}-macos/
+cp ./${aFreeType}-src/docs/FTL.TXT     ${aFreeType}-macos/
+cp ./${aFreeType}-src/docs/GPLv2.TXT   ${aFreeType}-macos/
+cp ./${aFreeType}-src/docs/LICENSE.TXT ${aFreeType}-macos/
+cp ./${aFreeType}-src/docs/CHANGES     ${aFreeType}-macos/
+cp ./${aFreeType}-src/docs/README      ${aFreeType}-macos/
+lipo -create -output ${aFreeType}-macos/lib/libfreetype.a       ${aFreeType}-macos-x86_64/lib/libfreetype.a       ${aFreeType}-macos-arm64/lib/libfreetype.a
+lipo -create -output ${aFreeType}-macos/lib/libfreetype.6.dylib ${aFreeType}-macos-x86_64/lib/libfreetype.6.dylib ${aFreeType}-macos-arm64/lib/libfreetype.6.dylib
+ln -s libfreetype.6.dylib ${aFreeType}-macos/lib/libfreetype.dylib
+lipo -info ${aFreeType}-macos/lib/libfreetype.a
+lipo -info ${aFreeType}-macos/lib/libfreetype.6.dylib
diff --git a/adm/scripts/liblzma/android_liblzma_build.sh b/adm/scripts/liblzma/android_liblzma_build.sh
new file mode 100644 (file)
index 0000000..60cd95a
--- /dev/null
@@ -0,0 +1,105 @@
+#!/bin/bash
+
+# This is helpful script to perform building of liblzma for Android platform
+# http://tukaani.org/xz/
+
+anNdkRoot=/home/develop/android/android-ndk-r12b
+anNdkArm32=/home/develop/android/android15-armv7a
+anNdkArm64=/home/develop/android/android21-aarch64
+anNdkx86=/home/develop/android/android15-x86
+anNdkx86_64=/home/develop/android/android21-x86_64
+#$anNdkRoot/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$anNdkArm32  --ndk-dir=$anNdkRoot --toolchain=arm-linux-androideabi-4.9
+#$anNdkRoot/build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=$anNdkArm64  --ndk-dir=$anNdkRoot --toolchain=aarch64-linux-android-4.9
+#$anNdkRoot/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$anNdkx86    --ndk-dir=$anNdkRoot --toolchain=x86-4.9
+#$anNdkRoot/build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=$anNdkx86_64 --ndk-dir=$anNdkRoot --toolchain=x86_64-4.9
+
+# go to the script directory
+aScriptPath=${BASH_SOURCE%/*}
+if [ -d "$aScriptPath" ]; then
+  cd "$aScriptPath"
+fi
+
+# define number of jobs from available CPU cores
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
+set -o pipefail
+
+aPathBak="$PATH"
+anXzRoot="$PWD"
+aCFlagsArmv7a="-O2 -march=armv7-a -mfloat-abi=softfp"
+aCFlagsArmv8a="-O2 -march=armv8-a"
+aCFlagsx86="-O2 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32"
+aCFlagsx86_64="-O2 -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel"
+
+OUTPUT_FOLDER="$anXzRoot/install/liblzma-android"
+rm -f -r "$OUTPUT_FOLDER"
+mkdir -p "$OUTPUT_FOLDER/include"
+mkdir -p "$OUTPUT_FOLDER/libs/armeabi-v7a"
+mkdir -p "$OUTPUT_FOLDER/libs/x86"
+mkdir -p "$OUTPUT_FOLDER/libs/arm64-v8a"
+mkdir -p "$OUTPUT_FOLDER/libs/x86_64"
+cp -f    "$anXzRoot/COPYING"                "$OUTPUT_FOLDER"
+cp -f    "$anXzRoot/README"                 "$OUTPUT_FOLDER"
+cp -f    "$anXzRoot/src/liblzma/api/lzma.h" "$OUTPUT_FOLDER/include"
+cp -f -r "$anXzRoot/src/liblzma/api/lzma"   "$OUTPUT_FOLDER/include"
+echo "Output directory: $OUTPUT_FOLDER"
+
+# armv7a
+export "PATH=$anNdkArm32/bin:$aPathBak"
+export "CC=arm-linux-androideabi-gcc"
+export "CXX=arm-linux-androideabi-g++"
+export "CFLAGS=$aCFlagsArmv7a"
+export "CXXFLAGS=$aCFlagsArmv7a"
+./configure --host arm-linux-androideabi 2>&1 | tee $OUTPUT_FOLDER/config-armv7a.log
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+make clean
+make -j$aNbJobs
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/armeabi-v7a"
+cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a"  "$OUTPUT_FOLDER/libs/armeabi-v7a"
+
+# x86
+export "PATH=$anNdkx86/bin:$aPathBak"
+export "CC=i686-linux-android-gcc"
+export "CXX=i686-linux-android-g++"
+export "CFLAGS=$aCFlagsx86"
+export "CXXFLAGS=$aCFlagsx86"
+./configure --host i686-linux-android 2>&1 | tee $OUTPUT_FOLDER/config-x86.log
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+make clean
+make -j$aNbJobs
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/x86"
+cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a"  "$OUTPUT_FOLDER/libs/x86"
+
+# armv8a
+export "PATH=$anNdkArm64/bin:$aPathBak"
+export "CC=aarch64-linux-android-gcc"
+export "CXX=aarch64-linux-android-g++"
+export "CFLAGS=$aCFlagsArmv8a"
+export "CXXFLAGS=$aCFlagsArmv8a"
+./configure --host aarch64-linux-android 2>&1 | tee $OUTPUT_FOLDER/config-aarch64.log
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+make clean
+make -j$aNbJobs
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/arm64-v8a"
+cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a"  "$OUTPUT_FOLDER/libs/arm64-v8a"
+
+# x86_64
+export "PATH=$anNdkx86_64/bin:$aPathBak"
+export "CC=x86_64-linux-android-gcc"
+export "CXX=x86_64-linux-android-g++"
+export "CFLAGS=$aCFlagsx86_64"
+export "CXXFLAGS=$aCFlagsx86_64"
+./configure --host x86_64-linux-android 2>&1 | tee $OUTPUT_FOLDER/config-x86_64.log
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+make clean
+make -j$aNbJobs
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/x86_64"
+cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a"  "$OUTPUT_FOLDER/libs/x86_64"
+
+export "PATH=$aPathBak"
+
+rm $OUTPUT_FOLDER/../liblzma-android.7z &>/dev/null
+7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../liblzma-android.7z $OUTPUT_FOLDER
diff --git a/adm/scripts/liblzma/macos_liblzma_build.sh b/adm/scripts/liblzma/macos_liblzma_build.sh
new file mode 100644 (file)
index 0000000..caee628
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+# This is helpful script to perform building of liblzma for macOS platform
+# http://tukaani.org/xz/
+
+# go to the script directory
+aScriptPath=${BASH_SOURCE%/*}
+if [ -d "$aScriptPath" ]; then
+  cd "$aScriptPath"
+fi
+
+# define number of jobs from available CPU cores
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
+set -o pipefail
+
+anXzRoot="$PWD"
+export MACOSX_DEPLOYMENT_TARGET=10.10
+
+OUTPUT_FOLDER="$anXzRoot/work/liblzma-macos"
+rm -f -r "$OUTPUT_FOLDER"
+mkdir -p "$OUTPUT_FOLDER/include"
+mkdir -p "$OUTPUT_FOLDER/lib"
+cp -f    "$anXzRoot/COPYING"                "$OUTPUT_FOLDER"
+cp -f    "$anXzRoot/README"                 "$OUTPUT_FOLDER"
+cp -f    "$anXzRoot/src/liblzma/api/lzma.h" "$OUTPUT_FOLDER/include"
+cp -f -r "$anXzRoot/src/liblzma/api/lzma"   "$OUTPUT_FOLDER/include"
+echo "Output directory: $OUTPUT_FOLDER"
+
+# x86_64
+./configure CFLAGS="-O2 -arch x86_64" CXXFLAGS="-O2 -arch x86_64" 2>&1 | tee $OUTPUT_FOLDER/config-x86_64.log
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+make clean
+make -j$aNbJobs
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+#cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/x86"
+cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a"  "$OUTPUT_FOLDER/lib/liblzma-x86_64.a"
+
+# armv8a
+./configure CFLAGS="-O2 -arch arm64" CXXFLAGS="-O2 -arch arm64" 2>&1 | tee $OUTPUT_FOLDER/config-arm64.log
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+make clean
+make -j$aNbJobs
+aResult=$?; if [[ $aResult != 0 ]]; then exit $aResult; fi
+#cp -f "$anXzRoot/src/liblzma/.libs/liblzma.so" "$OUTPUT_FOLDER/libs/arm64-v8a"
+cp -f "$anXzRoot/src/liblzma/.libs/liblzma.a"  "$OUTPUT_FOLDER/lib/liblzma-arm64.a"
+
+lipo -create -output "$OUTPUT_FOLDER/lib/liblzma.a" "$OUTPUT_FOLDER/lib/liblzma-x86_64.a" "$OUTPUT_FOLDER/lib/liblzma-arm64.a"
+lipo -info "$OUTPUT_FOLDER/lib/liblzma.a"
+
+#rm $OUTPUT_FOLDER/../liblzma-macos.7z &>/dev/null
+#7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../liblzma-macos.7z $OUTPUT_FOLDER
diff --git a/adm/scripts/tcl/android_tcl_build.sh b/adm/scripts/tcl/android_tcl_build.sh
new file mode 100644 (file)
index 0000000..567da6e
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+# This is helpful script to perform building of Tcl for Android platform
+# https://www.tcl.tk/software/tcltk/download.html
+
+#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/develop/android15-armv7a  --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=arm-linux-androideabi-4.9
+#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-21 --install-dir=$HOME/develop/android21-aarch64 --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=aarch64-linux-android-4.9
+#$HOME/develop/android-ndk-r12b/build/tools/make-standalone-toolchain.sh --platform=android-15 --install-dir=$HOME/develop/android15-x86     --ndk-dir=$HOME/develop/android-ndk-r12b --toolchain=x86-4.9
+ANDROID_ROOT="/home/develop/android"
+
+# go to the script directory
+aScriptPath=${BASH_SOURCE%/*}
+if [ -d "$aScriptPath" ]; then
+  cd "$aScriptPath"
+fi
+
+# define number of jobs from available CPU cores
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
+set -o pipefail
+
+aPathBak="$PATH"
+aTclRoot="$PWD"
+
+OUTPUT_FOLDER="$aTclRoot/install/tcl-android"
+rm -f -r "$OUTPUT_FOLDER"
+mkdir -p "$OUTPUT_FOLDER"
+cp -f    "$aTclRoot/license.terms" "$OUTPUT_FOLDER"
+cp -f    "$aTclRoot/README.md"     "$OUTPUT_FOLDER"
+echo "Output directory: $OUTPUT_FOLDER"
+
+set -o pipefail
+
+function buildArch {
+  anAbi=$1
+  anArch=$2
+  aToolPath=$3
+  aCFlags=$4
+  export "PATH=$ANDROID_ROOT/$aToolPath/bin:$aPathBak"
+  export "CC=$anArch-gcc"
+  export "AR=$anArch-ar"
+  export "RANLIB=$anArch-ranlib"
+  export "CFLAGS=$aCFlags"
+  pushd "$aTclRoot/unix"
+  ./configure --build x86_64-linux --host $anArch --prefix=${OUTPUT_FOLDER} --libdir=${OUTPUT_FOLDER}/libs/$anAbi --bindir=${OUTPUT_FOLDER}/bins/$anAbi 2>&1 | tee $OUTPUT_FOLDER/config-$anAbi.log
+  aResult=$?; if [[ $aResult != 0 ]]; then echo "FAILED configure $anAbi"; exit $aResult; fi
+  make clean
+  make -j$aNbJobs
+  aResult=$?; if [[ $aResult != 0 ]]; then echo "FAILED make $anAbi"; exit $aResult; fi
+  make install
+  popd
+  export "PATH=$aPathBak"
+}
+
+buildArch "arm64-v8a"   "aarch64-linux-android" "android21-aarch64" "-O2 -march=armv8-a"
+buildArch "armeabi-v7a" "arm-linux-androideabi" "android15-armv7a"  "-O2 -march=armv7-a -mfloat-abi=softfp"
+buildArch "x86"         "i686-linux-android"    "android15-x86"     "-O2 -march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32"
+buildArch "x86_64"      "x86_64-linux-android"  "android21-x86_64"  "-O2 -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel"
+
+rm $OUTPUT_FOLDER/../tcl-android.7z &>/dev/null
+7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../tcl-android.7z $OUTPUT_FOLDER
diff --git a/adm/scripts/tcl/wasm_tcl_build.sh b/adm/scripts/tcl/wasm_tcl_build.sh
new file mode 100644 (file)
index 0000000..9e8f555
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# This is helpful script to perform building of Tcl for WebAssembly platform
+# https://www.tcl.tk/software/tcltk/download.html
+
+EMSDK_ROOT="/home/develop/wasm/emsdk"
+
+# go to the script directory
+aScriptPath=${BASH_SOURCE%/*}
+if [ -d "$aScriptPath" ]; then
+  cd "$aScriptPath"
+fi
+
+# define number of jobs from available CPU cores
+aNbJobs="$(getconf _NPROCESSORS_ONLN)"
+set -o pipefail
+
+aPathBak="$PATH"
+aTclRoot="$PWD"
+
+OUTPUT_FOLDER="$aTclRoot/install/tcl-wasm32"
+rm -f -r "$OUTPUT_FOLDER"
+mkdir -p "$OUTPUT_FOLDER"
+cp -f    "$aTclRoot/license.terms" "$OUTPUT_FOLDER"
+cp -f    "$aTclRoot/README.md"     "$OUTPUT_FOLDER"
+echo "Output directory: $OUTPUT_FOLDER"
+
+. "${EMSDK_ROOT}/emsdk_env.sh"
+#export "PATH=$EMSDK_ROOT/upstream/bin:$aPathBak"
+#export "CC=emcc"
+#export "AR=llvm-ar"
+#export "RANLIB=llvm-ranlib"
+#export "CFLAGS=$aCFlags"
+pushd "$aTclRoot/unix"
+#./configure --build x86_64-linux --host wasm32 --prefix=${OUTPUT_FOLDER} 2>&1 | tee $OUTPUT_FOLDER/config-wasm32.log
+emconfigure ./configure --prefix=${OUTPUT_FOLDER} --enable-shared=no 2>&1 | tee $OUTPUT_FOLDER/config-wasm32.log
+aResult=$?; if [[ $aResult != 0 ]]; then echo "FAILED configure"; exit $aResult; fi
+emmake make clean
+emmake make -j$aNbJobs
+aResult=$?; if [[ $aResult != 0 ]]; then echo "FAILED make"; exit $aResult; fi
+emmake make install
+popd
+export "PATH=$aPathBak"
+
+rm $OUTPUT_FOLDER/../tcl-wasm32.7z &>/dev/null
+7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on $OUTPUT_FOLDER/../tcl-wasm32.7z $OUTPUT_FOLDER