Hi/2. KO Myung-Hun wrote: > Hi/2. > > These are patches for OS/2. > > Review, please... > > [PATCH 1/2] libtool: replace : with $PATH_SEPARATOR > [PATCH 2/2] libtool: Limit a length of DLL name to 8.3 correctly >
Here are the rebased patches. -- KO Myung-Hun Korean OS/2 User Community : https://www.os2.kr/
From c1725bdfd0b5774429b87e248d2afd459e6946fd Mon Sep 17 00:00:00 2001 From: KO Myung-Hun <komh@chollian.net> Date: Thu, 3 Nov 2022 23:32:37 +0900 Subject: [PATCH v2 1/2] libtool: replace : with $PATH_SEPARATOR Some OSes such as OS/2, uses ';' as a path separator. So using $PATH_SEPARATOR instead of hard-coded ':' is more proper. * Makefile.am (TESTS_ENVIRONMENT): Pass $PATH_SEPARATOR. * build-aux-ltmain.in: Replace : with $PATH_SEPARATOR. * m4/libtool.m4: Likewise. --- Makefile.am | 1 + build-aux/ltmain.in | 78 ++++++++++++++++++++++----------------------- m4/libtool.m4 | 16 +++++----- 3 files changed, 48 insertions(+), 47 deletions(-) diff --git a/Makefile.am b/Makefile.am index 39872b6d..89b9ca11 100644 --- a/Makefile.am +++ b/Makefile.am @@ -746,6 +746,7 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \ F77="$(F77)" FFLAGS="$(FFLAGS)" \ FC="$(FC)" FCFLAGS="$(FCFLAGS)" \ GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)" \ + PATH_SEPARATOR="$(PATH_SEPARATOR)" \ lt_cv_with_aix_soname="$(with_aix_soname)" \ lt_cv_to_host_file_cmd="$(to_host_file_cmd)" \ lt_cv_to_tool_file_cmd="$(to_tool_file_cmd)" diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in index 534f1763..aaf583d5 100644 --- a/build-aux/ltmain.in +++ b/build-aux/ltmain.in @@ -785,8 +785,8 @@ func_resolve_sysroot () # store the result into func_replace_sysroot_result. func_replace_sysroot () { - case $lt_sysroot:$1 in - ?*:"$lt_sysroot"*) + case $lt_sysroot$PATH_SEPARATOR$1 in + ?*$PATH_SEPARATOR$lt_sysroot*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; @@ -2133,7 +2133,7 @@ func_mode_execute () if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + eval "$shlibpath_var=\"\$dir\$PATH_SEPARATOR\$$shlibpath_var\"" fi done @@ -3726,7 +3726,7 @@ func_exec_program () if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH + PATH=\"$dllsearchpath$PATH_SEPARATOR\$PATH\" " fi @@ -3738,7 +3738,7 @@ func_exec_program () # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/$PATH_SEPARATOR$PATH_SEPARATOR*\$//'\` export $shlibpath_var " @@ -3949,7 +3949,7 @@ EOF fi if test -n "$dllsearchpath"; then - func_to_host_path "$dllsearchpath:" + func_to_host_path "$dllsearchpath$PATH_SEPARATOR" cat <<EOF const char * EXE_PATH_VARNAME = "PATH"; const char * EXE_PATH_VALUE = "$func_to_host_path_result"; @@ -5258,15 +5258,15 @@ func_mode_link () case $host in *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) func_append dllsearchpath ":$dir";; + case $PATH_SEPARATOR$dllsearchpath$PATH_SEPARATOR in + *$PATH_SEPARATOR$dir$PATH_SEPARATOR*) ;; + $PATH_SEPARATOR$PATH_SEPARATOR) dllsearchpath=$dir;; + *) func_append dllsearchpath "$PATH_SEPARATOR$dir";; esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; + case $PATH_SEPARATOR$dllsearchpath$PATH_SEPARATOR in + *$PATH_SEPARATOR$testbindir$PATH_SEPARATOR*) ;; + $PATH_SEPARATOR$PATH_SEPARATOR) dllsearchpath=$testbindir;; + *) func_append dllsearchpath "$PATH_SEPARATOR$testbindir";; esac ;; esac @@ -5771,7 +5771,7 @@ func_mode_link () if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` + eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/$PATH_SEPARATOR/ /g\'\` else shlib_search_path= fi @@ -6399,11 +6399,11 @@ func_mode_link () # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. - case $temp_rpath: in - *"$absdir:"*) ;; + case $temp_rpath$PATH_SEPARATOR in + *"$absdir$PATH_SEPARATOR"*) ;; *) case $absdir in - "$progdir/"*) func_append temp_rpath "$absdir:" ;; - *) func_append temp_rpath_tail "$absdir:" ;; + "$progdir/"*) func_append temp_rpath "$absdir$PATH_SEPARATOR" ;; + *) func_append temp_rpath_tail "$absdir$PATH_SEPARATOR" ;; esac esac fi @@ -6635,9 +6635,9 @@ func_mode_link () fi if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) func_append compile_shlibpath "$add_shlibpath:" ;; + case $PATH_SEPARATOR$compile_shlibpath$PATH_SEPARATOR in + *$PATH_SEPARATOR$add_shlibpath$PATH_SEPARATOR*) ;; + *) func_append compile_shlibpath "$add_shlibpath$PATH_SEPARATOR" ;; esac fi if test prog = "$linkmode"; then @@ -6649,9 +6649,9 @@ func_mode_link () if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; + case $PATH_SEPARATOR$finalize_shlibpath$PATH_SEPARATOR in + *$PATH_SEPARATOR$libdir$PATH_SEPARATOR*) ;; + *) func_append finalize_shlibpath "$libdir$PATH_SEPARATOR" ;; esac fi fi @@ -6669,9 +6669,9 @@ func_mode_link () add_dir=-L$lt_sysroot$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; + case $PATH_SEPARATOR$finalize_shlibpath$PATH_SEPARATOR in + *$PATH_SEPARATOR$libdir$PATH_SEPARATOR*) ;; + *) func_append finalize_shlibpath "$libdir$PATH_SEPARATOR" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then @@ -7800,7 +7800,7 @@ func_mode_link () # We should set the runpath_var. rpath= for dir in $perm_rpath; do - func_append rpath "$dir:" + func_append rpath "$dir$PATH_SEPARATOR" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi @@ -8522,15 +8522,15 @@ func_mode_link () case $host in *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) func_append dllsearchpath ":$libdir";; + case $PATH_SEPARATOR$dllsearchpath$PATH_SEPARATOR in + *$PATH_SEPARATOR$libdir$PATH_SEPARATOR*) ;; + $PATH_SEPARATOR$PATH_SEPARATOR) dllsearchpath=$libdir;; + *) func_append dllsearchpath "$PATH_SEPARATOR$libdir";; esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; + case $PATH_SEPARATOR$dllsearchpath$PATH_SEPARATOR in + *$PATH_SEPARATOR$testbindir$PATH_SEPARATOR*) ;; + $PATH_SEPARATOR$PATH_SEPARATOR) dllsearchpath=$testbindir;; + *) func_append dllsearchpath "$PATH_SEPARATOR$testbindir";; esac ;; esac @@ -8644,7 +8644,7 @@ func_mode_link () # We should set the runpath_var. rpath= for dir in $perm_rpath; do - func_append rpath "$dir:" + func_append rpath "$dir$PATH_SEPARATOR" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi @@ -8652,7 +8652,7 @@ func_mode_link () # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do - func_append rpath "$dir:" + func_append rpath "$dir$PATH_SEPARATOR" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi diff --git a/m4/libtool.m4 b/m4/libtool.m4 index c0d19e45..3149afec 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -2305,18 +2305,18 @@ func_munge_path_list () case x@S|@2 in x) ;; - *:) - eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + *$PATH_SEPARATOR) + eval @S|@1=\"`$ECHO @S|@2 | $SED s/$PATH_SEPARATOR/\ /g` \@S|@@S|@1\" ;; - x:*) - eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + x$PATH_SEPARATOR*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED s/$PATH_SEPARATOR/\ /g`\" ;; - *::*) - eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + *$PATH_SEPARATOR$PATH_SEPARATOR*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e s/.*$PATH_SEPARATOR$PATH_SEPARATOR// -e s/$PATH_SEPARATOR/\ /g`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e s/$PATH_SEPARATOR$PATH_SEPARATOR.*// -e s/$PATH_SEPARATOR/\ /g`\ \@S|@@S|@1\" ;; *) - eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED s/$PATH_SEPARATOR/\ /g`\" ;; esac } -- 2.42.0
From 314d66096717755f92cf1dc40c4f4797cd212c13 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun <komh@chollian.net> Date: Thu, 12 Oct 2023 15:11:18 +0900 Subject: [PATCH v2 2/2] libtool: Limit a length of DLL name to 8.3 correctly If a length of $release and/or $versionsuffix is more than 8 bytes, a length of DLL name may be more than 8. Then, this corrupts a generated DLL on OS/2. * m4/libtool.m4 (soname_spec) [os2*]: Limit a length of DLL name to 8.3 correctly. --- m4/libtool.m4 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 3149afec..18c5fbcd 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -3050,9 +3050,14 @@ os2*) need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; - v=$($ECHO $release$versuffix | tr -d .-); - n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); - $ECHO $n$v`$shared_ext' + n=$($ECHO $libname | tr -d .-); + l=${#n}; test 3 -lt "$l" && l=3; mr=$((8 - $l)); + r=$($ECHO $release | tr -d .-); + l=${#r}; test 2 -lt "$l" && l=2; mv=$(($mr - $l)); + v=$($ECHO $versuffix | tr -d .- | cut -b -$mv); + r=$($ECHO $r | cut -b -$(($mr - ${#v}))); + n=$($ECHO $n | cut -b -$((8 - ${#r} - ${#v}))); + $ECHO $n$r$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH -- 2.42.0