Skip to content

Commit

Permalink
fix debian build rules
Browse files Browse the repository at this point in the history
  • Loading branch information
timfel committed Dec 19, 2020
1 parent 4dc370b commit b15b6ba
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 125 deletions.
18 changes: 0 additions & 18 deletions CMakeLists.txt
Expand Up @@ -642,7 +642,6 @@ find_package(SDL2_mixer REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(Tolua++ REQUIRED)
find_package(ZLIB REQUIRED)
find_package(OpenMP)

if(WIN32)
find_package(MakeNSIS)
Expand All @@ -654,9 +653,6 @@ find_package(MNG)
find_package(OggVorbis)
find_package(Theora)

find_package(X11)

find_package(Sqlite)
find_package(Doxygen)
find_package(SelfPackers)

Expand Down Expand Up @@ -691,8 +687,6 @@ option(WITH_OGGVORBIS "Compile Stratagus with OGG/Vorbis sound library" ON)
option(WITH_THEORA "Compile Stratagus with Theroa video library" ON)
option(WITH_STACKTRACE "Compile Stratagus with StackTrace library" ON)

option(WITH_X11 "Compile Stratagus with X11 clipboard pasting support" ON)

option(ENABLE_DOC "Generate Stratagus source code documentation with Doxygen" OFF)
option(ENABLE_DEV "Install Stratagus game development headers files" OFF)
option(ENABLE_UPX "Compress Stratagus executable binary with UPX packer" OFF)
Expand Down Expand Up @@ -764,12 +758,6 @@ if(WITH_STACKTRACE AND STACKTRACE_FOUND)
set(stratagus_LIBS ${stratagus_LIBS} ${STACKTRACE_LIBRARY})
endif()

if(WITH_X11 AND X11_FOUND)
add_definitions(-DUSE_X11)
include_directories(${X11_INCLUDE_DIR})
set(stratagus_LIBS ${stratagus_LIBS} ${X11_X11_LIB})
endif()

# Platform definitions

if(WIN32)
Expand Down Expand Up @@ -1024,7 +1012,6 @@ log_package("Mng" "MNG")
log_package("Ogg/Vorbis" "OGGVORBIS")
log_package("StackTrace" "STACKTRACE")
log_package("Theora" "THEORA")
log_package("X11" "X11")

message("==================================")

Expand Down Expand Up @@ -1076,11 +1063,6 @@ else ()
endif ()
target_link_libraries(stratagus ${stratagus_LIBS})

if(OpenMP_CXX_FOUND)
target_compile_options(stratagus PRIVATE ${OpenMP_CXX_FLAGS})
target_link_libraries(stratagus OpenMP::OpenMP_CXX)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set_target_properties(stratagus PROPERTIES OUTPUT_NAME stratagus-dbg)
endif()
Expand Down
3 changes: 3 additions & 0 deletions HOWTO-NEW-RELEASE
Expand Up @@ -13,6 +13,9 @@ Increase version and update changelog for debian:
Update copyright information for Debian:
debian/copyright

It's a good idea to ensure the debian build works before taggging:
gbp buildpackage

Tag the new release in https://github.com/Wargus/win32-stratagus-dependencies
and wait for it to run through on the Appveyor CI. This will automatically
cause a release with the tag name to be created, and the windows dependencies
Expand Down
2 changes: 1 addition & 1 deletion debian/compat
@@ -1 +1 @@
7
9
8 changes: 3 additions & 5 deletions debian/control
Expand Up @@ -4,11 +4,9 @@ Priority: optional
Maintainer: cybermind <iddqd_mail@mail.ru>
Build-Depends: debhelper (>= 7), cmake (>= 2.6), doxygen,
imagemagick, sharutils, liblua5.1-dev | liblua5.1-0-dev, libtolua++5.1-dev,
zlib1g-dev, libbz2-dev, libpng12-dev (>= 1.2.5) | libpng-dev (>= 1.2.5),
libmng-dev, libmikmod2-dev, libogg-dev, libvorbis-dev, libtheora-dev,
libsdl1.2-dev (>> 1.2.2), libx11-dev, libsqlite3-dev,
libgles1-sgx-img-dev | libglu1-mesa-dev | libglu-dev | libgles1-mesa-dev,
libsdl-gles1.2-dev | libglu1-mesa-dev | libglu-dev, libfluidsynth-dev
zlib1g-dev, libbz2-dev, libsdl2-dev, libsdl2-image-dev, libsdl2-mixer-dev,
libogg-dev, libvorbis-dev, libtheora-dev, libmng-dev,
libpng12-dev (>= 1.2.5) | libpng-dev (>= 1.2.5)
Standards-Version: 3.9.6
Homepage: https://github.com/Wargus/stratagus
Vcs-Browser: https://github.com/Wargus/stratagus
Expand Down
2 changes: 1 addition & 1 deletion debian/source/format
@@ -1 +1 @@
3.0 (quilt)
3.0 (native)
6 changes: 0 additions & 6 deletions src/stratagus/mainloop.cpp
Expand Up @@ -357,12 +357,6 @@ static void DisplayLoop()
// program, as we now still have a game on the background and
// need to go through the game-menu or supply a map file
UpdateDisplay();

//
// If double-buffered mode, we will display the contains of
// VideoMemory. If direct mode this does nothing. In X11 it does
// XFlush
//
RealizeVideoMemory();
}
#ifdef REALVIDEO
Expand Down
3 changes: 0 additions & 3 deletions src/stratagus/stratagus.cpp
Expand Up @@ -342,9 +342,6 @@ static void PrintHeader()
#endif
#ifdef USE_MAC
"MAC "
#endif
#ifdef USE_X11
"X11 "
#endif
"";

