builds on mingw32 without jit, still untested

This commit is contained in:
Andrew Tonner 2017-01-18 04:41:40 -08:00
parent f64b888f78
commit b74ae092c9
134 changed files with 754 additions and 144 deletions

134
.gitignore vendored
View File

@ -6,3 +6,137 @@
# Mac OS X metadata
*.DS_Store
SheepShaver/src/Windows/downloads/
.idea/
SheepShaver/src/adb.cpp
SheepShaver/src/audio.cpp
SheepShaver/src/cdrom.cpp
SheepShaver/src/disk.cpp
SheepShaver/src/extfs.cpp
SheepShaver/src/pict.c
SheepShaver/src/prefs.cpp
SheepShaver/src/scsi.cpp
SheepShaver/src/sony.cpp
SheepShaver/src/xpram.cpp
SheepShaver/src/include/adb.h
SheepShaver/src/include/audio.h
SheepShaver/src/include/audio_defs.h
SheepShaver/src/include/cdrom.h
SheepShaver/src/include/clip.h
SheepShaver/src/include/debug.h
SheepShaver/src/include/disk.h
SheepShaver/src/include/extfs.h
SheepShaver/src/include/extfs_defs.h
SheepShaver/src/include/pict.h
SheepShaver/src/include/prefs.h
SheepShaver/src/include/scsi.h
SheepShaver/src/include/serial.h
SheepShaver/src/include/serial_defs.h
SheepShaver/src/include/sony.h
SheepShaver/src/include/sys.h
SheepShaver/src/include/timer.h
SheepShaver/src/include/xpram.h
SheepShaver/src/BeOS/audio_beos.cpp
SheepShaver/src/BeOS/extfs_beos.cpp
SheepShaver/src/BeOS/scsi_beos.cpp
SheepShaver/src/BeOS/serial_beos.cpp
SheepShaver/src/BeOS/sys_beos.cpp
SheepShaver/src/BeOS/timer_beos.cpp
SheepShaver/src/BeOS/xpram_beos.cpp
SheepShaver/src/BeOS/SheepDriver
SheepShaver/src/BeOS/SheepNet
SheepShaver/src/CrossPlatform/sigsegv.h
SheepShaver/src/CrossPlatform/sigsegv.cpp
SheepShaver/src/CrossPlatform/vm_alloc.h
SheepShaver/src/CrossPlatform/vm_alloc.cpp
SheepShaver/src/CrossPlatform/video_vosf.h
SheepShaver/src/CrossPlatform/video_blit.h
SheepShaver/src/CrossPlatform/video_blit.cpp
SheepShaver/src/Unix/audio_oss_esd.cpp
SheepShaver/src/Unix/bincue_unix.cpp
SheepShaver/src/Unix/bincue_unix.h
SheepShaver/src/Unix/vhd_unix.cpp
SheepShaver/src/Unix/extfs_unix.cpp
SheepShaver/src/Unix/serial_unix.cpp
SheepShaver/src/Unix/sshpty.h
SheepShaver/src/Unix/sshpty.c
SheepShaver/src/Unix/strlcpy.h
SheepShaver/src/Unix/strlcpy.c
SheepShaver/src/Unix/sys_unix.cpp
SheepShaver/src/Unix/timer_unix.cpp
SheepShaver/src/Unix/xpram_unix.cpp
SheepShaver/src/Unix/semaphore.h
SheepShaver/src/Unix/posix_sem.cpp
SheepShaver/src/Unix/config.sub
SheepShaver/src/Unix/config.guess
SheepShaver/src/Unix/m4
SheepShaver/src/Unix/keycodes
SheepShaver/src/Unix/tunconfig
SheepShaver/src/Unix/clip_unix.cpp
SheepShaver/src/Unix/Irix/audio_irix.cpp
SheepShaver/src/Unix/Linux/scsi_linux.cpp
SheepShaver/src/Unix/Linux/NetDriver
SheepShaver/src/Unix/ether_unix.cpp
SheepShaver/src/Unix/rpc.h
SheepShaver/src/Unix/rpc_unix.cpp
SheepShaver/src/Unix/ldscripts
SheepShaver/src/Unix/tinyxml2.h
SheepShaver/src/Unix/tinyxml2.cpp
SheepShaver/src/Unix/disk_unix.h
SheepShaver/src/Unix/disk_sparsebundle.cpp
SheepShaver/src/Unix/Darwin/mkstandalone
SheepShaver/src/Unix/Darwin/lowmem.c
SheepShaver/src/Unix/Darwin/pagezero.c
SheepShaver/src/Unix/Darwin/testlmem.sh
SheepShaver/src/dummy/audio_dummy.cpp
SheepShaver/src/dummy/clip_dummy.cpp
SheepShaver/src/dummy/serial_dummy.cpp
SheepShaver/src/dummy/prefs_editor_dummy.cpp
SheepShaver/src/dummy/scsi_dummy.cpp
SheepShaver/src/SDL
SheepShaver/src/slirp
SheepShaver/src/MacOSX/sys_darwin.cpp
SheepShaver/src/MacOSX/clip_macosx.cpp
SheepShaver/src/MacOSX/clip_macosx64.mm
SheepShaver/src/MacOSX/macos_util_macosx.h
SheepShaver/src/Unix/cpr.sh
SheepShaver/src/MacOSX/extfs_macosx.cpp
SheepShaver/src/Windows/clip_windows.cpp
SheepShaver/src/MacOSX/MacOSX_sound_if.cpp
SheepShaver/src/MacOSX/MacOSX_sound_if.h
SheepShaver/src/MacOSX/AudioBackEnd.cpp
SheepShaver/src/MacOSX/AudioBackEnd.h
SheepShaver/src/MacOSX/AudioDevice.cpp
SheepShaver/src/MacOSX/AudioDevice.h
SheepShaver/src/MacOSX/audio_macosx.cpp
SheepShaver/src/MacOSX/utils_macosx.mm
SheepShaver/src/MacOSX/utils_macosx.h
SheepShaver/src/Windows/cd_defs.h
SheepShaver/src/Windows/cdenable
SheepShaver/src/Windows/extfs_windows.cpp
SheepShaver/src/Windows/posix_emu.cpp
SheepShaver/src/Windows/posix_emu.h
SheepShaver/src/Windows/sys_windows.cpp
SheepShaver/src/Windows/timer_windows.cpp
SheepShaver/src/Windows/util_windows.cpp
SheepShaver/src/Windows/util_windows.h
SheepShaver/src/Windows/xpram_windows.cpp
SheepShaver/src/Windows/kernel_windows.h
SheepShaver/src/Windows/kernel_windows.cpp
SheepShaver/src/Windows/serial_windows.cpp
SheepShaver/src/Windows/router
SheepShaver/src/Windows/b2ether
SheepShaver/src/Windows/ether_windows.h
SheepShaver/src/Windows/ether_windows.cpp
SheepShaver/src/Windows/serial_windows.cpp
SheepShaver/src/Windows/prefs_editor_gtk.cpp
SheepShaver/src/uae_cpu/compiler/codegen_x86.h
SheepShaver/src/Windows/autom4te.cache/
SheepShaver/src/Windows/m4/
SheepShaver/src/Windows/aclocal.m4
SheepShaver/src/Windows/config.h.in
SheepShaver/src/Windows/configure
SheepShaver/src/Windows/config.log
SheepShaver/src/kpx_cpu/src/cpu/jit/x86/codegen_x86.h
BasiliskII/src/Windows/x64/
SheepShaver/src/Windows/config.status

