From: Derek C. <der...@mi...> - 2013-09-12 17:19:47
|
Hi Burkhard, > This uses HAVE_GETPAGESIZE and HAVE_SYS_PARAM_H, which should be > by the configure script, but these checks are missing in > configure.ac. I've been relying on the implicit check that AC_FUNC_MMAP does - I've tried using AC_CHECK_FUNCS_ONCE on getpagesize to explicitly ensure it's checked but it still bloats the configure script with duplicate checks because the implicit check uses AC_CHECK_FUNCS. Shall we just stick it on the AC_CHECK_FUNCS call in configure.ac anyway (if it's cached I suppose it's not that slow)? > > # localtime_r isn't supported in MinGW so I've tried to check for Window's equivalent, localtime_s and fall back to the thread-unsafe localtime... > > # FIXME: Any ideas on how to do this properly as my attempt to hook localtime_s into the autoconf script here doesn't seem to work - it just falls back to localtime. > > $ patch -p0 004_localtime_s.patch > Not sure which systems are affected, but printing repeated error > messages for missing OS festures is no good idea. I've attached a new 004_localtime_s.patch that works around the missing localtime_s export from msvcrt in MinGW - instead use the _localtime{32,64}_s functions (which localtime_s basically inlines depending on the target arch). Also replaced the perror with a comment when falling back to the non-reentrant localtime. > Looks ok if it doesn't break on Linux or OSX (please verify). I'll hopefully get back with some tests on Linux soon (but don't have an mac machine handy at the moment to test OSX). > Ok but how is the symbol visibility handled on Windows? Did you compile libquicktime > as a DLL? I compiled libquicktime as a dll and linked to it in an MSVC built application with the generated libquicktime.dll.a import library - it would appear that the use of -fvisibility=hidden is externing the functions correctly. > Please make a unified diff so I can look at it. Trying to check for $USERPROFILE should > happen on Windows only. On Posix systems, this always fails and just wastes time. Or (even worse) > $USERPROFILE could be set and used for something completely unrelated. I've attached a new unified diff for 007_LQT_CODEC_FILE_win_default.patch that #ifdef's the usage of USERPROFILE only for Windows. ________________________________________ From: Burkhard Plaum [bur...@ig...] Sent: 12 September 2013 14:07 To: lib...@li... Subject: Re: [Libquicktime-devel] libquicktime on windows Hi, Am 12.09.2013 13:09, schrieb Derek Chow: > Ok, I've got a base win32 build of libquicktime including ffmpeg plugin support! Very good. > I've attached some > patches I've used - mind I have yet to verify whether they break the linux build. See below for > some remarks. [...] > ######################## > ### Building libquicktime ### > ######################## > > # NOTE: It's important to do the CVS checkout in the msys shell rather than in a Windows environment to avoid Windows line-endings getting in the way of building. > $ cvs -d:pserver:ano...@li...:/cvsroot/libquicktime login > $ cvs -z3 -d:pserver:ano...@li...:/cvsroot/libquicktime co -D2013-05-13 -P libquicktime > > # (Sorry, I'm currently not so up-to-date checkout of libquicktime due to the project I'm working with - so I hope the patches still work when I update) > $ cd libquicktime You should always patch against cvs. > # replace usage of bzero and bcopy with memset and memcpy: > $ patch -p0 002_bzero_bcopy_to_memset_memcpy.patch Patch looks ok. > # replace usage of sysconf with getpagesize: > $ patch -p0 003_getpagesize.patch This uses HAVE_GETPAGESIZE and HAVE_SYS_PARAM_H, which should be by the configure script, but these checks are missing in configure.ac. > # localtime_r isn't supported in MinGW so I've tried to check for Window's equivalent, localtime_s and fall back to the thread-unsafe localtime... > # FIXME: Any ideas on how to do this properly as my attempt to hook localtime_s into the autoconf script here doesn't seem to work - it just falls back to localtime. > $ patch -p0 004_localtime_s.patch + #else + perror("Using thread-unsafe localtime"); + memcpy(&tm, localtime(&ti), sizeof(tm)); + #endif Not sure which systems are affected, but printing repeated error messages for missing OS festures is no good idea. > # add -no-undefined to the libtool calls for making shared libraries: > $ patch -p0 005_libtool_dll_fix.patch Looks ok if it doesn't break on Linux or OSX (please verify). > # tweak the ABI headers to avoid warnings in case I want to use the libquicktime library with other compilers (which I have successfully tried with MSVC 9.0): > $ patch -p0 006_pragma_gcc_fix.patch + #ifdef __GNUC__ #pragma GCC visibility push(default) + #endif Ok but how is the symbol visibility handled on Windows? Did you compile libquicktime as a DLL? In another library, which was ported to Windows, we have something like: #ifdef DLLEXPORT #define GAVL_PUBLIC __declspec(dllexport) // Windows #else #define GAVL_PUBLIC __attribute__ ((visibility("default"))) // gcc #endif And prefix every public functions by GAVL_PUBLIC (for lqt it would be LQT_PUBLIC). IIRC this was the only clean way to build a shared library on both systems, but I might be wrong since I didn't do the porting myself. The code is compliled with -fvisibility=hidden (if supported by the compiler) In this case, the pragmas are no longer necessary. > # fix LQT_CODEC_FILE default to work for windows environments that don't define HOME - using USERPROFILE instead (e.g. "C:\Users\<username>"). > # this isn't necessary if you only intend to run programs in the msys environment > $ patch -p0 007_LQT_CODEC_FILE_win_default.patch Please make a unified diff so I can look at it. Trying to check for $USERPROFILE should happen on Windows only. On Posix systems, this always fails and just wastes time. Or (even worse) $USERPROFILE could be set and used for something completely unrelated. [...] > # NOTE: Running libquicktime applications outside of msys environment: > As the path that libquicktime searches for it's plugins is currently hardcoded based on a #define > setup by the configure script (http://libquicktime.sourceforge.net/doc/codecs.html), you need > to setup an environment variable to correctly point to it's location as the msys path > e.g. '/c/dev/libquicktime/lib/libquicktime' won't make much sense to Windows natively... Currently we use $LIBQUICKTIME_PLUGIN_DIR if that exists, and fall back to the hardcoded default if it doesn't. If you want, you can propose and alternative method on Windows. > Comments are welcome! See above. I didn't apply anything yet though. As already said, patch against CVS and consider my comments. Burkhard ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. Consolidate legacy IT systems to a single system of record for IT 2. Standardize and globalize service processes across IT 3. Implement zero-touch automation to replace manual, redundant tasks http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk _______________________________________________ Libquicktime-devel mailing list Lib...@li... https://lists.sourceforge.net/lists/listinfo/libquicktime-devel |