# Copyright: 2017-2023 Paul Obermeier (obermeier@tcl3d.org) # Distributed under BSD license. # # BuildType Windows: nmake / vs # MSys / gcc # BuildType Linux : MSys / gcc # BuildType Darwin : MSys / gcc # Changes to source code (see ReplaceLine and ReplaceKeywords below): # unix/configure: Change order of library search pathes, because of missing break. # Otherwise always the system Tcl library is found. # Makefile : Add "-DBUILD_mpexpr" when compiling with gcc on Windows. # pkgIndex.tcl : Manual changes in win and unix directories. # Change path to shared library, so that it can be located in the same directory # as the pkgIndex.tcl file. # Use list operator, so package can be installed in directory with spaces. proc Init_Mpexpr { libName libVersion } { SetScriptAuthor $libName "Paul Obermeier" "obermeier@tcl3d.org" SetLibHomepage $libName "https://sourceforge.net/projects/mpexpr/" SetLibDependencies $libName "Tcl" SetPlatforms $libName "All" SetWinCompilers $libName "gcc" "vs" } proc Build_Mpexpr { libName libVersion buildDir instDir devDir distDir } { set mpexprDir "$instDir/${libName}$libVersion" file mkdir $mpexprDir set buildDirMSys [MSysPath $buildDir] set instDirMSys [MSysPath $instDir] if { [UseStage "Extract" $libName] } { ExtractLibrary $libName $buildDir ReplaceLine "$buildDir/unix/configure" \ "for f in \$with_tclpath \$exec_prefix_locations" \ "for f in \$exec_prefix_locations \$with_tclpath" } if { [UseStage "Configure" $libName] } { if { [UseWinCompiler $libName "gcc"] || [IsUnix] } { set cmd "" append cmd "$buildDirMSys/unix/configure " append cmd "--prefix=$instDirMSys --exec-prefix=$instDirMSys " append cmd "--with-tcl=[GetOutputInstDir]/Tcl " append cmd "--enable-symbols " MSysRun $libName "${libName}_Configure" $buildDir "$cmd" } } if { [UseStage "Compile" $libName] } { if { [UseWinCompiler $libName "vs"] } { set tclDir [file join $devDir [GetTclDir]] set tclLibFile [file join $tclDir "lib" [GetTclLibName [GetTclVersion]].lib] if { ! [file isdirectory $tclDir] } { SetErrorMessage "Tcl directory $tclDir does not exists" return false } if { ! [file exists $tclLibFile] } { SetErrorMessage "Tcl import library $tclLibFile does not exists" return false } if { [IsDebugBuild] } { set cflags "-Od" } else { set cflags "-O2" } NMakeBuild $libName "$buildDir/win" "makefile.vc" "all" \ "TCL=$tclDir" "TCLLIB=$tclLibFile" "cdebug=$cflags" SingleFileCopy "$buildDir/win/pkgIndex.tcl" $mpexprDir } else { if { [IsWindows] } { ReplaceKeywords "$buildDir/Makefile" [list "\$(TCL_DEFS)" "\$(TCL_DEFS) -DBUILD_mpexpr"] if { [IsDebugBuild] } { set tclLib "tcl[GetMajorMinor [GetTclVersion]]" ReplaceKeywords "$buildDir/Makefile" [list "-l${tclLib}" "-l${tclLib}g"] ReplaceKeywords "$buildDir/Makefile" [list "-O" "-g"] } } MSysBuild $libName $buildDir "all" SingleFileCopy "$buildDir/pkgIndex.tcl" $mpexprDir } MultiFileCopy "$buildDir" $mpexprDir "*[GetLibSuffix]" } if { [UseStage "Distribute" $libName] } { StripLibraries "$instDir" MultiFileCopy "$instDir" "$devDir/[GetTclLibDir]" "*" true MultiFileCopy "$instDir" "$distDir/[GetTclLibDir]" "*" true if { ! [UseTclPkgVersion] } { FileRename "$devDir/[GetTclLibDir]/$libName$libVersion" "$devDir/[GetTclLibDir]/$libName" FileRename "$distDir/[GetTclLibDir]/$libName$libVersion" "$distDir/[GetTclLibDir]/$libName" } } return true }