View File

@ -30,6 +30,8 @@
#include <sys/types.h>
#include <sys/timeb.h>
#include "main.h"
static inline void _cdecl vwinbug(const char *s, va_list vargs)
{
char msg[1024], date[50], hours[50];

View File

@ -87,10 +87,9 @@ links:
Windows/posix_emu.cpp Windows/posix_emu.h Windows/sys_windows.cpp \
Windows/timer_windows.cpp Windows/util_windows.cpp \
Windows/util_windows.h Windows/xpram_windows.cpp \
Windows/kernel_windows.h Windows/kernel_windows.cpp \
Windows/serial_windows.cpp Windows/router Windows/b2ether \
Windows/ether_windows.h Windows/ether_windows.cpp \
Windows/serial_windows.cpp Windows/prefs_editor_gtk.cpp \
Windows/prefs_editor_gtk.cpp \
uae_cpu/compiler/codegen_x86.h'; \
PREFIX="../"; case $(B2_TOPDIR) in /*) PREFIX="";; esac; \
for i in $$list; do \

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/SheepDriver

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/SheepNet

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/audio_beos.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/extfs_beos.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/scsi_beos.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/serial_beos.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/sys_beos.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/timer_beos.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/BeOS/xpram_beos.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/sigsegv.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/sigsegv.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/video_blit.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/video_blit.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/video_vosf.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/vm_alloc.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/CrossPlatform/vm_alloc.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/AudioBackEnd.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/AudioBackEnd.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/AudioDevice.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/AudioDevice.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/MacOSX_sound_if.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/MacOSX_sound_if.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/audio_macosx.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/clip_macosx.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/clip_macosx64.mm

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/extfs_macosx.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/macos_util_macosx.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/sys_darwin.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/utils_macosx.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/MacOSX/utils_macosx.mm

View File

@ -1 +0,0 @@
../../BasiliskII/src/SDL

View File

@ -1 +0,0 @@
../../../../BasiliskII/src/Unix/Darwin/lowmem.c

View File

@ -1 +0,0 @@
../../../../BasiliskII/src/Unix/Darwin/mkstandalone

View File

@ -1 +0,0 @@
../../../../BasiliskII/src/Unix/Darwin/pagezero.c

View File

@ -1 +0,0 @@
../../../../BasiliskII/src/Unix/Darwin/testlmem.sh

View File

@ -1 +0,0 @@
../../../../BasiliskII/src/Unix/Irix/audio_irix.cpp

View File

@ -1 +0,0 @@
../../../../BasiliskII/src/Unix/Linux/NetDriver

View File

@ -1 +0,0 @@
../../../../BasiliskII/src/Unix/Linux/scsi_linux.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/audio_oss_esd.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/bincue_unix.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/bincue_unix.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/clip_unix.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/config.guess

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/config.sub

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/cpr.sh

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/disk_sparsebundle.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/disk_unix.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/ether_unix.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/extfs_unix.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/keycodes

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/ldscripts

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/m4

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/posix_sem.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/rpc.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/rpc_unix.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/semaphore.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/serial_unix.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/sshpty.c

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/sshpty.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/strlcpy.c

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/strlcpy.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/sys_unix.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/timer_unix.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/tinyxml2.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/tinyxml2.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/tunconfig

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/vhd_unix.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Unix/xpram_unix.cpp

View File

@ -38,7 +38,7 @@ CXXFLAGS = @CXXFLAGS@ $(SDL_CFLAGS)
CPPFLAGS = @CPPFLAGS@ -I../include -I. -I../slirp
DEFS = @DEFS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ -lwsock32 -liphlpapi
LIBS = @LIBS@ -lws2_32 -lwsock32 -liphlpapi
CPUSRCS = @CPUSRCS@
PERL = @PERL@
@ -54,7 +54,7 @@ HOST_CXXFLAGS = -O2
HOST_LDFLAGS =
## Files
UNIXSRCS = vm_alloc.cpp vm_alloc.h sigsegv.cpp sigsegv.h video_vosf.h video_blit.cpp video_blit.h
XPLATSRCS = vm_alloc.cpp vm_alloc.h sigsegv.cpp sigsegv.h video_vosf.h video_blit.cpp video_blit.h
ROUTERSRCS = router/arp.cpp router/dump.cpp router/dynsockets.cpp router/ftp.cpp \
router/icmp.cpp router/mib/interfaces.cpp router/iphelp.cpp router/ipsocket.cpp \
@ -69,7 +69,7 @@ SRCS = ../main.cpp main_windows.cpp ../prefs.cpp ../prefs_items.cpp prefs_window
../audio.cpp ../SDL/audio_sdl.cpp ../ether.cpp ether_windows.cpp \
../thunks.cpp ../serial.cpp serial_windows.cpp ../extfs.cpp extfs_windows.cpp \
about_window_windows.cpp ../user_strings.cpp user_strings_windows.cpp \
../dummy/prefs_editor_dummy.cpp clip_windows.cpp util_windows.cpp kernel_windows.cpp \
../dummy/prefs_editor_dummy.cpp clip_windows.cpp util_windows.cpp \
vm_alloc.cpp sigsegv.cpp posix_emu.cpp SheepShaver.rc \
$(CPUSRCS) $(ROUTERSRCS) $(SLIRP_OBJS)
@ -94,7 +94,7 @@ endif
all: $(PROGS)
$(UNIXSRCS): %: ../Unix/%
$(XPLATSRCS): %: ../CrossPlatform/%
$(LN_S) $< $@
OBJ_DIR = obj
@ -123,17 +123,17 @@ SRC_PATHS += $(sort $(foreach file, $(SRCS), $(dir $(file))))
VPATH :=
VPATH += $(addprefix :, $(subst ,:, $(filter-out $($(subst, :, ,$(VPATH))), $(SRC_PATHS))))
$(APP): $(UNIXSRCS) $(OBJ_DIR) $(OBJS)
$(APP): $(XPLATSRCS) $(OBJ_DIR) $(OBJS)
$(CXX) -o $(APP) $(LDFLAGS) $(OBJS) $(LIBS) $(SDL_LIBS)
$(UI_APP): $(UNIXSRCS) $(OBJ_DIR) $(UI_OBJS)
$(UI_APP): $(XPLATSRCS) $(OBJ_DIR) $(UI_OBJS)
$(CXX) -o $@ $(LDFLAGS) $(UI_OBJS) $(LIBS) $(GTK_LIBS) -mwindows -mno-cygwin
mostlyclean:
rm -f $(APP) $(UI_APP) $(OBJ_DIR)/* core* *.core *~ *.bak
clean: mostlyclean
rm -f $(UNIXSRCS)
rm -f $(XPLATSRCS)
rm -f dyngen basic-dyngen-ops.hpp ppc-dyngen-ops.hpp ppc-execute-impl.cpp
distclean: clean

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/b2ether

View File

@ -0,0 +1,550 @@
#
# A python 2.7 script to fetch all dependencies and build Sheepshaver using MSYS
#
import argparse
import glob
import json
import os
import subprocess
import urllib
import xml.dom.minidom
import zipfile
import sys
from contextlib import contextmanager
import datetime
MACEMU_CFLAGS = "-mwin32"
MACEMU_CXXFLAGS = "-mwin32 -std=gnu++11 -U__STRICT_ANSI__"
script_path = os.path.dirname(os.path.abspath(__file__))
MINGW_EXTRACT_PATH = r"c:\mingw-sheep"
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--uninstall-packages", "-u",
help="Uninstall all the msys/mingw packages",
default=False,
action="store_true",
)
parser.add_argument("--run-shell", "-s",
help="Run a quick bash session with the paths set",
default=False,
action="store_true",
)
parser.add_argument("--make-threads", "-j",
default=1,
type=int,
)
parser.add_argument("--gitignore-link-outputs",
help="Add the symlinks that 'make links' creates to .gitignore and stop tracking them",
default=False,
action="store_true",
)
parser.add_argument("--show-build-environment",
default=False,
action="store_true",
)
return parser.parse_args()
def get_download_dir():
download_dir = os.path.join(script_path, "downloads")
if not os.path.isdir(download_dir):
os.mkdir(download_dir)
return download_dir
def download(url, local_filename_proper=None):
if local_filename_proper is None:
up_to_path = url.rsplit("?", 1)[0]
local_filename_proper = up_to_path.rsplit("/", 1)[-1]
local_filename = os.path.join(get_download_dir(), local_filename_proper)
if not os.path.exists(local_filename):
try:
urllib.urlretrieve(url, local_filename)
except IOError:
if os.path.exists(local_filename):
os.remove(local_filename)
raise
return local_filename
def extract_zip(zip_filename, target_dir):
if not os.path.isdir(target_dir):
os.mkdir(target_dir)
zf = zipfile.ZipFile(zip_filename)
try:
zf.extractall(target_dir)
finally:
zf.close()
def env_augmented_with_paths(*path_dirs_to_add):
env_copy = dict(os.environ)
path_dirs = env_copy["PATH"].split(os.pathsep)
for d in path_dirs_to_add:
if d not in path_dirs:
path_dirs.append(d)
env_copy["PATH"] = os.pathsep.join(path_dirs)
return env_copy
def display_dir(path):
windows_dir = os.path.join(script_path)
if path.startswith(windows_dir):
return "Windows" + path[len(windows_dir):]
return path
def cc(cmd_args, *args, **kwargs):
print "%s (cwd=%s)" % (" ".join(cmd_args), kwargs.get("cwd"))
sys.stdout.flush()
subprocess.check_call(cmd_args, *args, **kwargs)
def log(msg):
print msg
sys.stdout.flush()
def install(make_args, show_build_environment):
root_dir = os.path.abspath(os.path.join(script_path, "..", "..", ".."))
dep_tracker = BuildDepTracker(root_dir)
# just ham in the working directory for consistency
os.chdir(script_path)
# get msys / mingw tools we need to build
mingw_get_zip = download("https://downloads.sourceforge.net/project/mingw/Installer/mingw-get/"
"mingw-get-0.6.2-beta-20131004-1/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip")
mingw_get_dir = MINGW_EXTRACT_PATH
extract_zip(mingw_get_zip, mingw_get_dir)
mingw_get_filename = os.path.join(mingw_get_dir, "bin", "mingw-get.exe")
assert os.path.isfile(mingw_get_filename)
msys_packages = ["bash", "autogen", "m4", "make", "patch"]
mingw_packages = ["autoconf", "autoconf2.5", "automake", "automake1.11", "binutils", "base", "autotools", "libtool",
"gcc", "gcc-g++"]
all_packages_to_install = ["mingw32-%s" % x for x in mingw_packages] + ["msys-%s" % x for x in msys_packages]
installed_packages = get_installed_packages(quiet=True)
if any(package not in installed_packages for package in all_packages_to_install):
cc([mingw_get_filename, "install"] + all_packages_to_install)
else:
log("All required packages installed")
mingw_get_bin_dir = os.path.join(mingw_get_dir, "bin")
msys_bin_dir = os.path.join(mingw_get_dir, "msys", "1.0", "bin")
mingw_bin_dir = os.path.join(mingw_get_dir, "mingw32", "bin")
our_env = env_augmented_with_paths(mingw_get_bin_dir, msys_bin_dir, mingw_bin_dir)
# ditch any outer make flags from cmake or similar due to compatibility problems
for var in ["MAKEFLAGS", "MAKELEVEL", "MFLAGS"]:
our_env.pop(var, None)
if show_build_environment:
print "ENVIRONMENT FOR BUILD"
show_env_dict(our_env)
print ""
# build SDL
sdl_zip_filename = download("http://www.libsdl.org/release/SDL-1.2.15.zip")
sdl_dir = os.path.join(get_download_dir(), "SDL-1.2.15")
with dep_tracker.rebuilding_if_needed("sdl_extract_zip", sdl_zip_filename) as needs_rebuild:
if needs_rebuild:
extract_zip(sdl_zip_filename, get_download_dir())
patch_filename = os.path.join(script_path, "sdl_fix.patch")
sdl_patched_files = ["build-scripts/ltmain.sh"]
with dep_tracker.rebuilding_if_needed("sdl_patch", patch_filename) as needs_rebuild:
if needs_rebuild:
# apply patch for building in msys/mingw
patch_exe = os.path.join(msys_bin_dir, "patch.exe")
cc([patch_exe, "-p2", "-i", patch_filename], cwd=sdl_dir, env=our_env)
dep_tracker.done("sdl_patch")
msys_bash = os.path.join(msys_bin_dir, "bash.exe")
make_bin = os.path.join(msys_bin_dir, "make.exe")
# our_env["MAKE"] = make_bin
with dep_tracker.rebuilding_if_needed("sdl_autogen",
["configure.in"] + sdl_patched_files, base_dir=sdl_dir) as needs_rebuild:
if needs_rebuild:
cc([msys_bash, "./autogen.sh"], cwd=sdl_dir, env=our_env)
with dep_tracker.rebuilding_if_needed("sdl_configure", "configure", base_dir=sdl_dir) as needs_rebuild:
if needs_rebuild:
cc([msys_bash, "./configure", "--disable-shared", "--prefix=/usr"], cwd=sdl_dir, env=our_env)
cc([make_bin] + make_args + ["clean"], cwd=sdl_dir, env=our_env)
cc([make_bin] + make_args, cwd=sdl_dir, env=our_env)
# TODO track all the files tht this could install
sdl_headers = "SDL.h SDL_active.h SDL_audio.h SDL_byteorder.h SDL_cdrom.h SDL_cpuinfo.h SDL_endian.h " \
"SDL_error.h SDL_events.h SDL_getenv.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h " \
"SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_platform.h SDL_quit.h SDL_rwops.h " \
"SDL_stdinc.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h " \
"begin_code.h close_code.h"
sdl_headers = ["include/" + x for x in sdl_headers.split(" ")]
sdl_files_being_installed = ["sdl-config", "build/libSDL.la"] + sdl_headers
with dep_tracker.rebuilding_if_needed("sdl_install", sdl_files_being_installed, base_dir=sdl_dir) as needs_rebuild:
if needs_rebuild:
cc([make_bin, "install"], cwd=sdl_dir, env=our_env)
# build sheepshaver
sheepshaver_dir = os.path.abspath(os.path.join(script_path, "..", ".."))
print "SHEEPSHAVER_DIR: %s" % sheepshaver_dir
link_inputs = get_symlink_filenames(prefix="BasiliskII/src/")
print "Tracking %d link inputs" % len(link_inputs)
sys.stdout.flush()
# TODO: fix make links step rather than just eating the exception
with dep_tracker.rebuilding_if_needed("sheepshaver_top_makefile", ["SheepShaver/Makefile"] + link_inputs,
base_dir=root_dir) as needs_rebuild:
if needs_rebuild:
try:
cc([make_bin, "links"], cwd=sheepshaver_dir, env=our_env)
except subprocess.CalledProcessError:
pass
autogen_env = dict(our_env, NO_CONFIGURE="1")
unix_dir = os.path.join(sheepshaver_dir, "src", "Unix")
with dep_tracker.rebuilding_if_needed("sheepshaver_autogen", ["configure.ac"],
base_dir=script_path) as needs_rebuild:
if needs_rebuild:
cc([msys_bash, os.path.join(unix_dir, "autogen.sh")], cwd=script_path, env=autogen_env)
ln_cmd = os.path.join(msys_bin_dir, "ln.exe")
windows_m4_dir = os.path.join(script_path, "m4")
if not os.path.exists(windows_m4_dir):
cc([ln_cmd, "-sf", os.path.join(unix_dir, "m4"), windows_m4_dir],
cwd=script_path, env=autogen_env)
configure_macemu_env = dict(our_env)
configure_macemu_env["CC"] = "gcc %s" % MACEMU_CFLAGS
configure_macemu_env["CXX"] = "g++ %s" % MACEMU_CXXFLAGS
with dep_tracker.rebuilding_if_needed("sheepshaver_configure", ["configure", "Makefile.in"],
base_dir=script_path) as needs_rebuild:
if needs_rebuild:
# TODO FIX JIT
cc([msys_bash, "./configure", "--with-gtk=no", "--enable-jit=no"],
cwd=script_path, env=configure_macemu_env)
cc([make_bin] + make_args, cwd=script_path, env=our_env)
def show_env_dict(d):
keys = d.keys()
keys.sort()
for key in keys:
value = d[key]
print "\t%20s\t%s" % (key, value)
def xml_element_helper(filename, tag_name):
dom = xml.dom.minidom.parse(filename)
for element in dom.getElementsByTagName(tag_name):
assert isinstance(element, xml.dom.minidom.Element)
yield element
def xml_read_helper(filename, tag_name, attribute):
"""In the named XML file, get the values for an attribute on all the tags with the given tag name,
and return them as a list"""
values = []
for element in xml_element_helper(filename, tag_name):
value = element.getAttribute(attribute)
values.append(value)
return values
def get_installed_packages(quiet=False):
data_path = os.path.join(MINGW_EXTRACT_PATH, "var", "lib", "mingw-get", "data")
# msys tracks installed packages by installed tarnames in the sysroot file.
# first, get the mapping from tarnames to package names for all available packages
package_list_filename = os.path.join(data_path, "package-list.xml")
catalogues = xml_read_helper(package_list_filename, "package-list", "catalogue")
packages_by_tarname = {}
for catalogue in catalogues:
catalog_filename = os.path.join(data_path, catalogue + ".xml")
package_catalogues = xml_read_helper(catalog_filename, "package-list", "catalogue")
for package_catalogue in package_catalogues:
package_catalogue_filename = os.path.join(data_path, package_catalogue + ".xml")
for package_element in xml_element_helper(package_catalogue_filename, "package"):
assert isinstance(package_element, xml.dom.minidom.Element)
package_name = package_element.getAttribute("name")
releases = package_element.getElementsByTagName("release")
for release in releases:
assert isinstance(release, xml.dom.minidom.Element)
tarname = release.getAttribute("tarname")
skip_set = False
if tarname in packages_by_tarname:
old_package_name = packages_by_tarname[tarname]
if old_package_name != package_name:
if package_name.endswith("-old"):
skip_set = True
else:
assert False, "duplicate packages for %r; old: %r, " \
"new %r" % (tarname, packages_by_tarname[tarname], package_name)
if not skip_set:
packages_by_tarname[tarname] = package_name
# for tarname, package_name in packages_by_tarname.iteritems():
# print "%s -> %s" % (tarname, package_name)
# next, get the list of all the installed tarnames, and build the list of installed packages for them
installed_packages = set()
for match_proper in glob.glob1(data_path, "sysroot-*.xml"):
match_filename = os.path.join(data_path, match_proper)
for tarname in xml_read_helper(match_filename, "installed", "tarname"):
package_catalogue = packages_by_tarname[tarname]
if not quiet:
print "%s - %s" % (tarname, package_catalogue)
sys.stdout.flush()
installed_packages.add(package_catalogue)
return list(installed_packages)
def uninstall_packages():
mingw_get_filename = os.path.join(MINGW_EXTRACT_PATH, "bin", "mingw-get.exe")
# output = subprocess.check_output([mingw_get_filename, "list"])
installed_packages = get_installed_packages()
# uninstall them
for package_name in installed_packages:
cc([mingw_get_filename, "remove", package_name])
def run_shell():
mingw_get_dir = MINGW_EXTRACT_PATH
msys_bin_dir = os.path.join(mingw_get_dir, "msys", "1.0", "bin")
mingw_bin_dir = os.path.join(mingw_get_dir, "mingw32", "bin")
mingw_get_bin_dir = os.path.join(mingw_get_dir, "bin")
msys_bash = os.path.join(msys_bin_dir, "bash.exe")
our_env = env_augmented_with_paths(mingw_get_bin_dir, msys_bin_dir, mingw_bin_dir)
cc([msys_bash], env=our_env)
def get_symlink_filenames(prefix="SheepShaver/src/"):
""" Get a list of files that 'make links' in the top Makefile makes symlinks for """
sheepshaver_dir = os.path.abspath(os.path.join(script_path, "..", ".."))
top_makefile = os.path.join(sheepshaver_dir, "Makefile")
with open(top_makefile, "r") as handle:
while not handle.readline().startswith("links:"):
pass
first_line = handle.readline()
links_list_prefix = " @list='"
assert first_line.startswith(links_list_prefix)
lines = [first_line[len(links_list_prefix):]]
while True:
line = handle.readline()
end_pos = line.find("'")
if end_pos == -1:
lines.append(line)
else:
lines.append(line[:end_pos])
break
links_list_text = "".join(lines)
return [prefix + x for x in links_list_text.split() if x != "\\"]
def gitignore_patterns(patterns):
""" Add the given patterns to the .gitignore file so they don't show up in git diff output """
root_dir = os.path.abspath(os.path.join(script_path, "..", "..", ".."))
gitignore_file = os.path.join(root_dir, ".gitignore")
with open(gitignore_file, "a") as handle:
for pattern in patterns:
print >> handle, pattern
def get_tracked_files():
root_dir = os.path.abspath(os.path.join(script_path, "..", "..", ".."))
lines = subprocess.check_output(["git", "ls-tree", "--full-tree", "-r",
"--name-only", "HEAD"], cwd=root_dir).split("\n")
lines = [line.strip() for line in lines]
return [line for line in lines if line != ""]
def get_staged_deletes():
staged_deletes = []
root_dir = os.path.abspath(os.path.join(script_path, "..", "..", ".."))
lines = subprocess.check_output(["git", "diff", "--name-status", "--cached"], cwd=root_dir).split("\n")
for line in lines:
if line.strip() == "":
continue
flags, filename = line.split(None, 1)
# print repr((flags, filename))
if flags == "D":
staged_deletes.append(filename)
return staged_deletes
class BuildDepTracker(object):
def __init__(self, root_path):
assert os.path.isdir(root_path)
self.root_path = root_path
self.filename = os.path.join(script_path, "build_on_msys.cache.json")
self.cache = None
self.step_input_files = {}
self.load()
self.debug_output = True
def load(self):
if os.path.exists(self.filename):
with open(self.filename, "r") as handle:
self.cache = json.load(handle)
else:
self.cache = {"steps": {}}
def save(self):
with open(self.filename, "w") as handle:
json.dump(self.cache, handle, sort_keys=True, indent=4, separators=(',', ': '))
def _rel_path_for(self, filename):
assert os.path.commonprefix(filename, self.root_path) == self.root_path
return os.path.relpath(filename, start=self.root_path)
@contextmanager
def rebuilding_if_needed(self, step_name, input_filenames, base_dir=None):
"""
@type step_name: unicode or str
@type input_filenames: str or list of str
@param base_dir: if provided, all input_filenames are relative to this"""
needs_rebuild = self.check_needs_rebuild(step_name, input_filenames, base_dir)
yield needs_rebuild
if needs_rebuild:
self.done(step_name)
def check_needs_rebuild(self, step_name, input_filenames, base_dir=None):
""" Check if the given step build name needs a rebuild based on our records and
the ages of the input files.
@type step_name: unicode or str
@type input_filenames: list of str
@param base_dir: if provided, all input_filenames are relative to this
"""
if type(input_filenames) in (unicode, str):
input_filenames = [input_filenames]
if base_dir is not None:
input_filenames = [os.path.join(base_dir, x) for x in input_filenames]
step_entries = self.cache["steps"]
if len(input_filenames) == 0:
assert False, "At least one input file is required in step '%s'" % step_name
entry = step_entries.get(step_name)
input_modified_time = self.get_inputs_modified_time(input_filenames)
self.step_input_files[step_name] = input_filenames
rebuild_required = entry is None or entry < input_modified_time
if self.debug_output:
if entry is None:
desc = "not previously built; building"
else:
desc = "rebuild required: %s; last build %s;" \
"input files changed %s; " % (rebuild_required,
datetime.datetime.fromtimestamp(entry),
datetime.datetime.fromtimestamp(input_modified_time),
)
print "REBUILD(%s): %s" % (step_name, desc)
sys.stdout.flush()
return rebuild_required
@staticmethod
def get_inputs_modified_time(input_filenames):
input_file_mtimes = []
for input_filename in input_filenames:
stat = os.stat(input_filename)
if stat is None:
assert False, "Missing input file %s" % input_filename
input_file_mtimes.append(stat.st_mtime)
input_modified_time = max(input_file_mtimes)
return input_modified_time
def done(self, step_name):
print "DONE_REBUILD(%s)" % step_name
input_filenames = self.step_input_files.get(step_name)
if input_filenames is None:
assert False, "No needs_rebuild check was done for step '%s' so we don't know its input files" % step_name
step_entries = self.cache["steps"]
input_modified_time = self.get_inputs_modified_time(input_filenames)
# save a new entry for the build that happened
# build is good up for the current file modified times
step_entries[step_name] = input_modified_time
self.save()
def main():
options = parse_args()
if options.run_shell:
run_shell()
elif options.uninstall_packages:
uninstall_packages()
elif options.gitignore_link_outputs:
link_output_files = get_symlink_filenames()
# add to gitignore
gitignore_patterns(link_output_files)
# stop tracking if tracked
tracked_files = get_tracked_files()
staged_deletes = get_staged_deletes()
root_dir = os.path.abspath(os.path.join(script_path, "..", "..", ".."))
for filename_relative in link_output_files:
# filename = os.path.join(root_dir, filename_relative.replace("/", "\\"))
file_is_tracked = filename_relative in tracked_files or \
any(filename.startswith(filename_relative + "/") for filename in tracked_files)
if file_is_tracked and not filename_relative in staged_deletes:
subprocess.check_call(["git", "rm", "--cached", filename_relative], cwd=root_dir)
else:
make_args = []
num_threads = options.make_threads
if num_threads > 1:
make_args.append("-j%d" % num_threads)
install(make_args, options.show_build_environment)
if __name__ == "__main__":
main()

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/cd_defs.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/cdenable

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/clip_windows.cpp

View File

@ -84,7 +84,7 @@ AC_CACHE_CHECK([whether VirtualProtect works],
#define HAVE_WIN32_VM 1
#define CONFIGURE_TEST_VM_MAP
#define TEST_VM_PROT_$test_def
#include "../Unix/vm_alloc.cpp"
#include "../CrossPlatform/vm_alloc.cpp"
], ac_cv_VirtualProtect_works=no, rm -f core,
dnl When cross-compiling, assume it works
ac_cv_VirtualProtect_works="yes"
@ -94,7 +94,7 @@ AC_CACHE_CHECK([whether VirtualProtect works],
#define HAVE_WIN32_VM 1
#define CONFIGURE_TEST_VM_MAP
#define TEST_VM_PROT_RDWR_WRITE
#include "../Unix/vm_alloc.cpp"
#include "../CrossPlatform/vm_alloc.cpp"
], , ac_cv_VirtualProtect_works=no,
dnl When cross-compiling, assume it works
ac_cv_VirtualProtect_works="yes"
@ -116,8 +116,8 @@ AC_CACHE_CHECK([whether your system supports Windows exceptions],
AC_TRY_RUN([
#define HAVE_WIN32_EXCEPTIONS 1
#define CONFIGURE_TEST_SIGSEGV_RECOVERY
#include "../Unix/vm_alloc.cpp"
#include "../Unix/sigsegv.cpp"
#include "../CrossPlatform/vm_alloc.cpp"
#include "../CrossPlatform/sigsegv.cpp"
],
ac_cv_have_win32_exceptions=yes,
ac_cv_have_win32_exceptions=no,
@ -141,8 +141,8 @@ AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
AC_TRY_RUN([
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
#define CONFIGURE_TEST_SIGSEGV_RECOVERY
#include "../Unix/vm_alloc.cpp"
#include "../Unix/sigsegv.cpp"
#include "../CrossPlatform/vm_alloc.cpp"
#include "../CrossPlatform/sigsegv.cpp"
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
dnl When cross-compiling, assume it works
ac_cv_have_skip_instruction="yes"

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/ether_windows.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/ether_windows.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/extfs_windows.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/kernel_windows.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/kernel_windows.h

View File

@ -44,7 +44,7 @@
#include "vm_alloc.h"
#include "sigsegv.h"
#include "util_windows.h"
#include "kernel_windows.h"
//#include "kernel_windows.h"
#define DEBUG 0
#include "debug.h"
@ -207,8 +207,8 @@ int main(int argc, char **argv)
if (!check_drivers())
QuitEmulator();
// Load win32 libraries
KernelInit();
// // Load win32 libraries
// KernelInit();
// FIXME: default to DIB driver
if (getenv("SDL_VIDEODRIVER") == NULL)
@ -446,8 +446,8 @@ static void Quit(void)
// Exit preferences
PrefsExit();
// Release win32 libraries
KernelExit();
// // Release win32 libraries
// KernelExit();
#ifdef ENABLE_MON
// Exit mon

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/posix_emu.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/posix_emu.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/prefs_editor_gtk.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/router

View File

@ -0,0 +1,12 @@
diff -ur downloads/SDL-1.2.15-orig/build-scripts/ltmain.sh downloads/SDL-1.2.15/build-scripts/ltmain.sh
--- downloads/SDL-1.2.15-orig/build-scripts/ltmain.sh 2017-01-15 20:57:25 -0800
+++ downloads/SDL-1.2.15/build-scripts/ltmain.sh 2017-01-15 21:00:16 -0800
@@ -2274,7 +2274,7 @@
if test -n "$current_libdirs"; then
# Maybe just do a dry run.
$opt_dry_run && current_libdirs=" -n$current_libdirs"
- exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
else
exit $EXIT_SUCCESS
fi

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/serial_windows.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/sys_windows.cpp

View File

@ -25,6 +25,8 @@
#error "Your compiler is not ANSI. Get a real one."
#endif
#define min(x,y) ((x) < (y) ? (x) : (y))
#include "config.h"
#include "user_strings_windows.h"
@ -32,11 +34,17 @@
#error "You don't have ANSI C header files."
#endif
#ifndef PASCAL
#define PASCAL
#endif
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <tchar.h>
#undef _TEXT
#include <time.h>
#ifdef __WIN32__
#include <windows.h>
@ -225,6 +233,7 @@ static inline uint64 tswap64(uint64 x) { return bswap_64(x); }
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
#if defined(__GNUC__)
#if 0
#define do_byteswap_16(x) \
(__extension__ \
({ register uint16 __v, __x = (x); \
@ -243,8 +252,19 @@ static inline uint64 tswap64(uint64 x) { return bswap_64(x); }
__v = do_byteswap_32_g(__x); \
__v; }))
#else
#define do_byteswap_16(x) do_byteswap_16_g(x)
#define do_byteswap_32(x) do_byteswap_32_g(x)
inline uint16 funyun_bswap_16(uint16 x)
{
return ((x & 0xff) << 8) | ((x >> 8) & 0xff);
}
#define do_byteswap_16(x) (funyun_bswap_16(x))
#define do_byteswap_32(x) (do_byteswap_32_g(x))
#endif
#else
#define do_byteswap_16(x) (do_byteswap_16_g((uint16)(x)))
#define do_byteswap_32(x) (do_byteswap_32_g(x))
#endif
#if defined(__i386__) || defined(__x86_64__)

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/timer_windows.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/util_windows.cpp

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/util_windows.h

View File

@ -1 +0,0 @@
../../../BasiliskII/src/Windows/xpram_windows.cpp

View File

@ -1 +0,0 @@
../../BasiliskII/src/adb.cpp

View File

@ -1 +0,0 @@
../../BasiliskII/src/audio.cpp

View File

@ -1 +0,0 @@
../../BasiliskII/src/cdrom.cpp

View File

@ -1 +0,0 @@
../../BasiliskII/src/disk.cpp

Some files were not shown because too many files have changed in this diff Show More