Skip to content

Commit

Permalink
Remove setup0.h files
Browse files Browse the repository at this point in the history
Simplify things by putting setup.h files themselves under version
control and getting rid of setup0.h ones.

The initial motivation for using separate setup0.h files was to allow
having local changes to setup.h, but with Git there is a simple way to
do it by using "git update-index --skip-worktree include/wx/msw/setup.h"
for example, so we don't really need setup0.h any more and dropping them
makes things simpler.
  • Loading branch information
vadz committed Jan 31, 2021
1 parent fd653c7 commit d1810b0
Show file tree
Hide file tree
Showing 24 changed files with 35 additions and 126 deletions.
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,9 @@
/include/wx/generic/Makefile.in

# /include/wx/gtk/
/include/wx/gtk/setup.h
/include/wx/gtk/Makefile.in

# /include/wx/gtk1/
/include/wx/gtk1/setup.h
/include/wx/gtk1/Makefile.in

# /include/wx/html/
Expand All @@ -187,19 +185,12 @@
/include/wx/motif/Makefile.in

# /include/wx/msw/
/include/wx/msw/setup.h
/include/wx/msw/Makefile.in
/include/wx/msw/Makefile

# /include/wx/osx/
/include/wx/osx/setup.h

# /include/wx/protocol/
/include/wx/protocol/Makefile.in

# /include/wx/univ/
/include/wx/univ/setup.h

# /include/wx/unix/
/include/wx/unix/Makefile.in