Expand Down
97 changes: 8 additions & 89 deletions src/stratagus/util.cpp
Expand Up @@ -31,6 +31,8 @@

#include "util.h"

#include "SDL.h"

#include <ctype.h>
#include <errno.h>
#include <stdio.h>
Expand All @@ -49,11 +51,6 @@
#include "st_backtrace.h"
#endif

#ifdef USE_X11
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif

/*----------------------------------------------------------------------------
-- Random
----------------------------------------------------------------------------*/
Expand Down Expand Up @@ -384,92 +381,14 @@ int getopt(int argc, char *const *argv, const char *opts)
*/
int GetClipboard(std::string &str)
{
#if defined(USE_WIN32) || defined(USE_X11)
int i;
unsigned char *clipboard;
#ifdef USE_WIN32
HGLOBAL handle;
#elif defined(USE_X11)
Display *display;
Window window;
Atom rettype;
unsigned long nitem;
unsigned long dummy;
int retform;
XEvent event;
#endif

#ifdef USE_WIN32
if (!IsClipboardFormatAvailable(CF_TEXT) || !OpenClipboard(NULL)) {
return -1;
}
handle = GetClipboardData(CF_TEXT);
if (!handle) {
CloseClipboard();
return -1;
}
clipboard = (unsigned char *)GlobalLock(handle);
if (!clipboard) {
CloseClipboard();
return -1;
}
#elif defined(USE_X11)
if (!(display = XOpenDisplay(NULL))) {
return -1;
}

// Creates a non maped temporary X window to hold the selection
if (!(window = XCreateSimpleWindow(display,
DefaultRootWindow(display), 0, 0, 1, 1, 0, 0, 0))) {
XCloseDisplay(display);
return -1;
}

XConvertSelection(display, XA_PRIMARY, XA_STRING, XA_STRING,
window, CurrentTime);

XNextEvent(display, &event);

if (event.type != SelectionNotify || event.xselection.property != XA_STRING) {
return -1;
}

XGetWindowProperty(display, window, XA_STRING, 0, 1024, False,
XA_STRING, &rettype, &retform, &nitem, &dummy, &clipboard);

XDestroyWindow(display, window);
XCloseDisplay(display);

if (rettype != XA_STRING || retform != 8) {
if (clipboard != NULL) {
XFree(clipboard);
}
clipboard = NULL;
}

if (clipboard == NULL) {
char* txt = SDL_GetClipboardText();
if (txt) {
str = txt;
free(txt);
return 0;
} else {
return -1;
}
#endif
// Only allow ascii characters
for (i = 0; clipboard[i] != '\0'; ++i) {
if (clipboard[i] < 32 || clipboard[i] > 126) {
return -1;
}
}
str = (char *)clipboard;
#ifdef USE_WIN32
GlobalUnlock(handle);
CloseClipboard();
#elif defined(USE_X11)
if (clipboard != NULL) {
XFree(clipboard);
}
#endif
return 0;
#else
return -1;
#endif
}


Expand Down
4 changes: 2 additions & 2 deletions tools/genversion.cpp
Expand Up @@ -66,7 +66,7 @@ int main(int argc, char * argv[]) {
if ( file ) {
git_rev = (char*)calloc(sizeof(char), 1024);
if (fscanf(file, "ref: %s", git_rev) != 1 ) {
fscanf(file, "%s", git_rev);
int ignored = fscanf(file, "%s", git_rev);
}
fclose(file);
gitrevfile = (char*)calloc(sizeof(char), strlen(git_rev) + 6);
Expand All @@ -75,7 +75,7 @@ int main(int argc, char * argv[]) {
free(gitrevfile);
if (file) {
git_rev = (char*)calloc(sizeof(char), 1024);
fscanf(file, "%s", git_rev);
int ignored = fscanf(file, "%s", git_rev);
fclose(file);
}
} else {
Expand Down

0 comments on commit b15b6ba

Please sign in to comment.