From 78156d46d348350a06cca09fef66b8a8b5b76499 Mon Sep 17 00:00:00 2001 From: eroen Date: Tue, 27 Jan 2015 01:10:54 +0100 Subject: libgraphics-40.24 - regenerate egg patch Patched files changed line endings. :-( - Add ewarn for gcc-4.9, crashes on startup with unresolved symbol. --- .../libgraphics-40.24-Add-something-eggy.patch | 129 +++++++++++++++++++++ dev-libs/libgraphics/libgraphics-40.24.ebuild | 104 ++++++++++++++++- 2 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 dev-libs/libgraphics/files/libgraphics-40.24-Add-something-eggy.patch mode change 120000 => 100644 dev-libs/libgraphics/libgraphics-40.24.ebuild (limited to 'dev-libs') diff --git a/dev-libs/libgraphics/files/libgraphics-40.24-Add-something-eggy.patch b/dev-libs/libgraphics/files/libgraphics-40.24-Add-something-eggy.patch new file mode 100644 index 0000000..39f1bee --- /dev/null +++ b/dev-libs/libgraphics/files/libgraphics-40.24-Add-something-eggy.patch @@ -0,0 +1,129 @@ +diff -urN a/df_linux/g_src/eggy.h b/df_linux/g_src/eggy.h +--- a/df_linux/g_src/eggy.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/df_linux/g_src/eggy.h 2015-01-27 01:18:51.056581660 +0100 +@@ -0,0 +1,23 @@ ++#pragma once ++#ifdef unix ++ #define EggyExport extern "C" __attribute__ ((visibility("default"))) ++#else ++ #ifdef egg_internal ++ #define EggyExport extern "C" __declspec(dllexport) ++ #else ++ #define EggyExport extern "C" __declspec(dllimport) ++ #endif ++#endif ++ ++// hook - called before rendering ++EggyExport int egg_init(void); ++// hook - called before rendering ++EggyExport int egg_shutdown(void); ++// hook - called for each game tick (or more often) ++EggyExport int egg_tick(void); ++// hook - called before rendering ++EggyExport int egg_prerender(void); ++// hook - called for each SDL event, returns 0 when the event has been consumed. 1 otherwise ++EggyExport int egg_sdl_event(void* event); ++// hook - ncurses event, -1 signifies error. ++EggyExport int egg_curses_event(int orig_return); +\ No newline at end of file +diff -urN a/df_linux/g_src/enabler.cpp b/df_linux/g_src/enabler.cpp +--- a/df_linux/g_src/enabler.cpp 2015-01-07 21:14:50.000000000 +0100 ++++ b/df_linux/g_src/enabler.cpp 2015-01-27 01:18:51.056581660 +0100 +@@ -11,6 +11,7 @@ + #include "random.h" + #include "init.h" + #include "music_and_sound_g.h" ++#include "eggy.h" + + #ifdef unix + # include +@@ -346,7 +347,7 @@ + if (async_frames < 0) async_frames = 0; + update_fps(); + } +- SDL_NumJoysticks(); // Hook for dfhack ++ egg_tick(); // Hook for dfhack + } + } + +@@ -433,6 +434,8 @@ + + // Check for SDL events + while (SDL_PollEvent(&event)) { ++ if(!egg_sdl_event(&event)) ++ continue; + // Make sure mainloop isn't running while we're processing input + if (!paused_loop) { + pause_async_loop(); +@@ -574,6 +577,8 @@ + } else { + renderer = new renderer_opengl(); + } ++ // Tell the egg that we are ready to roll ++ egg_init(); + + // At this point we should have a window that is setup to render DF. + if (init.display.flag.has_flag(INIT_DISPLAY_FLAG_TEXT)) { +@@ -584,6 +589,8 @@ + SDL_EnableUNICODE(1); + eventLoop_SDL(); + } ++ // Tell egg to leave ++ egg_shutdown(); + + endroutine(); + +diff -urN a/df_linux/g_src/graphics.cpp b/df_linux/g_src/graphics.cpp +--- a/df_linux/g_src/graphics.cpp 2015-01-07 21:14:50.000000000 +0100 ++++ b/df_linux/g_src/graphics.cpp 2015-01-27 01:18:53.967607461 +0100 +@@ -17,6 +17,8 @@ + #include "svector.h" + #include "ttf_manager.hpp" + ++#include "eggy.h" ++ + #ifdef WIN32 + + /* +@@ -563,4 +565,6 @@ + fps_locator(fps.size()); + gps.addst(fps); + } ++ // tell egg to do its dirty obscure things ++ egg_prerender(); + } +diff -urN a/df_linux/g_src/renderer_curses.cpp b/df_linux/g_src/renderer_curses.cpp +--- a/df_linux/g_src/renderer_curses.cpp 2015-01-07 21:14:50.000000000 +0100 ++++ b/df_linux/g_src/renderer_curses.cpp 2015-01-27 01:18:55.784623565 +0100 +@@ -1,3 +1,5 @@ ++#include "eggy.h" ++ + static bool curses_initialized = false; + + static void endwin_void() { +@@ -134,17 +136,23 @@ + } + }; + ++static int eggy_getch_wrapper() ++{ ++ int byte = wgetch(*stdscr_p); ++ return egg_curses_event(byte); ++} ++ + // Reads from getch, collapsing utf-8 encoding to the actual unicode + // character. Ncurses symbols (left arrow, etc.) are returned as + // positive values, unicode as negative. Error returns 0. + static int getch_utf8() { +- int byte = wgetch(*stdscr_p); ++ int byte = eggy_getch_wrapper(); + if (byte == ERR) return 0; + if (byte > 0xff) return byte; + int len = decode_utf8_predict_length(byte); + if (!len) return 0; + string input(len,0); input[0] = byte; +- for (int i = 1; i < len; i++) input[i] = wgetch(*stdscr_p); ++ for (int i = 1; i < len; i++) input[i] = eggy_getch_wrapper(); + return -decode_utf8(input); + } + diff --git a/dev-libs/libgraphics/libgraphics-40.24.ebuild b/dev-libs/libgraphics/libgraphics-40.24.ebuild deleted file mode 120000 index d5126d0..0000000 --- a/dev-libs/libgraphics/libgraphics-40.24.ebuild +++ /dev/null @@ -1 +0,0 @@ -libgraphics-40.06.ebuild \ No newline at end of file diff --git a/dev-libs/libgraphics/libgraphics-40.24.ebuild b/dev-libs/libgraphics/libgraphics-40.24.ebuild new file mode 100644 index 0000000..9c1f8a7 --- /dev/null +++ b/dev-libs/libgraphics/libgraphics-40.24.ebuild @@ -0,0 +1,103 @@ +# By Eroen, 2012-2014 +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# $Header: $ + +EAPI=5 + +inherit scons-utils toolchain-funcs versionator multilib games + +DESCRIPTION="General purpose library used by dwarffortress" +HOMEPAGE="http://www.bay12games.com/dwarves + http://github.com/Baughn/Dwarf-Fortress--libgraphics-" +SRC_URI="http://www.bay12games.com/dwarves/df_${PV//./_}_linux.tar.bz2" + +LICENSE="BSD" +SLOT=${PV} +KEYWORDS="~amd64" # ~x86 +IUSE="egg" + +HDEPEND="virtual/pkgconfig" +LIBDEPEND=" + || ( media-libs/glew[abi_x86_32] + ( media-libs/glew + app-emulation/emul-linux-x86-opengl ) ) + || ( virtual/glu[abi_x86_32] + ( virtual/glu + app-emulation/emul-linux-x86-opengl ) ) + || ( media-libs/libsdl[abi_x86_32] + ( media-libs/libsdl + app-emulation/emul-linux-x86-sdl ) ) + || ( media-libs/libsndfile[abi_x86_32] + ( media-libs/libsndfile + app-emulation/emul-linux-x86-soundlibs ) ) + || ( media-libs/openal[abi_x86_32] + ( media-libs/openal + app-emulation/emul-linux-x86-sdl ) ) + || ( media-libs/sdl-image[abi_x86_32] + ( media-libs/sdl-image + app-emulation/emul-linux-x86-sdl ) ) + || ( media-libs/sdl-ttf[abi_x86_32] + ( media-libs/sdl-ttf + app-emulation/emul-linux-x86-sdl ) ) + || ( sys-libs/ncurses[abi_x86_32] + ( sys-libs/ncurses + app-emulation/emul-linux-x86-baselibs ) ) + || ( sys-libs/zlib[abi_x86_32] + ( sys-libs/zlib + app-emulation/emul-linux-x86-baselibs ) ) + || ( x11-libs/gtk+:2[abi_x86_32] + ( x11-libs/gtk+:2 + app-emulation/emul-linux-x86-gtklibs ) ) + egg? ( games-util/dfhack:${SLOT}[egg] ) + " +RDEPEND="${LIBDEPEND}" +DEPEND="${HDEPEND} + ${LIBDEPEND} + " + +S=${WORKDIR}/df_linux + +pkg_setup() { + if use egg && version_is_at_least 4.9 $(gcc-version); then + ewarn "gcc-4.9 and ${PN} with USE=egg seems incompatible." + ewarn "If you experience problems, try disabling all compiler" + ewarn "optimization or switching to an earlier gcc version." + fi + + multilib_toolchain_setup x86 + games_pkg_setup + + df_LIBPATH=$(games_get_libdir)/dwarffortress-${SLOT} +} + +src_prepare() { + rm -r data raw || die + rm g_src/{find_files.cpp,music_and_sound_fmodex.cpp,music_and_sound_fmodex.h} \ + g_src/template.h || die + rm libs/{Dwarf_Fortress,libgcc_s.so.1,libgraphics.so,libstdc++.so.6} || die + + if use egg; then + epatch "${FILESDIR}"/${PN}-40.24-Add-something-eggy.patch + cp "${FILESDIR}/SConscript-egg" "g_src/SConscript" || die + else + cp "${FILESDIR}/SConscript" "g_src/SConscript" || die + fi + cp "${FILESDIR}/SConstruct" "SConstruct" || die +} + +src_compile() { + LIBPATH="${df_LIBPATH}" escons +} + +src_install() { + # libgraphics lacks SONAME, so we keep it out of system libdir. + exeinto "${df_LIBPATH}" + doexe "libs/libgraphics.so" + prepgamesdirs + # userpriv: portage user will need to link against libraries here. + fperms o+rx "${df_LIBPATH}" +} -- cgit v1.2.3-65-gdbad