-
-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This avoids dirtying the source directory when building out of tree Various build changes to make sure this works: - Includes for arch dir specify BUILDDIR before SRCDIR - #include <zconf.h> instead of "zconf.h": that way the include order takes effect. - Insert an #error directive in the original zconf.h that we process out. That way we can be sure we are including the right one when building out of tree. Signed-off-by: Daniel Axtens <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -421,9 +421,6 @@ else | |
echo "Checking for strerror... No." | tee -a configure.log | ||
fi | ||
|
||
# We need to remove zconf.h from source directory if building outside of it | ||
if [ "$SRCDIR" != "$BUILDDIR" ]; then rm -f $SRCDIR/zconf.h; fi | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
daxtens
Author
Contributor
|
||
|
||
# copy clean zconf.h for subsequent edits | ||
cp -p $SRCDIR/zconf.h.in zconf.h | ||
|
||
|
@@ -465,6 +462,10 @@ if test $zprefix -eq 1; then | |
echo "Using z_ prefix on all symbols." | tee -a configure.log | ||
fi | ||
|
||
# take out the error path that makes sure an out of tree build doesn't touch the source tree's zconf.h | ||
sed < zconf.h 's/#error.*//' > zconf.temp.h | ||
mv zconf.temp.h zconf.h | ||
|
||
# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists | ||
if test $solo -eq 1; then | ||
sed '/#define ZCONF_H/a\ | ||
|
@@ -742,7 +743,7 @@ sed < $SRCDIR/Makefile.in " | |
mkdir -p $ARCHDIR | ||
|
||
ARCHINCLUDES="-I$SRCDIR/$ARCHDIR -I$SRCDIR" | ||
if [ "$SRCDIR" != "$BUILDDIR" ]; then ARCHINCLUDES="${ARCHINCLUDES} -I$BUILDDIR"; fi | ||
if [ "$SRCDIR" != "$BUILDDIR" ]; then ARCHINCLUDES="-I$BUILDDIR ${ARCHINCLUDES}"; fi | ||
|
||
sed < $SRCDIR/$ARCHDIR/Makefile.in " | ||
/^CC *=/s#=.*#=$CC# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
|
||
/* @(#) $Id$ */ | ||
|
||
#error "Error: unprepared zconf.h included. Build system broken." | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
mtl1979
Collaborator
|
||
#ifndef ZCONF_H | ||
#define ZCONF_H | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
|
||
/* @(#) $Id$ */ | ||
|
||
#error "Error: unprepared zconf.h included. Build system broken." | ||
This comment has been minimized.
Sorry, something went wrong.
mtl1979
Collaborator
|
||
|
||
#ifndef ZCONF_H | ||
#define ZCONF_H | ||
#cmakedefine Z_PREFIX | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ | |
#ifndef ZLIB_H | ||
#define ZLIB_H | ||
|
||
#include "zconf.h" | ||
#include <zconf.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
|
12 comments
on commit ff7c02c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I haven't been considering Windows or CMake. If we're going to go the Cmake route we should go the whole way and drop ./configure completely.
In other news I think this breaks things subtly and should be reverted for now until I can fix it a bit better. (Relatedly, we should probably enable Travis on this repo --- all the bits are there!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More broadly, we could drop prefix support and clean up the data types and then simply drop zconf.h. That might be vastly better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropping prefix support is indeed something I have been considering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to adjust Visual C++ makefile so it can gracefully handle if zconf.h is missing... Currently it still depends on zconf.h.in. I will make pull requests when I finish each part of the cleanup as long as the patch doesn't introduce merge conflict with the current state of the upstream source tree. This pretty much requires me to keep HEAD of my private clone few revisions behind the public one and cherry-picking changes from upstream that don't conflict to separate temporary branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very difficult for me to test this because I don't have access to a Visual C++ environment. Will burninating zconf.h entirely make this easier? I was going to work on that shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we drop zconf.h from git repository, win32/Makefile.msc will recreate it automatically... It won't break as long as nothing in zconf.h.in depends on configure.
zconf.h.cmakein is something that has to be dealt in completely different way... I need to read the cmake manuals if there is clean way to automatically create it from zconf.h.in like configure does...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of getting rid of zconf.h, zconf.h.in, and zconf.h.cmakein. I'm doing a bunch of cleanups along that line, I'll see how far I get.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtl1979: If you're online, do you know if recent versions of windows support vnsprintf? It's in gzguts.h.
Maybe we should get an IRC channel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daxtens As far as I know, Visual C++ does have vsnprintf()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zconf.h and zconf.h.cmakein are gone now... Both are automatically generated on all targets I could test (cmake+linux, configure+linux, Visual C++/nmake)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dead2 Fine with me... Just had to install IRC client ;)
$SRCDIR/zconf.h is deleted anyways when using cmake, so removing these lines is counter-productive... It adds one unnecessary warning. The correct solution would be to fix Windows build system to use zconf.h.in to generate temporary copy of zconf.h and remove zconf.h and various other generated files from git repository.