Changeset 32209

Show
Ignore:
Timestamp:
25.06.2018 17:15:40 (3 months ago)
Author:
ak19
Message:

Commented out the BITNESS env var for Windows introduced in the previous commit and not using it in gsConvert.pl since Win can use XPdf's bin32 version of pdftohtml on 64 bit machines too. The lines determining and setting the BITNESS env var in gs2build\setup.bat are only commented out since setting BITNESS on Win may be useful in the future and we don't want to reinvent the wheel

Location:
main/trunk/greenstone2
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/gsConvert.pl

    r32207 r32209  
    847847    # build up the path to the doc-to-html conversion tool we're going to use 
    848848    my $xpdf_pdftohtml = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "xpdf-tools"); 
    849  
    850     if ($ENV{'GSDLOS'} =~ m/^darwin$/i) { 
    851     # TODO 
     849     
     850    if($ENV{'GSDLOS'} =~ m/^windows$/i) { # For Windows, just use the 32 bit xpdf's pdftohtml as it works the same as the 64 bit 
     851        $xpdf_pdftohtml = &FileUtils::filenameConcatenate($xpdf_pdftohtml, "bin32"); 
     852    } elsif ($ENV{'GSDLOS'} =~ m/^darwin$/i) { 
     853        # TODO 
    852854    } else { # unix or windows, use the appropriate bin folder for the bitness of the system 
    853855        # In fact, when testing 3 different PDF docs, it doesn't seem to make a difference on 
     
    855857        # However, maybe we'll use another xpdf-tool too in future where bitness will be relevant. 
    856858     
    857     # Don't use $ENV{'GSDLARCH'}, use the new $ENV{'BITNESS'}, since 
    858     # $ENV{'GSDLARCH'} is only (meant to be) set when many other 32-bit or 64-bit 
    859     # specific subdirectories exist in a greenstone installation. 
    860     # None of those locations need exist when xpdf-tools is installed with GS. 
    861     # So don't depend on GSDLARCH as forcing that to be exported has side-effects 
    862     if($ENV{'BITNESS'}) { 
    863         $xpdf_pdftohtml = &FileUtils::filenameConcatenate($xpdf_pdftohtml, "bin".$ENV{'BITNESS'}); 
    864     } else { # what if $ENV{'BITNESS'} undefined, fallback on bin32? or 64? 
    865         $xpdf_pdftohtml = &FileUtils::filenameConcatenate($xpdf_pdftohtml, "bin32"); 
    866     } 
    867     } 
    868  
    869     #print STDERR "@@@@ BITNESS: " . $ENV{'BITNESS'} . "\n"; 
     859        # Don't use $ENV{'GSDLARCH'}, use the new $ENV{'BITNESS'}, since 
     860        # $ENV{'GSDLARCH'} is only (meant to be) set when many other 32-bit or 64-bit 
     861        # specific subdirectories exist in a greenstone installation. 
     862        # None of those locations need exist when xpdf-tools is installed with GS. 
     863        # So don't depend on GSDLARCH as forcing that to be exported has side-effects 
     864        if($ENV{'BITNESS'}) { 
     865            $xpdf_pdftohtml = &FileUtils::filenameConcatenate($xpdf_pdftohtml, "bin".$ENV{'BITNESS'}); 
     866        } else { # what if $ENV{'BITNESS'} undefined, fallback on bin32? or 64? 
     867            $xpdf_pdftohtml = &FileUtils::filenameConcatenate($xpdf_pdftohtml, "bin32"); 
     868        } 
     869    } 
    870870     
    871871    # We'll create the file by name $output_filestem during post-conversion processing. 
  • main/trunk/greenstone2/setup.bat

    r32207 r32209  
    246246:done 
    247247 
    248 :: Want to know bitness of machine for working out whether to use xpdftools' bin32 or 
    249 ::   bin64 directory to run Xpdf's pdftohtml. 
    250 :: Googled: determine bit architecture windows command line 
    251 ::   techgenix.com/aquicktiptocheckoperatingsystemarchitecture/ 
    252 ::   'Type "SET Processor" (without double quotes) 
    253 ::   You will see the output SIMILAR to below [among OTHER lines of output]: 
    254 ::   PROCESSOR_ARCHITECTURE=x86 
    255 ::   OR 
    256 ::   PROCESSOR_ARCHITECTURE=x64.' 
    257 ::   (In my case PROCESSOR_ARCHITECTURE=AMD64) 
     248:: COMMENTING OUT THE 2 LINES DETERMINING AND SETTING THE BITNESS (32/64) ON WIN MACHINES 
     249:: AS IT MAY BE USEFUL IN FUTURE AND IT TOOK ME SOME TIME TO GET THESE LINES WORKING RIGHT 
     250:: To know bitness (32 vs 64) of a Windows machine, the cmd is "SET Processor" 
     251::   and look through the lines of output for the line PROCESSOR_ARCHITECTURE=x86 
     252::   or PROCESSOR_ARCHITECTURE=x64. See techgenix.com/aquicktiptocheckoperatingsystemarchitecture/ 
    258253:: The following runs the cmd "set Processor". Then, among the multiline output, it finds the line 
    259254::   containing "PROCESSOR_ARCHITECTURE", splits this line on the delimiter "=" and stores the 2nd token in %%G 
    260255::   Based on the example "_ping_cmd" at https://ss64.com/nt/for_cmd.html 
    261 for /f "tokens=2 delims==" %%G in ('set Processor ^|find "PROCESSOR_ARCHITECTURE"') do set BITNESS=%%G 
    262 rem echo Processor architecture is %BITNESS% 
    263 ::   which will be something like "amd64" or "x64", or "x86" for 32 bit 
     256REM for /f "tokens=2 delims==" %%G in ('set Processor ^|find "PROCESSOR_ARCHITECTURE"') do set BITNESS=%%G 
     257::   BITNESS will now be "x86" for 32 bit or something like "amd64" or "x64" for 64 bit 
    264258:: From https://ss64.com/nt/syntax-substring.html 
    265259::   "To do a string comparison, remove the SearchString and compare the result with the original 
    266260::   variable before removal. If both strings are the same, then SearchString was not found:" 
    267 rem set example=amd64 
    268 rem IF /i "%example:64=%" == "%example%" (echo Not 64 bit) ELSE (echo 64 bit) 
    269 if /i "%BITNESS:64=%" == "%BITNESS%" (set BITNESS=32) else (set BITNESS=64) 
    270 echo Bitness of machine: %BITNESS% 
    271  
     261REM if /i "%BITNESS:64=%" == "%BITNESS%" (set BITNESS=32) else (set BITNESS=64) 
    272262 
    273263popd 
    274 endlocal & set PATH=%PATH%& set GSDLHOME=%GSDLHOME%& set GSDLOS=%GSDLOS%& set JRE_HOME=%JRE_HOME%& set JAVA_HOME=%JAVA_HOME%& set BITNESS=%BITNESS% 
     264endlocal & set PATH=%PATH%& set GSDLHOME=%GSDLHOME%& set GSDLOS=%GSDLOS%& set JRE_HOME=%JRE_HOME%& set JAVA_HOME=%JAVA_HOME% 
     265REM      & set BITNESS=%BITNESS% 
    275266 
    276267if not "%JAVA_HOME%" == "" echo JAVA_HOME: %JAVA_HOME%