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

Dave Yeo daveryeo
Thu Oct 25 07:01:49 CEST 2007


On 10/24/07 01:20 am, Diego Biurrun wrote:
> On Mon, Oct 22, 2007 at 10:49:14AM -0700, Dave Yeo wrote:
>> On 10/22/07 09:55 am, Diego Biurrun wrote:
>>> On Mon, Oct 22, 2007 at 09:46:05AM -0700, Dave Yeo wrote:
>>>> --- configure	(revision 10822)
>>>> +++ configure	(working copy)
>>>> @@ -1212,6 +1214,26 @@
>>>> +  os/2)
>>>> +    SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
>>>> +    SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
>>>> +    SLIB_EXTRA_CMD='cmd /C dllar -o $(SLIBNAME) $(LIBNAME) -d 
>>>> $(SLIBNAME_WITH_MAJOR) -omf -ord $(LDFLAGS) $(EXTRALIBS) $(EXTRAOBJS); cp 
>>>> -f $(SLIBNAME) $(SLIBNAME_WITH_MAJOR)'
>>>> +    SLIB_INSTALL_EXTRA_CMD='install -m 644 $(NAME).lib 
>>>> $(LIBDIR)/$(LIBPREF)$(NAME)_dll.lib; install -m 644 $(NAME).a 
>>>> $(LIBDIR)/$(LIBPREF)$(NAME)_dll.a'
>>>> +    SLIB_UNINSTALL_EXTRA_CMD='rm -f $(LIBDIR)/$(LIBPREF)$(NAME)_dll.lib; 
>>>> rm -f $(LIBDIR)/$(LIBPREF)$(NAME)_dll.a'
>>> NAME needs to be FULLNAME to take BUILDSUF into account.
>> Both NAME and FULLNAME work here. Updated patch attached
>> --- configure	(revision 10837)
>> +++ configure	(working copy)
>> @@ -1212,6 +1214,26 @@
>> +  os/2)
>> +    ln_s="cp -f"
>> +    LIBSUF="_s.lib"
>> +    SLIBPREF=""
>> +    SLIBSUF=".dll"
>> +    SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
>> +    SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
>> +    SLIB_EXTRA_CMD='cmd /C dllar -o $(SLIBNAME) $(LIBNAME) -d $(SLIBNAME_WITH_MAJOR) -omf -ord $(LDFLAGS) $(EXTRALIBS) $(EXTRAOBJS); cp -f $(SLIBNAME) $(SLIBNAME_WITH_MAJOR)'
> 
> The 'cp -f' is redundant, compare common.mak:
> 
> install-lib-shared: $(SLIBNAME)
> 	install -d "$(SHLIBDIR)"
> 	install -m 755 $(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
> 	$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
> 	cd "$(SHLIBDIR)" && \
> 		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
> 	cd "$(SHLIBDIR)" && \
> 		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
> 	$(SLIB_INSTALL_EXTRA_CMD)
> 
> On your system this amounts to
> 
> install -m 755 $(SLIBNAME) $(SLIBNAME_WITH_VERSION)
> cp -f $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
> cp -f $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
> 
> and then you add
> 
> cp -f $(SLIBNAME) $(SLIBNAME_WITH_MAJOR)'
> 
> Clearly, this is redundant.

No, the original OS/2 support was broken, it built a broken DLL due to 
the lack of a DEF file when linking there was no exports from the DLL 
and linking to the ffmpeg built DLLs created binaries that crashed.
I came up with this patch to do the minimal changes to the build system 
which is why I just used dllar.cmd to build a DLL out of the static lib.
To keep make happy it builds the bad DLL then I overwrite it. Then make 
  install overwrites it again. I never did like this approach but it 
seemed to require minimal changes, just using SLIB_EXTRA_CMD.
On a new thread I'll submit my original idea for a patch (never submitted).
> 
>> +    SLIB_INSTALL_EXTRA_CMD='install -m 644 $(FULLNAME).lib $(LIBDIR)/$(LIBPREF)$(FULLNAME)_dll.lib; install -m 644 $(FULLNAME).a $(LIBDIR)/$(LIBPREF)$(FULLNAME)_dll.a'
> 
> The second command is for the static lib, right?  Then it should be in
> LIB_INSTALL_EXTRA_CMD.
> 
No, the second command is to install an a.out binary format import lib 
for building and linking without -Zomf. On OS/2 gcc still by default 
uses a.out format objects, libs and binaries and has since about 1990 
(perhaps earlier?) when the OS/2 (DOS?) version of gcc was forked.
Right now we only build a OMF static lib. Ideally would also be to build 
an a.out static lib but that would mean running the build twice and 
since currently the debugger only supports OMF and shared libs are 
better anyways for licensing purposes...
As well configure dies without the CFLAGS=-Zomf. Fix is probably to add 
.exe to $TMPE.
Dave




More information about the ffmpeg-devel mailing list