Commits

Lenard Lindstrom committed aee1b66

Clean up some Windows dependency build issues

For msys_build_deps.py, replace BDWD environment variable with HOME,
so the Msys shell starts in the desired working directory. Fix a
problem with relative windows paths provided on the command line.
Disable smpeg builds when linking against anything but msvcrt.dll.

For msys.py, the drive letter is now lower case in an msys path.

For make_prebuilt, will now install msvcr90.dll linked prebuilts.

For Setup_Win.in, disable ffmpeg library inclusion in prebuilt directory.

At this point the smpeg library must be added manually to the
msys_build_deps.py prebuilt target directory (--prefix).

Python 2.7 for 64bit Windows has a VC.90 manifest identical to
32bit Python 2.6 and up. This suggests that the 32bit dependency
build tool chain can build AMD64 binaries without modification.

  • Participants
  • Parent commits 0fc204a

Comments (0)

Files changed (4)

         ignore, dest = os.path.split(src)
     if src == dest:
         raise IOError("%s: Source and destination are identical" % src)
-    mkdir(dest)
+    makedirs(dest)
     for name in os.listdir(src):
         src_path = os.path.join(src, name)
         if os.path.isfile(src_path):
 
 created_dirs = set()
 
-def mkdir(path):
+def makedirs(path):
     path = os.path.abspath(path)
     if path in created_dirs:
         pass
     elif not os.path.exists(path):
-        os.mkdir(path)
+        os.makedirs(path)
         created_dirs.add(path)
     elif not os.path.isdir(path):
         raise MakePrebuiltError("%s is not a directory" % path)
     if not force and os.path.isdir(dest_dir):
         if not confirm("Directory %s already exists;\ncontinue" % dest_dir):
             return 1
-    mkdir(dest_dir)
+    makedirs(dest_dir)
     if not src_dir:
         try:
             m = msys.Msys()
     prebuilt_template = os.path.abspath('prebuilt-template')
     dest_lib_dir = os.path.join(dest_dir, lib_subdir)
     
+    # msvcr71.dll or msvcr90.dll linking support.
+    src_msvcr71_dir = os.path.join(src_dir, 'lib', 'msvcr71')
+    have_msvcr71 = os.path.isdir(src_msvcr71_dir)
+    src_msvcr90_dir = os.path.join(src_dir, 'lib', 'msvcr90')
+    have_msvcr90 = os.path.isdir(src_msvcr90_dir)
+    if have_msvcr71 and have_msvcr90:
+        print_("Conflicting builds: "
+               "found both msvcr71.dll and msvcr90.dll linkage")
+        return 1
+    if have_msvcr71:
+        dest_msvcr71_dir = os.path.join(dest_dir, 'lib', 'msvcr71')
+        copy_dir(src_msvcr71_dir, dest_msvcr71_dir)
+    elif have_msvcr90:
+        dest_msvcr90_dir = os.path.join(dest_dir, 'lib', 'msvcr90')
+        copy_dir(src_msvcr90_dir, dest_msvcr90_dir)
+
     # Read setup file.
     src_file = os.path.join(prebuilt_template, 'Setup_Win.in')
     file_copy(src_file, dest_dir)
             dest_dll_dir = dest_dir
             for dir_name in path_elements[:-1]:
                 dest_dll_dir = os.path.join(dest_dll_dir, dir_name)
-                mkdir(dest_dll_dir)
+                makedirs(dest_dll_dir)
             file_copy(os.path.join(src_bin_dir, dll_name),
                       os.path.join(dest_dll_dir, dll_name))
             have_dlls.add(dep.name[8:])
     # Copy required import libraries only.
     copied_files = set()
     src_lib_dir = os.path.join(src_dir, 'lib')
-    mkdir(dest_lib_dir)
+    makedirs(dest_lib_dir)
     for ignore, libs in macros:
         use = False
         for lib in libs:
                 dest_header_dir = dest_dir
                 for dir_name in path_elements:
                     dest_header_dir = os.path.join(dest_header_dir, dir_name)
-                    mkdir(dest_header_dir)
+                    makedirs(dest_header_dir)
                 if not src_header_dir in copied_dirs:
                     copy_dir(src_header_dir, dest_header_dir)
                     copied_dirs.add(src_header_dir)
             os.path.join(src_dir, 'include', 'SDL', 'SDL_config_win32.h'),
             os.path.join(dest_dir, 'include', 'SDL', 'SDL_config.h'))
 