Expand Down
1 change: 0 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -37458,7 +37458,6 @@ UNIV_DIST: ALL_GUI_DIST
mkdir $(DISTDIR)/src/univ
mkdir $(DISTDIR)/src/univ/themes
$(CP_P) $(INCDIR)/wx/univ/*.h $(DISTDIR)/include/wx/univ
$(CP_P) $(INCDIR)/wx/univ/setup0.h $(DISTDIR)/include/wx/univ/setup.h
$(CP_P) $(SRCDIR)/univ/*.cpp $(DISTDIR)/src/univ
$(CP_P) $(SRCDIR)/univ/themes/*.cpp $(DISTDIR)/src/univ/themes

Expand Down
6 changes: 0 additions & 6 deletions README-GIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ Please use `--recurse-submodules` option with the initial `git clone`. If you
had already cloned the repository without this option, please run `git
submodule update --init` to also get all 3rd party libraries code.

If you get errors about "wxUSE_XXX must be defined" when building, it
probably means that you need to copy the new options added to the file
`include/wx/msw/setup0.h` to `include/wx/msw/setup.h`. If you had never
modified the latter, it's safe to just delete it, as it will be created
by copying `setup0.h` during the next build.

Otherwise, building from Git checkout is not different from building
from the sources include into the releases, so please follow the usual
instructions in the port-specific files, such as
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ before_build:
if (-not (Test-Path env:wxUSE_STL)) { $env:wxUSE_STL = '0' }
if (-not (Test-Path env:wxUSE_WEBVIEW_EDGE)) { $env:wxUSE_WEBVIEW_EDGE = '0' }
if (($env:compiler -ne "msys2") -and ($env:compiler -ne "cygwin")) {
gc include\wx\msw\setup0.h |
gc include\wx\msw\setup.h |
%{$_ -replace "define wxUSE_STL 0", "define wxUSE_STL $env:wxUSE_STL"} |
%{$_ -replace "define wxUSE_WEBVIEW_EDGE 0", "define wxUSE_WEBVIEW_EDGE $env:wxUSE_WEBVIEW_EDGE"} |
sc include\wx\msw\setup.h
Expand Down
1 change: 0 additions & 1 deletion build/bakefiles/make_dist.mk
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,6 @@ UNIV_DIST: ALL_GUI_DIST
mkdir $(DISTDIR)/src/univ
mkdir $(DISTDIR)/src/univ/themes
$(CP_P) $(INCDIR)/wx/univ/*.h $(DISTDIR)/include/wx/univ
$(CP_P) $(INCDIR)/wx/univ/setup0.h $(DISTDIR)/include/wx/univ/setup.h
$(CP_P) $(SRCDIR)/univ/*.cpp $(DISTDIR)/src/univ
$(CP_P) $(SRCDIR)/univ/themes/*.cpp $(DISTDIR)/src/univ/themes

Expand Down
5 changes: 0 additions & 5 deletions build/bakefiles/wx.bkl
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@
<if cond="WXUNIV=='0'">$(TOOLKIT_LOWERCASE)</if>
</set>

<copy-file-to-file-if-not-exist id="master_setup.h">
<src>$(SRCDIR)/include/wx/$(SETUP_H_SUBDIR)/setup0.h</src>
<dst>$(SRCDIR)/include/wx/$(SETUP_H_SUBDIR)/setup.h</dst>
<dependency-of>setup_h</dependency-of>
</copy-file-to-file-if-not-exist>
<copy-file-to-file-if-not-exist id="setup.h">
<dependency-of>setup_h</dependency-of>
<src>$(SRCDIR)/include/wx/$(SETUP_H_SUBDIR)/setup.h</src>
Expand Down
17 changes: 7 additions & 10 deletions build/msw/makefile.gcc
Original file line number Diff line number Diff line change
Expand Up @@ -5067,6 +5067,12 @@ endif
ifeq ($(SHARED),0)
____wxgl_namelib_DEP = $(__gllib___depname)
endif
ifeq ($(WXUNIV),0)
__SETUP_H_SUBDIR_FILENAMES = msw
endif
ifeq ($(WXUNIV),1)
__SETUP_H_SUBDIR_FILENAMES = univ
endif
ifeq ($(USE_STC),1)
__wxscintilla = $(LIBDIRNAME)\libwxscintilla$(WXDEBUGFLAG).a
endif
Expand Down Expand Up @@ -5198,12 +5204,6 @@ endif
ifeq ($(USE_CAIRO),1)
____CAIRO_INCLUDEDIR_FILENAMES = -I$(CAIRO_ROOT)\include\cairo
endif
ifeq ($(WXUNIV),0)
__SETUP_H_SUBDIR_FILENAMES = msw
endif
ifeq ($(WXUNIV),1)
__SETUP_H_SUBDIR_FILENAMES = univ
endif


all: $(OBJS)
Expand Down Expand Up @@ -5277,7 +5277,7 @@ clean:
-if exist $(LIBDIRNAME)\libwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.a del $(LIBDIRNAME)\libwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_gl.a
$(MAKE) -C ..\..\samples -f makefile.gcc $(MAKEARGS) clean

setup_h: $(SETUPHDIR)\wx ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h $(SETUPHDIR)\wx\setup.h $(SETUPHDIR)\wx\msw\rcdefs.h
setup_h: $(SETUPHDIR)\wx $(SETUPHDIR)\wx\setup.h $(SETUPHDIR)\wx\msw\rcdefs.h

$(LIBDIRNAME)\libwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).a: $(WXREGEX_OBJECTS)
$(foreach f,$(subst \,/,$(WXREGEX_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
Expand Down Expand Up @@ -5889,9 +5889,6 @@ $(SETUPHDIR): $(LIBDIRNAME)
$(SETUPHDIR)\wx: $(SETUPHDIR)
if not exist $(SETUPHDIR)\wx mkdir $(SETUPHDIR)\wx

..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h:
if not exist ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h copy ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup0.h ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h

$(SETUPHDIR)\wx\setup.h:
if not exist $(SETUPHDIR)\wx\setup.h copy ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h $(SETUPHDIR)\wx\setup.h

Expand Down
17 changes: 7 additions & 10 deletions build/msw/makefile.vc
Original file line number Diff line number Diff line change
Expand Up @@ -5639,6 +5639,12 @@ ____wxgl_namedll_DEP = $(__gldll___depname)
!if "$(SHARED)" == "0"
____wxgl_namelib_DEP = $(__gllib___depname)
!endif
!if "$(WXUNIV)" == "0"
__SETUP_H_SUBDIR_FILENAMES = msw
!endif
!if "$(WXUNIV)" == "1"
__SETUP_H_SUBDIR_FILENAMES = univ
!endif
!if "$(USE_STC)" == "1"
__wxscintilla = $(LIBDIRNAME)\wxscintilla$(WXDEBUGFLAG).lib
!endif
Expand Down Expand Up @@ -5850,12 +5856,6 @@ __UNICODE_DEFINE_p = /D_UNICODE
!if "$(USE_CAIRO)" == "1"
____CAIRO_INCLUDEDIR_FILENAMES = /I$(CAIRO_ROOT)\include\cairo
!endif
!if "$(WXUNIV)" == "0"
__SETUP_H_SUBDIR_FILENAMES = msw
!endif
!if "$(WXUNIV)" == "1"
__SETUP_H_SUBDIR_FILENAMES = univ
!endif


all: $(OBJS)
Expand Down Expand Up @@ -5966,7 +5966,7 @@ clean:
$(MAKE) -f makefile.vc $(MAKEARGS) clean
cd "$(MAKEDIR)"

setup_h: $(SETUPHDIR)\wx ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h $(SETUPHDIR)\wx\setup.h $(SETUPHDIR)\wx\msw\rcdefs.h
setup_h: $(SETUPHDIR)\wx $(SETUPHDIR)\wx\setup.h $(SETUPHDIR)\wx\msw\rcdefs.h

$(LIBDIRNAME)\wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib: $(WXREGEX_OBJECTS)
if exist $@ del $@
Expand Down Expand Up @@ -6351,9 +6351,6 @@ $(SETUPHDIR): $(LIBDIRNAME)
$(SETUPHDIR)\wx: $(SETUPHDIR)
if not exist $(SETUPHDIR)\wx mkdir $(SETUPHDIR)\wx

..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h:
if not exist ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h copy ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup0.h ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h

$(SETUPHDIR)\wx\setup.h:
if not exist $(SETUPHDIR)\wx\setup.h copy ..\..\include\wx\$(__SETUP_H_SUBDIR_FILENAMES)\setup.h $(SETUPHDIR)\wx\setup.h

Expand Down
6 changes: 0 additions & 6 deletions build/msw/wx_custom_build.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,6 @@
<TargetName Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'">$(wxToolkitDllNamePrefix)$(ProjectName)$(wxToolkitDllNameSuffix)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'">$(wxToolkitDllNamePrefix)$(ProjectName)$(wxToolkitDllNameSuffix)</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="!Exists('..\..\include\wx\msw\setup.h')">
<PreBuildEvent>
<Message>Didn't find "include\wx\setup.h", copying setup0.h</Message>
<Command>copy ..\..\include\wx\msw\setup0.h ..\..\include\wx\msw\setup.h</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand Down
8 changes: 4 additions & 4 deletions build/tools/build-wxwidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def main(scriptName, args):
flags = {}
buildDir = os.path.abspath(os.path.join(scriptDir, "..", "msw"))

print("creating wx/msw/setup.h from setup0.h")
print("creating wx/msw/setup.h")
if options.unicode:
flags["wxUSE_UNICODE"] = "1"

Expand Down Expand Up @@ -404,13 +404,13 @@ def main(scriptName, args):


mswIncludeDir = os.path.join(wxRootDir, "include", "wx", "msw")
setup0File = os.path.join(mswIncludeDir, "setup0.h")
setupText = open(setup0File, "rb").read()
setupFile = os.path.join(mswIncludeDir, "setup.h")
setupText = open(setupFile, "rb").read()

for flag in flags:
setupText, subsMade = re.subn(flag + "\s+?\d", "%s %s" % (flag, flags[flag]), setupText)
if subsMade == 0:
print("Flag %s wasn't found in setup0.h!" % flag)
print("Flag %s wasn't found in setup.h!" % flag)
sys.exit(1)

setupFile = open(os.path.join(mswIncludeDir, "setup.h"), "wb")
Expand Down
5 changes: 0 additions & 5 deletions build/tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ mkdir -p $destdir
tar x -C $destdir -i

cd $destdir
# All setup0.h files are supposed to be renamed to just setup.h when checked
# out and in the distribution.
find $prefix/include/wx -type f -name setup0.h | while read f; do
mv $f ${f%0.h}.h
done

# Compile gettext catalogs.
make -C $prefix/locale -s MSGFMT=msgfmt allmo
Expand Down
22 changes: 11 additions & 11 deletions build/update-setup-h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ msg()
# write all the common options to stdout, massaging them specially if they are
# meant to be included in a configure input file setup.h.in
#
# usage: cat_common_options_for setup_inc.h setup0.h
# usage: cat_common_options_for setup_inc.h setup.h
cat_common_options_for()
{
# get rid of the copyright header on top of the file
Expand All @@ -52,7 +52,7 @@ cat_common_options_for()
# update the single setup.h file passed in as the parameter if it is out of
# date
#
# usage: update_single_setup_h {common|MSW} setup_inc.h setup0.h
# usage: update_single_setup_h {common|MSW} setup_inc.h setup.h
update_single_setup_h()
{
section=$1
Expand Down Expand Up @@ -108,22 +108,22 @@ if [ ! -f wxwin.m4 ]; then
fi

update_common_setup_h include/wx/android/setup.h
update_common_setup_h include/wx/motif/setup0.h
update_common_setup_h include/wx/msw/setup0.h
update_common_setup_h include/wx/gtk/setup0.h
update_common_setup_h include/wx/osx/setup0.h
update_common_setup_h include/wx/univ/setup0.h
update_common_setup_h include/wx/motif/setup.h
update_common_setup_h include/wx/msw/setup.h
update_common_setup_h include/wx/gtk/setup.h
update_common_setup_h include/wx/osx/setup.h
update_common_setup_h include/wx/univ/setup.h
update_common_setup_h setup.h.in
update_common_setup_h build/cmake/setup.h.in

update_msw_setup_h include/wx/msw/setup0.h
update_msw_setup_h include/wx/gtk/setup0.h
update_msw_setup_h include/wx/msw/setup.h
update_msw_setup_h include/wx/gtk/setup.h
update_msw_setup_h setup.h.in
update_msw_setup_h build/cmake/setup.h.in

update_osx_setup_h include/wx/osx/setup0.h
update_osx_setup_h include/wx/osx/setup.h

update_single_setup_h wxUniv include/wx/univ/setup_inc.h include/wx/univ/setup0.h
update_single_setup_h wxUniv include/wx/univ/setup_inc.h include/wx/univ/setup.h

exit $rc

20 changes: 0 additions & 20 deletions distrib/mac/pbsetup-sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,6 @@ if [ ! -d "${2}/include/wx" ]; then
fi
fi
#
# Copy stock setup0.h to setup.h if it doesn't exist
# preserve user modifications made to setup.h
#
if [ ! -f "${1}/../include/wx/osx/setup.h" ]; then
echo "${0}:${LINENO}: warning: copying \"include/wx/osx/setup0.h\" to \"include/wx/osx/setup.h\""
echo "${0}:${LINENO}: warning: edit \"include/wx/osx/setup.h\" to choose the features you would like to compile wxWindows with[out]"
cp "${1}/../include/wx/osx/setup0.h" "${1}/../include/wx/osx/setup.h"
if [ ! -f "${1}/../include/wx/osx/setup.h" ]; then
echo "${0}:${LINENO}: error: unable to create setup file \"${1}/../include/wx/osx/setup.h\""
exit 1
fi
fi
#
# Check that stock setup0.h is not newer than user setup.h
#
if [ "${1}/../include/wx/osx/setup0.h" -nt "${1}/../include/wx/osx/setup.h" ] ; then
echo "${0}:${LINENO}: warning: \"include/wx/osx/setup0.h\" is more recent than \"include/wx/osx/setup.h\""
echo "${0}:${LINENO}: warning: edit or replace \"include/wx/osx/setup.h\" to integrate changes"
fi
#
# Copy user setup.h to build setup.h if the latter doesn't exist or is older
#
if [ ! -f "${2}/include/wx/setup.h" -o \
Expand Down
20 changes: 0 additions & 20 deletions docs/msw/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,6 @@ variable containing the full path to this directory. While this is not
actually required, this makes using the library more convenient and
this environment variable is used in the examples below.

Upgrading Existing Git Checkout {#msw_update_setup_h}
-------------------------------

If you checked your sources from version control repository and didn't
obtain them from a release file, you may need to update your
`include/wx/msw/setup.h` file to add any new options from
`include/wx/msw/setup0.h` to it. If you hadn't edited `setup.h` file
manually, you can just delete it to force recreating it by copying
`setup0.h` to `setup.h` during the next build. If you forget to do it,
you may get errors during the build due to new options being
undefined.

If you have no intention of ever modifying `setup.h`, you may avoid this
problem entirely by creating a symbolic link to `setup0.h` before
building, e.g. using mklink, from an admin command prompt:

cd %WXWIN%\include\wx\msw\
mklink setup.h setup0.h



Building wxWidgets {#msw_build}
==================
Expand Down
6 changes: 0 additions & 6 deletions docs/univ/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ toolkit.
2. Installing under Win32
-------------------------

If compiling from CVS, please copy include/wx/univ/setup0.h
to include/wx/univ/setup.h before following these steps.

a) Using Visual C++ 6.0/7.x

Follow wxMSW instructions but make sure to choose one of the "Universal"
Expand Down Expand Up @@ -76,9 +73,6 @@ change for wxUniversal is that you must add "--enable-universal" switch to
the configure command line and for wxX11 even this is unnecessary, i.e. it
is enabled by default.

If compiling from CVS, please copy include/wx/univ/setup0.h
to include/wx/univ/setup.h before configuring.

4. Running wxUniv programs
--------------------------

Expand Down
7 changes: 2 additions & 5 deletions include/wx/chkconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
**************************************************
If you get an error saying "wxUSE_FOO must be defined", it means that you
are not using the correct up-to-date version of setup.h. This happens most
often when using git or snapshots and a new symbol was added to setup0.h
and you haven't updated your local setup.h to reflect it. If this is the
case, you need to propagate the changes from setup0.h to your setup.h and,
if using makefiles under MSW, also remove setup.h under the build directory
are not using the correct up-to-date version of setup.h. If you're building
using makefiles under MSW, also remove setup.h under the build directory
(lib/$(COMPILER)_{lib,dll}/msw[u][d][dll]/wx) so that the new setup.h is
copied there.
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion include/wx/motif/setup0.h → include/wx/motif/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -1613,4 +1613,3 @@
/* --- end common options --- */

