X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=hints%2Fos2.sh;h=0e9f786d25ac0adf4de998394a689cf46b155b5e;hb=297b36dcf845fc5195afb0a1d7e83d539bb1d4ed;hp=f8df9d25eb3baeaa84bfe198c971606f4c4af1d2;hpb=487a7f015b136c35583eb093393e72e2e288f682;p=p5sagit%2Fp5-mst-13.2.git diff --git a/hints/os2.sh b/hints/os2.sh index f8df9d2..0e9f786 100644 --- a/hints/os2.sh +++ b/hints/os2.sh @@ -6,28 +6,97 @@ # Trimmed and comments added by # Andy Dougherty # Exactly what is required beyond a standard OS/2 installation? -# There are notes about "patched pdksh" I do not understand. +# (see in README.os2) # Note that symbol extraction code gives wrong answers (sometimes?) on # gethostent and setsid. -# Note that during the .obj compile you need to move the perl.dll file -# to LIBPATH :-( +# Optimization (GNU make 3.74 cannot be loaded :-(): +emxload -m 30 sh.exe ls.exe tr.exe id.exe sed.exe # make.exe +emxload -m 30 grep.exe egrep.exe fgrep.exe cat.exe rm.exe mv.exe cp.exe +emxload -m 30 uniq.exe basename.exe sort.exe awk.exe echo.exe path_sep=\; if test -f $sh.exe; then sh=$sh.exe; fi startsh="#!$sh" - -sysman=`../UU/loc . /man/man1 c:/man/man1 c:/usr/man/man1 d:/man/man1 d:/usr/man/man1 e:/man/man1 e:/usr/man/man1 f:/man/man1 f:/usr/man/man1 g:/man/man1 g:/usr/man/man1 /usr/man/man1` cc='gcc' -usrinc='/emx/include' -libemx="`../UU/loc . X c:/emx/lib d:/emx/lib e:/emx/lib f:/emx/lib g:/emx/lib h:/emx/lib /emx/lib`" -if test "$libemx" = "X"; then echo "Cannot find C library!"; fi +# Make denser object files and DLL +case "X$optimize" in + X) + optimize="-O2 -fomit-frame-pointer -malign-loops=2 -malign-jumps=2 -malign-functions=2 -s" + ld_dll_optimize="-s" + ;; +esac + +# Get some standard things (indented to avoid putting in config.sh): + oifs="$IFS" + IFS=" ;" + set $MANPATH + tryman="$@" + set $LIBRARY_PATH + libemx="$@" + set $C_INCLUDE_PATH + usrinc="$@" + IFS="$oifs" + tryman="`./UU/loc . /man $tryman`" + tryman="`echo $tryman | tr '\\\' '/'`" + + # indented to avoid having it *two* times at start + libemx="`./UU/loc os2.a /emx/lib $libemx`" + +usrinc="`./UU/loc stdlib.h /emx/include $usrinc`" +usrinc="`dirname $usrinc | tr '\\\' '/'`" +libemx="`dirname $libemx | tr '\\\' '/'`" + +if test -d $tryman/man1; then + sysman="$tryman/man1" +else + sysman="`./UU/loc . /man/man1 c:/man/man1 c:/usr/man/man1 d:/man/man1 d:/usr/man/man1 e:/man/man1 e:/usr/man/man1 f:/man/man1 f:/usr/man/man1 g:/man/man1 g:/usr/man/man1 /usr/man/man1`" +fi + +emxpath="`dirname $libemx`" +if test ! -d "$emxpath"; then + emxpath="`./UU/loc . /emx c:/emx d:/emx e:/emx f:/emx g:/emx h:/emx /emx`" +fi + +if test ! -d "$libemx"; then + libemx="$emxpath/lib" +fi +if test ! -d "$libemx"; then + if test -d "$LIBRARY_PATH"; then + libemx="$LIBRARY_PATH" + else + libemx="`./UU/loc . X c:/emx/lib d:/emx/lib e:/emx/lib f:/emx/lib g:/emx/lib h:/emx/lib /emx/lib`" + fi +fi + +if test ! -d "$usrinc"; then + if test -d "$emxpath/include"; then + usrinc="$emxpath/include" + else + if test -d "$C_INCLUDE_PATH"; then + usrinc="$C_INCLUDE_PATH" + else + usrinc="`./UU/loc . X c:/emx/include d:/emx/include e:/emx/include f:/emx/include g:/emx/include h:/emx/include /emx/include`" + fi + fi +fi + +rsx="`./UU/loc rsx.exe undef $pth`" + +if test "$libemx" = "X"; then echo "Cannot find C library!" >&2; fi + +# Acute backslashitis: +libpth="`echo \"$LIBRARY_PATH\" | tr ';\\\' ' /'`" +libpth="$libpth $libemx/mt $libemx" -libpth="$libemx/st $libemx" +set `cmd /c emxrev -f emxlibcm` +emxcrtrev=$5 +# indented to not put it into config.sh + _defemxcrtrev=-D_EMX_CRT_REV_=$emxcrtrev so='dll' @@ -45,11 +114,20 @@ aout_obj_ext='.o' aout_lib_ext='.a' aout_ar='ar' aout_plibext='.a' +aout_lddlflags="-Zdll $ld_dll_optimize" +# Cannot have 32000K stack: get SYS0170 ?! +if [ $emxcrtrev -ge 50 ]; then + aout_ldflags='-Zexe -Zsmall-conv -Zstack 16000' +else + aout_ldflags='-Zexe -Zstack 16000' +fi + +# To get into config.sh: +aout_ldflags="$aout_ldflags" + aout_d_fork='define' -aout_lddlflags='-Zdll' -aout_ldflags='-Zexe' -aout_ccflags='-DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS' -aout_cppflags='-DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. -DPACK_MALLOC =DDEBUGGING_MSTATS' +aout_ccflags="-DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. $_defemxcrtrev" +aout_cppflags="-DDOSISH -DPERL_IS_AOUT -DOS2=2 -DEMBED -I. $_defemxcrtrev" aout_use_clib='c' aout_usedl='undef' aout_archobjs="os2.o dl_os2.o" @@ -64,7 +142,9 @@ if [ "$emxaout" != "" ]; then lib_ext="$aout_lib_ext" ar="$aout_ar" plibext="$aout_plibext" - d_fork="$aout_d_fork" + if [ $emxcrtrev -lt 50 ]; then + d_fork="$aout_d_fork" + fi lddlflags="$aout_lddlflags" ldflags="$aout_ldflags" ccflags="$aout_ccflags" @@ -78,15 +158,26 @@ else lib_ext='.lib' ar='emxomfar' plibext='.lib' - d_fork='undef' - lddlflags='-Zdll -Zomf -Zmt -Zcrtdll' + if [ $emxcrtrev -ge 50 ]; then + d_fork='define' + else + d_fork='undef' + fi + lddlflags="-Zdll -Zomf -Zmt -Zcrtdll $ld_dll_optimize" # Recursive regmatch may eat 2.5M of stack alone. ldflags='-Zexe -Zomf -Zmt -Zcrtdll -Zstack 32000' - ccflags='-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -DPACK_MALLOC -DDEBUGGING_MSTATS' + if [ $emxcrtrev -ge 50 ]; then + ccflags="-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. $_defemxcrtrev" + else + ccflags="-Zomf -Zmt -DDOSISH -DOS2=2 -DEMBED -I. -DEMX_BAD_SBRK $_defemxcrtrev" + fi use_clib='c_import' usedl='define' fi +# indented to miss config.sh + _ar="$ar" + # To get into config.sh (should start at the beginning of line) # or you can put it into config.over. plibext="$plibext" @@ -94,7 +185,7 @@ plibext="$plibext" libperl="libperl${plibext}" #libc="/emx/lib/st/c_import$lib_ext" -libc="$libemx/st/$use_clib$lib_ext" +libc="$libemx/mt/$use_clib$lib_ext" if test -r "$libemx/c_alias$lib_ext"; then libnames="$libemx/c_alias$lib_ext" @@ -103,7 +194,9 @@ fi # [Maybe we should just remove c from $libswanted ?] -libs='-lsocket -lm' +# Test would pick up wrong rand, so we hardwire the value for random() +libs='-lsocket -lm -lbsd' +randbits=31 archobjs="os2$obj_ext dl_os2$obj_ext" # Run files without extension with sh: @@ -159,18 +252,82 @@ nm_opt='-p' d_getprior='define' d_setprior='define' -####### All the rest is commented - -# The next two are commented. pdksh handles #! +# The next two are commented. pdksh handles #!, extproc gives no path part. # sharpbang='extproc ' # shsharp='false' # Commented: #startsh='extproc ksh\\n#! sh' +# Find patch: +gnupatch='patch' +if (gnupatch -v || gnupatch --version) 2>&1 >/dev/null; then + gnupatch=gnupatch +else + if (gpatch -v || gpatch --version) 2>&1 >/dev/null; then + gnupatch=gpatch + else + # They may have a special PATH during configuring + if (patch -v || patch --version) 2>&1 >/dev/null; then + gnupatch="`./UU/loc patch.exe undef $pth`" + fi + fi +fi + +# Apply patches if needed +case "$0$running_c_cmd" in + *[/\\]Configure|*[/\\]Configure.|Configure|Configure.) # Skip Configure.cmd + if grep "^libnames" ./Configure > /dev/null; then + # Not patched! + if test -f ./Configure.cmd ; then + echo "!!!" >&2 + echo "!!! ./Configure not patched, but ./Configure.cmd exits" >&2 + echo "!!! Do not know what to do!" >&2 + echo "!!!" >&2 + exit 2 + fi + echo "!!!" >&2 + echo "!!! You did not patch ./Configure!" >&2 + echo "!!! I create Configure.cmd and patch it from ./os2/diff.configure." >&2 + echo "!!!" >&2 + echo "$gnupatch -b -p1 --output=Configure.cmd <./os2/diff.configure 2>&1 | tee 00_auto_patch" >&2 + ($gnupatch -b -p1 --output=Configure.cmd <./os2/diff.configure 2>&1 | tee 00_auto_patch) >&2 + echo "!!!" >&2 + echo "!!! The report of patching is copied to 00_auto_patch." >&2 + echo "!!! Now you need to restart Configure.cmd with all the options" >&2 + echo "!!!" >&2 + echo "extproc sh" > Configure.ctm + cat Configure.cmd >> Configure.ctm && mv -f Configure.ctm Configure.cmd + exit 0 + else + echo "!!! Apparently we are running a patched Configure." >&2 + fi + ;; + *) echo "!!! Apparently we are running a renamed Configure: '$0'." >&2 +esac + +# Copy pod: + +cp -uf ./README.os2 ./pod/perlos2.pod + +# This script UU/usethreads.cbu will get 'called-back' by Configure +# after it has prompted the user for whether to use threads. +cat > UU/usethreads.cbu <<'EOCBU' +case "$usethreads" in +$define|true|[yY]*) + ccflags="-Zmt $ccflags" + cppflags="-Zmt $cppflags" # Do we really need to set this? + aout_ccflags="-DUSE_THREADS $aout_ccflags" + aout_cppflags="-DUSE_THREADS $aout_cppflags" + aout_lddlflags="-Zmt $aout_lddlflags" + aout_ldflags="-Zmt $aout_ldflags" + ;; +esac +EOCBU + # Now install the external modules. We are in the ./hints directory. -cd ../os2/OS2 +cd ./os2/OS2 if ! test -d ../../ext/OS2 ; then mkdir ../../ext/OS2 @@ -196,6 +353,9 @@ for xxx in * ; do fi done +case "$ldlibpthname" in +'') ldlibpthname=none ;; +esac # Now go back -cd ../../hints +cd ../..