-    # msvcr71.dll linking support.
-    src_msvcr71_dir = os.path.join(src_dir, 'lib', 'msvcr71')
-    dest_msvcr71_dir = os.path.join(dest_dir, 'lib', 'msvcr71')
-    copy_dir(src_msvcr71_dir, dest_msvcr71_dir)
-
     # Def file bat.
     make_defs = open(os.path.join(dest_lib_dir, 'MakeDefs.bat'), 'w')
     try:
         if mingw_root is not None and path_lower.startswith(mingw_root.lower()):
             return '/mingw' + path[len(mingw_root):].replace(os.sep, '/')
         drive, tail = os.path.splitdrive(path)
-        tail = tail.replace(os.sep, '/')
-        return '/%s%s' % (drive[0], tail)
+        drive_mount_point = drive[0].lower()
+        drive_subpath = tail.replace(os.sep, '/')
+        return '/%s%s' % (drive_mount_point, drive_subpath)
 
     def msys_to_windows(self, path):
         """Return a Windows translation of an MSYS path

msys_build_deps.py

 
 SDL 1.2(.14+) hg changeset c5d651a8b679
 SDL_image 1.2(.10+) hg changset 45748e6e2f81
-SDL_mixer 1.2.11 hg changeset 6ed75d34edc9
+SDL_mixer 1.2.12 hg changeset b455bc681654
 SDL_ttf 2.0.11 hg changeset d9a600fa3c4a
-smpeg SVN revision 391
+smpeg SVN revision 391 (built separately with MSVC++)
 freetype 2.4.8
 libogg 1.3.0
 libvorbis 1.3.2
 FLAC 1.2.1
-mikmod 3.1.12 patched (included with SDL_mixer 1.2.11)
+mikmod 3.1.12 patched (included with SDL_mixer 1.2.12)
 tiff 4.0b7
 libpng 1.6.0b1
 jpeg 8c
 zlib 1.2.5
 PortMidi revision 217 from SVN
-  ffmpeg revision 24482 from SVN (swscale revision 31785)
+untested with GCC 4.6.1: ffmpeg revision 24482 from SVN (swscale revision 31785)
 
 The build environment used: 
 
 
     def build(self, msys):
         if self.path is not None:
-            msys.environ['BDWD'] = msys.windows_to_msys(self.path)
-            return_code = msys.run_shell_script(self.shell_script)
+            env_home = msys.environ.get('HOME', None)
+            msys.environ['HOME'] = self.path
+            try:
+                return_code = msys.run_shell_script(self.shell_script)
+            finally:
+                if env_home is not None:
+                    msys.environ['HOME'] = env_home
+                else:
+                    del msys.environ['HOME']
             if return_code != 0:
                 raise BuildError("The build for %s failed with code %d" %
                                  (self.name, return_code))
     """Set the environment variables used by the scripts"""
     
     environ = msys.environ
+
     msys_root_wp = msys.msys_root
     prefix_wp = options.prefix
     if not prefix_wp:
     else:
         prefix_mp = default_prefix_mp
         prefix_wp = msys.msys_to_windows(prefix_mp)
+    include_mp = prefix_mp + '/include'
+    lib_mp = prefix_mp + '/lib'
+    subsystem = ''
+    if not options.subsystem_noforce:
+        subsystem = '-mwindows'
+    msvcrt_mp = ''
+    resources_mp = ''
+    if options.msvcrt_version == 71:
+        # Hide the msvcrt.dll import libraries with those for msvcr71.dll.
+        # Their subdirectory is in the same directory as the SDL library.
+        msvcrt_mp = lib_mp + '/msvcr71'
+    elif options.msvcrt_version == 90:
+        # Hide the msvcrt.dll import libraries with those for msvcr90.dll.
+        # Their subdirectory is in the same directory as the SDL library.
+        msvcrt_mp = lib_mp + '/msvcr90'
+        resources_mp = msvcrt_mp + '/resources.o'
+
     environ['PREFIX'] = prefix_mp
+    environ.pop('INCLUDE', None)  # INCLUDE causes problems with MIXER.
+    environ['CPPFLAGS'] = merge_strings(as_macro_define('__MSVCRT_VERSION__',
+                                                       '0x0%02i0' % (options.msvcrt_version,)),
+                                        as_preprocessor_header_path(include_mp),
+                                        environ.get('CPPFLAGS', ''),
+                                        sep=' ')
+    # Need to make the resources object file an explicit linker option to
+    # bypass libtool (freetype).
+    environ['LDFLAGS'] = merge_strings(as_linker_lib_path(msvcrt_mp),
+                                       environ.get('LDFLAGS', ''),
+                                       as_linker_lib_path(lib_mp),
+                                       as_linker_option(resources_mp),
+                                       subsystem,
+                                       sep=' ')
+
     environ['BDCONF'] = as_flag(options.configure and
                                 not options.clean_only)
     environ['BDCOMP'] = as_flag(options.compile and
                                  options.strip and
                                  not options.clean_only)
     environ['BDCLEAN'] = as_flag(options.clean or options.clean_only)
-    environ.pop('INCLUDE', None)  # INCLUDE causes problems with MIXER.
-    lib_mp = prefix_mp + '/lib'
-    msvcrt_mp = ''
-    resources_mp = ''
-    if options.msvcrt_version == 71:
-        # Hide the msvcrt.dll import libraries with those for msvcr71.dll.
-        # Their subdirectory is in the same directory as the SDL library.
-        msvcrt_mp = lib_mp + '/msvcr71'
-    elif options.msvcrt_version == 90:
-        # Hide the msvcrt.dll import libraries with those for msvcr90.dll.
-        # Their subdirectory is in the same directory as the SDL library.
-        msvcrt_mp = lib_mp + '/msvcr90'
-        resources_mp = msvcrt_mp + '/resources.o'
-        environ['BDRESOURCES'] = resources_mp
+    environ['BDRESOURCES'] = resources_mp
     environ['BDMSVCRT_VERSION'] = '%i' % (options.msvcrt_version,)
     environ['BDMSVCRT'] = msvcrt_mp
-    include_wp = ''
-    if prefix_wp:
-        include_wp = os.path.join(prefix_wp, 'include')
-    environ['CPPFLAGS'] = merge_strings(as_macro_define('__MSVCRT_VERSION__',
-                                                       '0x0%02i0' % (options.msvcrt_version,)),
-                                        as_preprocessor_header_path(include_wp),
-                                        environ.get('CPPFLAGS', ''),
-                                        sep=' ')
-
-    subsystem = ''
-    if not options.subsystem_noforce:
-        subsystem = '-mwindows'
-    # Need to make the resources object file an explicit linker option to
-    # bypass libtool (freetype).
-    environ['LDFLAGS'] = merge_strings(as_linker_lib_path(msvcrt_mp),
-                                       environ.get('LDFLAGS', ''),
-                                       as_linker_lib_path(lib_mp),
-                                       as_linker_option(resources_mp),
-                                       subsystem,
-                                       sep=' ')
 
 class ChooseError(Exception):
     """Failer to select dependencies"""
 # represent configure, compile, install and clean respectively. When '1' the
 # corresponding action is performed. When '0' it is skipped. The installation
 # directory is given by PREFIX. The script needs to prepend it to PATH. The
-# source code root directory is BDWD. A script will cd to it before doing
-# starting the build. The msvcrt version is given as BDMSVCRT_VERSION. BDMSVCRT
-# is where to place a shadow libraries which hide the normal MinGW C runtime
-# export libraries. Various gcc flags are in CPPFLAGS, CFLAGS, and LDFLAGS.
-# INCLUDE is undefined.
+# script's HOME directory is the source code root directory. The msvcrt version
+# is given as BDMSVCRT_VERSION. BDMSVCRT is where to place a shadow libraries
+# which hide the normal MinGW C runtime export libraries. Various gcc flags are
+# in CPPFLAGS, CFLAGS, and LDFLAGS. INCLUDE is undefined.
 #
 # None of these scripts end with an "exit". Exit, possibly, leads to Msys
 # freezing on some versions of Windows (98).
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   # Remove NONAMELESSUNION from directx.h headers.
 if [ x$BDINST == x1 ]; then
   make install
   # Make SDL_config_win32.h available for prebuilt and MSVC
-  cp -f "$BDWD/include/SDL_config_win32.h" "$PREFIX/include/SDL"
+  cp -f "$HOME/include/SDL_config_win32.h" "$PREFIX/include/SDL"
 fi
 
 if [ x$BDSTRIP == x1 ]; then
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   cp -fp win32/Makefile.gcc .
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   ./configure --prefix="$PREFIX" \
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   # If this comes from the repository it has no configure script
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   ./configure --prefix="$PREFIX" \
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   # This will only build a static library.
 # for msvcr90.dll because of a strange linker error.
 bd_subdirs="port libtiff"
 
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   ./configure --disable-cxx --prefix="$PREFIX" \
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   # If this comes from the repository it has no configure script
 """),
     Dependency('SMPEG', ['smpeg-[0-9].*', 'smpeg'], ['smpeg.dll'], """
 
+if (( $BDMSVCRT_VERSION != 60 )); then
+    echo The smpeg build has been disabled\\.
+    exit 0
+fi
+
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   # This comes straight from SVN so has no configure script
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   ./configure --prefix="$PREFIX" \
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   ./configure --prefix="$PREFIX" \
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   # Add __MINGW32__ to SIZE_T_MAX declaration test in alloc.h header.
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
 
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 mikmod_dependencies='-ldsound'
 flac_dependencies='-lWs2_32'
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   # Fix up some g++ 4.5.0 issues in the source code.
 
 set -e
 export PATH="$PREFIX/bin:$PATH"
-cd "$BDWD"
 
 if [ x$BDCONF == x1 ]; then
   # Don't want the pthreads dll, which links to msvcrt.dll.

prebuilt-template/Setup_Win.in

-# Pygame 1.9.0 Windows dependency macros.
+# Pygame 1.9.2 Windows dependency macros.
 SDL = -Iprebuilt/include -Iprebuilt/include/SDL -Lprebuilt/lib -lSDL
 FONT = -lSDL_ttf
 IMAGE = -lSDL_image
 AVFORMAT = -Iprebuilt/include -lavformat -lavcodec -lavutil
 SWSCALE = -Iprebuilt/include -lswscale -lavutil
 # Ensure make_prebuilt.py includes the ffmpeg headers.
-COPYHDRS_AVFORMAT = -lavformat -Iprebuilt/include/libavformat
-COPYHDRS_SWCALE = -lswscale -Iprebuilt/include/libswscale
-COPYHDRS_AVCODEC = -lavcodec -Iprebuilt/include/libavcodec
-COPYHDRS_AVUTIL = -lavutil -Iprebuilt/include/libavutil
+#COPYHDRS_AVFORMAT = -lavformat -Iprebuilt/include/libavformat
+#COPYHDRS_SWCALE = -lswscale -Iprebuilt/include/libswscale
+#COPYHDRS_AVCODEC = -lavcodec -Iprebuilt/include/libavcodec
+#COPYHDRS_AVUTIL = -lavutil -Iprebuilt/include/libavutil
 # Ensure make_prebuilt.py includes the freetype2 headers.
 COPYHDRS_FREETYPE = -lfreetype -Iprebuilt/include/freetype2/freetype -Iprebuilt/include/freetype2/freetype/config
 # The DLL's
 COPYLIB_vorbis -logg -Lprebuilt/lib/libvorbis-0.dll
 COPYLIB_ogg -Lprebuilt/lib/libogg-0.dll
 COPYLIB_portmidi -Lprebuilt/lib/portmidi.dll
-COPYLIB_avformat -lavcodec -lavutil -Lprebuilt/lib/avformat-52.dll
-COPYLIB_swscale -lavutil -Lprebuilt/lib/swscale-0.dll
-COPYLIB_avcodec -lavutil -Lprebuilt/lib/avcodec-52.dll
-COPYLIB_avutil -Lprebuilt/lib/avutil-50.dll
+#COPYLIB_avformat -lavcodec -lavutil -Lprebuilt/lib/avformat-52.dll
+#COPYLIB_swscale -lavutil -Lprebuilt/lib/swscale-0.dll
+#COPYLIB_avcodec -lavutil -Lprebuilt/lib/avcodec-52.dll
+#COPYLIB_avutil -Lprebuilt/lib/avutil-50.dll