From: Jean Privat Date: Mon, 20 Mar 2017 20:08:59 +0000 (-0400) Subject: Merge: Docker, portability and crosscompiling tweaks X-Git-Url: http://nitlanguage.org?hp=f36e6258419d1af1b83599dc5ef43dfd5ecfaad4 Merge: Docker, portability and crosscompiling tweaks * Add the missing SDL2 package (since #2376) to the full DockerFile. * Fix a warning raised by the C compiler when called by niti on 32 bits platforms. * Clean up Makefile generation and enable using environment variables to override the default C compiler, C++ compiler, CFLAGS and whether or not to use libunwind. Making it possible to change the compiler for cross compilation and to skip linking with libunwind to create binaries compatible with more GNU/Linux systems. Pull-Request: #2390 Reviewed-by: Romain Chanoir --- diff --git a/lib/core/kernel.nit b/lib/core/kernel.nit index fa7b6f4..a821006 100644 --- a/lib/core/kernel.nit +++ b/lib/core/kernel.nit @@ -1063,7 +1063,7 @@ extern class Pointer fun free `{ free(self); `} # Use the address value - redef fun hash `{ return (long)self; `} + redef fun hash `{ return (long)(intptr_t)self; `} # Is equal to any instance pointing to the same address redef fun ==(o) do return o isa Pointer and native_equals(o) diff --git a/misc/docker/full/Dockerfile b/misc/docker/full/Dockerfile index 2efb5d3..10bb9f6 100644 --- a/misc/docker/full/Dockerfile +++ b/misc/docker/full/Dockerfile @@ -20,6 +20,7 @@ RUN dpkg --add-architecture i386 \ libsdl-ttf2.0-dev \ libsdl1.2-dev \ libsdl2-dev \ + libsdl2-image-dev \ libsqlite3-dev \ libx11-dev \ libxdg-basedir-dev \ diff --git a/src/compiler/abstract_compiler.nit b/src/compiler/abstract_compiler.nit index 11ff040..4ce8024 100644 --- a/src/compiler/abstract_compiler.nit +++ b/src/compiler/abstract_compiler.nit @@ -349,14 +349,21 @@ class MakefileToolchain end var debug = toolcontext.opt_debug.value - makefile.write("CC = ccache cc\nCXX = ccache c++\nCFLAGS = -g{ if not debug then " -O2 " else " "}-Wno-unused-value -Wno-switch -Wno-attributes -Wno-trigraphs\nCINCL =\nLDFLAGS ?= \nLDLIBS ?= -lm {linker_options.join(" ")}\n\n") + makefile.write """ +CC ?= ccache cc +CXX ?= ccache c++ +CFLAGS ?= -g {{{if not debug then "-O2" else ""}}} -Wno-unused-value -Wno-switch -Wno-attributes -Wno-trigraphs +CINCL = +LDFLAGS ?= +LDLIBS ?= -lm {{{linker_options.join(" ")}}} +\n""" makefile.write "\n# SPECIAL CONFIGURATION FLAGS\n" if platform.supports_libunwind then if toolcontext.opt_no_stacktrace.value then - makefile.write "NO_STACKTRACE=True" + makefile.write "NO_STACKTRACE ?= True" else - makefile.write "NO_STACKTRACE= # Set to `True` to enable" + makefile.write "NO_STACKTRACE ?= # Set to `True` to enable" end end