[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/10] libtool: fix DLL creation/installation/uninstallation on O
From: |
KO Myung-Hun |
Subject: |
[PATCH 07/10] libtool: fix DLL creation/installation/uninstallation on OS/2 |
Date: |
Sun, 12 Oct 2014 17:33:52 +0900 |
OS/2 limits a length of a DLL base name up to 8 characters. If a name of
a shared library is longer than 8 characters, OS/2 cannot load it. And
fix install/uninstall process using link which is not supported OS/2.
* build-aux/ltmain.in: Do not strip an import lib.
* m4/libtool.m4: Set variables to fix DLL creation, installation
and uninstallation.
---
build-aux/ltmain.in | 7 +++++++
m4/libtool.m4 | 48 ++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 5829cf2..86b42dd 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -2400,6 +2400,13 @@ func_mode_install ()
;;
esac
;;
+ os2*)
+ case $realname in
+ *_dll.a)
+ tstripme=
+ ;;
+ esac
+ ;;
esac
if test -n "$tstripme" && test -n "$striplib"; then
func_show_eval "$striplib $destdir/$realname" 'exit $?'
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 0713c29..e360efd 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -2810,9 +2810,27 @@ os2*)
libname_spec='$name'
shrext_cmds=.dll
need_lib_prefix=no
- library_names_spec='$libname$shared_ext $libname.a'
+ # OS/2 limits a length of a DLL basename up to 8 characters.
+ # So there is need to use a short name instead of a original name
+ # longer than 8 characters. And replace '.' with '_'.
+ soname_spec='`eval $ECHO $libname | cut -b -8 | tr . _`${shared_ext}'
+ library_names_spec='${libname}_dll.$libext'
dynamic_linker='OS/2 ld.exe'
- shlibpath_var=LIBPATH
+ shlibpath_var=BEGINLIBPATH
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ postinstall_cmds='base_file=`basename \$file`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO
\$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
;;
osf3* | osf4* | osf5*)
@@ -4960,6 +4978,16 @@ _LT_EOF
_LT_TAGVAR(link_all_deplibs, $1)=yes
;;
+ os2*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ shrext_cmds=".dll"
+ _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext}
INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION
\"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >>
$output_objdir/$libname.def~$ECHO " MULTIPLE NONSHARED" >>
$output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp
$libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~$CC -Zdll
-Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags
$output_objdir/$libname.def~emximp -o $lib $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o
$output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+
interix[[3-9]]*)
_LT_TAGVAR(hardcode_direct, $1)=no
_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -5578,8 +5606,10 @@ _LT_EOF
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
_LT_TAGVAR(hardcode_minus_L, $1)=yes
_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" >
$output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >>
$output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo "
SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >>
$output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC
-Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags
$output_objdir/$libname.def'
- _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o
$output_objdir/$libname.a $output_objdir/$libname.def'
+ shrext_cmds=".dll"
+ _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext}
INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION
\"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >>
$output_objdir/$libname.def~$ECHO " MULTIPLE NONSHARED" >>
$output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp
$libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~$CC -Zdll
-Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags
$output_objdir/$libname.def~emximp -o $lib $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o
$output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
;;
osf3*)
@@ -6372,6 +6402,16 @@ if test yes != "$_lt_caught_CXX_error"; then
_LT_DARWIN_LINKER_FEATURES($1)
;;
+ os2*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ shrext_cmds=".dll"
+ _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext}
INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION
\"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >>
$output_objdir/$libname.def~$ECHO " MULTIPLE NONSHARED" >>
$output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp
$libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~$CC -Zdll
-Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags
$output_objdir/$libname.def~emximp -o $lib $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o
$output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+
dgux*)
case $cc_basename in
ec++*)
--
1.7.3.2
- [PATCH] OS/2 patches, retry, KO Myung-Hun, 2014/10/12
- [PATCH 01/10] libtool: don't eliminate duplications in $postdeps and $predeps on OS/2, KO Myung-Hun, 2014/10/12
- [PATCH 03/10] ltdl: OS/2 uses other APIs to load a DLL than LoadLibrary() on Windows, KO Myung-Hun, 2014/10/12
- [PATCH 04/10] libtool: there is no need to relink DLLs on OS/2, KO Myung-Hun, 2014/10/12
- [PATCH 02/10] libtool: set lt_prog_compiler_static to -Bstatic on OS/2, KO Myung-Hun, 2014/10/12
- [PATCH 06/10] libtool: support -Zxxx options used on OS/2, KO Myung-Hun, 2014/10/12
- [PATCH 05/10] libtool: set lt_cv_deplibs_check_method to pass_all on OS/2, KO Myung-Hun, 2014/10/12
- [PATCH 07/10] libtool: fix DLL creation/installation/uninstallation on OS/2,
KO Myung-Hun <=
- [PATCH 08/10] libtool: add -os2dllname option, KO Myung-Hun, 2014/10/12
- [PATCH 10/10] libtool: support versioning on OS/2, KO Myung-Hun, 2014/10/12
- [PATCH 09/10] libtool: support -export-symbols and -export-symbols-regex on OS/2, KO Myung-Hun, 2014/10/12