Skip to content

Instantly share code, notes, and snippets.

@Quipyowert2
Created February 4, 2023 06:04
Show Gist options
  • Select an option

  • Save Quipyowert2/d2e1d3077efdbbc6b161a505445f1bce to your computer and use it in GitHub Desktop.

Select an option

Save Quipyowert2/d2e1d3077efdbbc6b161a505445f1bce to your computer and use it in GitHub Desktop.

Revisions

  1. Quipyowert2 created this gist Feb 4, 2023.
    93 changes: 93 additions & 0 deletions SConstruct-changes-for-msys2.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,93 @@
    diff --git a/SConstruct b/SConstruct
    index 8476b3a4..81963e6b 100644
    --- a/SConstruct
    +++ b/SConstruct
    @@ -140,7 +140,7 @@ def configure(env, server_only):
    print("Could not find libboost_date_time or libboost_date_time-mt or boost/thread/thread.hpp")
    missing.append("libboost_date_time")
    env.Append(LIBS=[boost_date_time])
    - env.Append(LIBS=["boost_system", "pthread"])
    + env.Append(LIBS=["pthread"])


    if not conf.CheckCXXHeader("boost/shared_ptr.hpp"):
    @@ -240,7 +240,7 @@ def main():
    AddOption('--build',
    default='build',
    help='build directory')
    - env = Environment()
    + env = Environment(tools=['mingw'])
    env["VERSION"] = "0.9.5.0"
    establish_options(env)

    @@ -251,6 +251,12 @@ def main():
    env['AR'] = 'i586-mingw32msvc-ar'
    env['RANLIB'] = 'i586-mingw32msvc-ranlib'

    + if env['mingw']:
    + env.Platform('cygwin')
    + env['CC'] = "/mingw64/bin/gcc.exe"
    + env['CXX'] = "/mingw64/bin/g++.exe"
    + env['AR'] = "/mingw64/bin/ar.exe"
    + env['RANLIB'] = "/mingw64/bin/ranlib.exe"
    try:
    env.Clone()
    except AttributeError:
    @@ -259,10 +264,13 @@ def main():

    # Add specific paths.
    if env['mingw'] or isWindowsPlatform:
    - env.Append(LIBPATH=["C:/msys/1.0/local/lib", "C:/msys/1.0/lib"])
    + #env.Append(LIBPATH=["C:/msys/1.0/local/lib", "C:/msys/1.0/lib"])
    env.Append(LIBPATH=['/usr/local/lib'])
    - env.Append(CPPPATH=["C:/msys/1.0/local/include/SDL", "C:/msys/1.0/local/include", "C:/msys/1.0/include/SDL", "C:/msys/1.0/include"])
    + #env.Append(CPPPATH=["C:/msys/1.0/local/include/SDL", "C:/msys/1.0/local/include", "C:/msys/1.0/include/SDL", "C:/msys/1.0/include"])
    env.Append(CPPPATH=['/usr/local/include/SDL'])
    + env.Append(LIBPATH=["/mingw64/lib"])
    + env.Append(CPPPATH=["/mingw64/include", "/mingw64/include/SDL2"])
    + #env.Append(CPPPATH=["/mingw64/include", "/mingw64/include/SDL2", "/usr/include/w32api", "/mingw64/x86_64-w64-mingw32/include"])
    if isDarwinPlatform:
    env.Append(LIBPATH=["/opt/local/lib"])
    env.Append(CPPPATH=["/opt/local/include"])
    @@ -299,7 +307,9 @@ def main():
    env.Append(LINKFLAGS='-O3')
    if env['mingw'] or isWindowsPlatform or env['mingwcross']:
    # TODO: Remove unneccessary dependencies for server.
    - env.Append(LIBS=['vorbis', 'ogg', 'regex', 'wsock32', 'winmm', 'mingw32', 'SDLmain', 'SDL'])
    + env.ParseConfig("/mingw64/bin/sdl2-config --cflags")
    + env.ParseConfig("/mingw64/bin/sdl2-config --libs")
    + env.Append(LIBS=['vorbis', 'ogg', 'pcreposix', 'wsock32', 'winmm', 'mingw32', 'SDL2'])
    env.Append(LINKFLAGS=['-mwindows'])
    env.Append(CPPDEFINES=['-D_GNU_SOURCE=1', '-Dmain=SDL_main'])
    elif isDarwinPlatform:
    diff --git a/src/IRC.h b/src/IRC.h
    index 35661bd6..6c78a62b 100644
    --- a/src/IRC.h
    +++ b/src/IRC.h
    @@ -29,11 +29,13 @@
    #include <string>
    #include <map>

    +#if 0
    #ifdef WIN32
    #define snprintf _snprintf
    #define vsnprintf _vsnprintf
    #define strcasecmp _stricmp
    #endif
    +#endif


    //! This class is an IRC client
    diff --git a/src/SConscript b/src/SConscript
    index a45034e0..56c4dfe1 100644
    --- a/src/SConscript
    +++ b/src/SConscript
    @@ -253,7 +253,7 @@ YOGServerRouterPlayer.cpp
    Import('env')
    local = env.Clone()
    if env["mingw"] or env['PLATFORM'] == 'win32':
    - source_files.extend(["C:/msys/1.0/local/lib/libvorbisfile.a", "C:/msys/1.0/local/lib/libvorbis.a", "C:/msys/1.0/local/lib/libogg.a"])
    + source_files.extend(["/mingw64/lib/libvorbisfile.a", "/mingw64/lib/libvorbis.a", "/mingw64/lib/libogg.a"])
    #Add libgag and USL, not as a library, but as an object
    source_files.append("../libgag/src/libgag.a")
    source_files.append("../libusl/src/libusl.a")