[FFmpeg-devel] [PATCH] Re-add OS/2 support

Diego Biurrun diego
Mon Sep 17 10:55:47 CEST 2007


On Sat, Sep 15, 2007 at 09:38:39PM -0700, Dave Yeo wrote:
> Diego Biurrun wrote:
>> On Mon, Sep 10, 2007 at 10:03:40PM -0700, Dave Yeo wrote:
>>> --- ffmpeg/configure	Sun Sep  9 00:01:48 2007
>>> +++ ffmpeg.os2/configure	Mon Sep 10 21:47:56 2007
>>> @@ -1196,6 +1199,27 @@
>>> +  os/2)
>>> +    SLIB_EXTRA_CMD="dllar -o \$(NAME)\$(SLIBSUF) \$(NAME)\$(LIBSUF) -d \"\$(SLIBNAME_WITH_MAJOR)\" -omf -ord \$(LDFLAGS) \$(EXTRALIBS) \$(EXTRAOBJS); cp -f \$(SLIBNAME) \$(SLIBNAME_WITH_MAJOR)"
>>> +    SLIB_INSTALL_EXTRA_CMD="-install -m 644 \$(SLIBNAME:\$(SLIBSUF)=.lib) \$(SLIBNAME:\$(SLIBSUF)=.a) \$(LIBDIR)"
>> These two can be simplified by using single quotes.
>
> You mean like in the attached patch?

Yes.

>>> +    SLIB_INSTALL_EXTRA_CMD="-install -m 644 
>>> \$(SLIBNAME:\$(SLIBSUF)=.lib) \$(SLIBNAME:\$(SLIBSUF)=.a) \$(LIBDIR)"
>> This looks wrong.  First you set SLIBSUF to .dll then you change it
>> here?  What's going on?  Also, there should be no libs with the names
>> you are trying to install, since they are created under different names
>> according to what you have set LIBSUF and SLIBSUF to ...
> GCC on OS/2 supports both a.out binaries, objects and libs. Libs use .a 
> suffix, uses ld for linking, needs to be bound to execute. Plus OMF 
> objects, binaries, and libs. Libs use .lib suffix, and uses native linker 
> for linking. Can also use IBM debuggers and other tools.

You are contradicting yourself here by saying two different things about
libs ...

> To link to DLLs we create an import lib from the DLL (or DEF) and link to 
> that so ideally we want to end up with static foo_s.a and foo_s.lib (we 
> only get the .lib now), foo.dll and foo.a and foo.lib which the respective 
> linkers actually link against. Most of this is taken care of here by 
> dllar.cmd. Here is the log of that part of the build for libavcodec
> ...
> dllar -o avcodec.dll avcodec_s.lib -d avcodec-51.dll -omf -ord -Zomf 
> -Zbin-files -Zargs-wild  -L"/usr/src/ffmpeg"/libavutil -lavutil -lz    ; cp 
> -f avcodec.dll avcodec-51.dll
> emxexp -u avcodec_s.lib >>$_avcodec.def
> cat $_avcodec.def | sort.exe | uniq.exe | rxqueue.exe S38Q0396702192
> gcc.exe -Zcrtdll -Zomf -Zdll -o avcodec.dll avcodec.def avcodec_s.lib -Zomf 
> -Zbin-files -Zargs-wild -L/usr/src/ffmpeg/libavutil -lavutil -lz
> emximp -o avcodec.a avcodec.def
> emximp -o avcodec.lib avcodec.def
> lxlite -cs -t: -mrn -ml1 -ynd avcodec.dll
> ?[ lxLite 
> ]??????????????????????????????????[ 
> Version 1.3.3 ]?
> ? Copyright 1996,97 by FRIENDS software     ?    All rights   ?
> ? Copyright 2001,03 by Max Alekseyev        ?     reserved    ?
> ? Processing file avcodec.dll ? The file avcodec.dll contains 6817729 
> bytes of debug information
> ? Processing file avcodec.dll ? Backing up  avcodec.dll ... ? Saving 
> file avcodec.dll ... ?                 avcodec.dll initial:10690782 
> final: 2242948 gain: 79.1%
> ??Total gain: 8447834 bytes
> ??Done
> ...
> These could also be named libfoo_s.a, libfoo.dll.a etc. Older GCC did not 
> understand these so I stayed with the older naming partially out of habit 
> and partially to keep some backwards compatibility.

I say forget backwards compatibility and go for the clean solution.

> Note also that we (and also Windows?) need an extra uninstall command as 
> well in a future patch.

Patches welcome.

> After ./configure --enable-shared --enable-os2threads && make && make 
> install with attached patch.
>
> I:\usr\local\lib>dir *avcodec*
>
> The volume label in drive I is klibc.
> The Volume Serial Number is 987A:45C4.
> Directory of I:\usr\local\lib
>
>  9-15-07   8:38p   2242948         124  avcodec-51.44.0.dll
>  9-15-07   8:38p   2242948         124  avcodec-51.dll
>  9-15-07   8:38p    167202         124  avcodec.a
>  9-15-07   8:38p   2242948         124  avcodec.dll
>  9-15-07   8:38p    103424         124  avcodec.lib
>  9-15-07   8:38p  10993664         124  avcodec_s.lib
>         6 file(s)   17993134 bytes used
>
> Note that the shared libs are stripped and compressed and will only work 
> with OS/2 ver 3 or newer.
> Dave

> --- configure	(revision 10503)
> +++ configure	(working copy)
> @@ -1197,6 +1199,27 @@
> +  os/2)
> +    ar="emxomfar -p256"
> +    ranlib="echo ignoring ranlib"
> +    dostrip="no"
> +    ln_s="cp -f"
> +    add_cflags "-Zomf"
> +    FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild"
> +    SHFLAGS="-Zdll -Zomf"
> +    FFSERVERLDFLAGS=""
> +    LIBPREF=""
> +    LIBSUF="_s.lib"
> +    SLIBPREF=""
> +    SLIBSUF=".dll"
> +    SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
> +    SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
> +    SLIB_EXTRA_CMD='dllar -o $(NAME)$(SLIBSUF) $(NAME)$(LIBSUF) -d $(SLIBNAME_WITH_MAJOR) -omf -ord $(LDFLAGS) $(EXTRALIBS) $(EXTRAOBJS); cp -f $(SLIBNAME) $(SLIBNAME_WITH_MAJOR)'
> +    SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SLIBNAME:$(SLIBSUF)=.lib) $(SLIBNAME:$(SLIBSUF)=.a) $(LIBDIR)'

You can use $(SLIBNAME) and $(LIB) to replace $(NAME)$(SLIBSUF) and
$(NAME)$(LIBSUF).

Diego




More information about the ffmpeg-devel mailing list