From 44818598987a51dd2a8a4a522b4a60cca48876de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 1 Sep 2016 21:44:40 +0200 Subject: [PATCH] Fix Launchpad builds --- CMakeLists.txt | 19 +++++++++++++++---- debian/control | 4 ++-- debian/rules | 10 ++++------ src/addresses.h | 8 +++++++- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c312452b5..3abd48bf87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,9 +80,21 @@ option(FORCE64 "Force native (x86-64) build. Do not use, for experimental purpos option(DISABLE_OPENGL "Disable OpenGL support.") option(DISABLE_RCT2 "WIP: Try building without using code and data segments from vanilla.") option(USE_MMAP "Use mmap to try loading rct2's data segment into memory.") +option(LAUNCHPAD_BUILD "Sets some build system options on launchpad.net") + +if (LAUNCHPAD_BUILD) + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=pointer-to-int-cast -Wno-error=int-to-pointer-cast") + endif() +else() + if (FORCE64) + set(TARGET_M "-m64") + else () + set(TARGET_M "-m32") + endif() +endif() if (FORCE64) - set(TARGET_M "-m64") set(OBJ_FORMAT "elf64-x86-64") set(LINKER_SCRIPT "ld_script_x86_64.xc") if ((APPLE OR WIN32) AND NOT USE_MMAP) @@ -90,7 +102,6 @@ if (FORCE64) set(USE_MMAP ON) endif() else () - set(TARGET_M "-m32") set(OBJ_FORMAT "elf32-i386") set(LINKER_SCRIPT "ld_script_i386.xc") endif () @@ -203,8 +214,8 @@ if (APPLE) endif (APPLE) # set necessary flags to compile code as is -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_M} -std=gnu99 -fno-pie -fstrict-aliasing -Werror -Wundef -Wmissing-declarations") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_M} -std=gnu++11 -fno-pie -fstrict-aliasing -Werror -Wundef -Wmissing-declarations") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TARGET_M} -std=gnu99 -fno-pie -fstrict-aliasing -Werror -Wno-error=date-time -Wundef -Wmissing-declarations") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TARGET_M} -std=gnu++11 -fno-pie -fstrict-aliasing -Werror -Wno-error=date-time -Wundef -Wmissing-declarations") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${TARGET_M}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}") diff --git a/debian/control b/debian/control index ee42fe1764..562e118de3 100644 --- a/debian/control +++ b/debian/control @@ -4,10 +4,10 @@ Section: misc Priority: optional Standards-Version: 3.9.2 Multi-Arch: same -Build-Depends: debhelper (>= 9), cmake, libsdl2-dev, libsdl2-ttf-dev, gcc, pkg-config, g++-multilib, gcc-multilib, libjansson4 (>= 2.7), libjansson-dev (>= 2.7), libspeex-dev, libspeexdsp-dev, libcurl4-openssl-dev, libcrypto++-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev +Build-Depends: debhelper (>= 9), cmake, libsdl2-dev, libsdl2-ttf-dev, gcc, pkg-config, libjansson4 (>= 2.7), libjansson-dev (>= 2.7), libspeex-dev, libspeexdsp-dev, libcurl4-openssl-dev, libcrypto++-dev, libfontconfig1-dev, libfreetype6-dev, libpng-dev, libssl-dev Package: openrct2 -Architecture: i386 +Architecture: any Homepage: https://openrct2.website/ Vcs-Browser: https://github.com/OpenRCT2/OpenRCT2 Vcs-Git: https://github.com/OpenRCT2/OpenRCT2 diff --git a/debian/rules b/debian/rules index a3bada8c8f..7ddf0ea4e2 100755 --- a/debian/rules +++ b/debian/rules @@ -2,12 +2,10 @@ BUILDDIR=build_dir -build: - scripts/linux/install.sh - mkdir $(BUILDDIR) - cd $(BUILDDIR); cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .. - make -C $(BUILDDIR) - touch build +extra_flags := $(if $(filter i386,$(DEB_HOST_ARCH)),"-DLAUNCHPAD_BUILD=on","-DLAUNCHPAD_BUILD=on -DUSE_MMAP=on -DDISABLE_RCT2=on") + +override_dh_auto_configure: + dh_auto_configure -a -- $(extra_flags) %: dh $@ diff --git a/src/addresses.h b/src/addresses.h index 914f36a907..21cf8f82c5 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -24,7 +24,13 @@ #endif #ifdef USE_MMAP - #define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x200000000) + #if defined(PLATFORM_64BIT) + #define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x200000000) + #elif defined(PLATFORM_32BIT) + #define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x09000000) + #else + #error "Unknown platform" + #endif #else #define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x8a4000) #endif