Rather than changing the code, can you do some tricks so that #include "third_party/libpng/png.h" that includes a forwarding file that includes <png.h>? I'm thinking, in the case that we want to build with system libpng:- ensure "forwarding_includes" is first in the include order - add file forwarding_includes/third_party/libpng/png.h that does #include <png.h>
Or maybe just - change the code to #include "forwarding_includes/libpng/png.h" - add forwarding_includes/libpng/png.h that includes either <png.h> or third_party/png.h, depending on the build flags. On Wed, Jul 22, 2009 at 2:43 PM, Adam Langley <[email protected]> wrote: > > Context: both fta (Ubuntu) and Tom (Fedora) patch Chromium to use the > system versions of libpng, libz etc. This seems perfectly reasonable, > it saves memory, startup times etc. We should support this without > patching the code. > > I have a prototype CL for libpng: http://codereview.chromium.org/159229 > > I'm requesting comments on the style. > > At first I thought about creating a 'shadow includes' directory which > would look like > > build/ > linux/ > shadow/ > third_party/ > libpng/ > png.h -> #include <png.h> > > If this directory was first on the include path list, it would > override the normal path. However, it is a little spooky and it > depends on a GYP change ('early_include_paths' or some such) to set > the ordering. (I couldn't find a good way to do it with the existing > make and SCons builds.) > > The above CL uses a macro include: > > #include INCLUDE_LIBPNG_PNG_H > > In order to support build tools which do header chasing, I also kept > the old include in an #if 0 block. > > This is a little more ugly in the source code, but it doesn't hide the > fact that something odd is happening. Here's the current Fedora patch > showing that not too many locations need patching like this: > > > http://spot.fedorapeople.org/chromium/patches/chromium-20090715-codechanges-system-bz2-xml2-xslt-zlib-minizip-libevent-jpeg-png-nss-nspr-v8.patch > > If the above technique is acceptable, I'll do the rest of the common > libraries in the coming weeks. libevent is one exception since we have > local bug fixes there which need to be upstream first. (I sent them > upstream ages ago, but to no reply.) > > > AGL > > > > --~--~---------~--~----~------------~-------~--~----~ Chromium Developers mailing list: [email protected] View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~----------~----~----~----~------~----~------~--~---
