1 # Copyright (C) 2001-2006 William Joseph.
3 # This file is part of GtkRadiant.
5 # GtkRadiant is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # GtkRadiant is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with GtkRadiant; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 Builds the ./install directory.
22 Copies files from various locations:
25 ../<library>/<library>.dll
26 ./include/version.default is used to generate RADIANT_MAJOR and RADIANT_MINOR
32 def assertMessage(condition, message):
34 raise Exception(message)
36 def copyFile(source, target):
37 assertMessage(os.path.isfile(source), "failed to find file: " + source)
38 print source, "->", target
39 shutil.copy2(source, target)
41 def copyFileIfExists(source, target):
42 if os.path.exists(source):
43 copyFile(source, target)
45 def copySvn(source, target):
46 assertMessage(os.path.isdir(source), "failed to find directory: " + source)
47 if not os.path.exists(target):
49 for name in os.listdir(source):
50 absolute = os.path.join(source, name)
51 absTarget = os.path.join(target, name)
52 if os.path.isdir(absolute):
54 copySvn(absolute, absTarget)
56 copyFile(absolute, absTarget)
58 def copyGame(source, game, target):
59 assertMessage(os.path.isdir(source), "failed to find directory: " + source)
60 assertMessage(os.path.isdir(target), "failed to find directory: " + target)
61 root = os.path.join(source, os.path.normpath(game[0]))
62 if os.path.exists(root):
63 gamename = game[1] + ".game"
64 copySvn(os.path.join(root, gamename), os.path.join(target, gamename))
65 gamesDir = os.path.join(target, "games")
66 if not os.path.exists(gamesDir):
68 copyFile(os.path.join(root, "games", gamename), os.path.join(gamesDir, gamename))
70 thisDir = os.path.dirname(__file__)
71 gamesRoot = os.path.join(thisDir, "games")
72 installRoot = os.path.join(thisDir, "install")
74 if not os.path.exists(installRoot):
78 copySvn(os.path.join(thisDir, os.path.normpath("setup/data/tools")), installRoot)
82 ("Doom3Pack/tools", "doom3"),
84 ("HalfLifePack", "hl"),
85 ("Her2Pack", "heretic2"),
86 ("JAPack/Tools", "ja"),
90 ("Q3Pack/tools", "q3"),
91 ("Q4Pack/tools", "q4"),
93 ("STVEFPack", "stvef"),
94 ("WolfPack/bin", "wolf"),
95 ("NexuizPack", "nexuiz"),
96 ("DarkPlacesPack", "darkplaces")
101 copyGame(gamesRoot, game, installRoot)
104 gtk2Root = os.path.normpath(os.path.join(thisDir, "../gtk2-2.4"))
105 if os.path.exists(gtk2Root):
106 copySvn(os.path.join(gtk2Root, "install"), installRoot)
108 iconv = os.path.normpath(os.path.join(thisDir, "../iconv-1.9/bin/iconv.dll"))
109 copyFileIfExists(iconv, installRoot)
111 libxml2 = os.path.normpath(os.path.join(thisDir, "../libxml2-2.6/bin/libxml2.dll"))
112 copyFileIfExists(libxml2, installRoot)
114 libpng = os.path.normpath(os.path.join(thisDir, "../libpng-1.2/lib/libpng13.dll"))
115 copyFileIfExists(libpng, installRoot)
117 libmhash = os.path.normpath(os.path.join(thisDir, "../mhash-0.9/win32/libmhash/Release/libmhash.dll"))
118 copyFileIfExists(libmhash, installRoot)
120 zlib = os.path.normpath(os.path.join(thisDir, "../zlib1-1.2/zlib1.dll"))
121 copyFileIfExists(zlib, installRoot)
123 msvcr71 = os.path.normpath(os.path.join(thisDir, "../msvc_redist/msvcr71.dll"))
124 copyFileIfExists(msvcr71, installRoot)
126 dbghelp = os.path.normpath(os.path.join(thisDir, "../msvc_redist/dbghelp.dll"))
127 copyFileIfExists(dbghelp, installRoot)
129 # create version files
130 version = open(os.path.join(thisDir, "include/version.default"), "rt").readline().split(".")
131 assertMessage(len(version) == 3, "failed to parse include/version.default")
132 open(os.path.join(thisDir, "install/RADIANT_MAJOR"), "wt").write(str(version[1]))
133 open(os.path.join(thisDir, "install/RADIANT_MINOR"), "wt").write(str(version[2]))