#endif // _WX_SETUP_H_

1 change: 0 additions & 1 deletion include/wx/msw/setup0.h → include/wx/msw/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -1829,4 +1829,3 @@
/* --- end MSW options --- */

#endif // _WX_SETUP_H_

2 changes: 1 addition & 1 deletion include/wx/msw/setup_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Name: wx/msw/setup_inc.h
// Purpose: MSW-specific setup.h options
// Author: Vadim Zeitlin
// Created: 2007-07-21 (extracted from wx/msw/setup0.h)
// Created: 2007-07-21 (extracted from wx/msw/setup.h)
// Copyright: (c) 2007 Vadim Zeitlin <[email protected]>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion include/wx/univ/setup0.h → include/wx/univ/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -1760,4 +1760,3 @@
/* --- end wxUniv options --- */

#endif // _WX_SETUP_H_

2 changes: 1 addition & 1 deletion include/wx/univ/setup_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Name: wx/univ/setup_inc.h
// Purpose: wxUniversal-specific setup.h options (this file is not used
// directly, it is injected by build/update-setup-h in the
// generated include/wx/univ/setup0.h)
// generated include/wx/univ/setup.h)
// Author: Vadim Zeitlin
// Created: 2008-02-03
// Copyright: (c) 2008 Vadim Zeitlin <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion misc/scripts/clean_patch
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
filterdiff -x '*/*.vcproj' -x '*/*.vcxproj*' -x a/autoconf_inc.m4 -x a/configure -x '*/makefile.*' -x '*/Makefile.in' -x a/setup.h.in -x '*/setup.h' -x '*/setup0.h' "$@"
filterdiff -x '*/*.vcproj' -x '*/*.vcxproj*' -x a/autoconf_inc.m4 -x a/configure -x '*/makefile.*' -x '*/Makefile.in' -x a/setup.h.in -x '*/setup.h' "$@"

0 comments on commit d1810b0

Please sign in to comment.