Merge: Pkgconfig
authorJean Privat <jean@pryen.org>
Tue, 4 Nov 2014 20:08:20 +0000 (15:08 -0500)
committerJean Privat <jean@pryen.org>
Tue, 4 Nov 2014 20:08:20 +0000 (15:08 -0500)
Generalize the usage of pkg-config so that this command is executed by the Makefile and not the nitg compiler.

This will improve the portability of programs when the .nit_compile directory is distributed.
And thus, the initial bootstrap with `c_src`.

This is a first step toward the resolution of #864.

Pull-Request: #874
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

1  2 
src/compiler/abstract_compiler.nit

@@@ -196,8 -230,8 +196,9 @@@ class MakefileToolchai
  
                # Add gc_choser.h to aditionnal bodies
                var gc_chooser = new ExternCFile("gc_chooser.c", cc_opt_with_libgc)
+               if cc_opt_with_libgc != "" then gc_chooser.pkgconfigs.add "bdw-gc"
                compiler.extern_bodies.add(gc_chooser)
 +              var clib = toolcontext.nit_dir / "clib"
                compiler.files_to_copy.add "{clib}/gc_chooser.c"
                compiler.files_to_copy.add "{clib}/gc_chooser.h"
  
                        if libs != null then linker_options.add_all(libs)
                end
  
-               makefile.write("CC = ccache cc\nCXX = ccache c++\nCFLAGS = -g -O2 -Wno-unused-value -Wno-switch\nCINCL =\nLDFLAGS ?= \nLDLIBS  ?= -lm `pkg-config --libs bdw-gc` {linker_options.join(" ")}\n\n")
 -              makefile.write("CC = ccache cc\nCXX = ccache c++\nCFLAGS = -g -O2 -Wno-unused-value -Wno-switch\nCINCL = {cc_includes}\nLDFLAGS ?= \nLDLIBS  ?= -lm {linker_options.join(" ")}\n\n")
++              makefile.write("CC = ccache cc\nCXX = ccache c++\nCFLAGS = -g -O2 -Wno-unused-value -Wno-switch\nCINCL =\nLDFLAGS ?= \nLDLIBS  ?= -lm {linker_options.join(" ")}\n\n")
  
                var ost = toolcontext.opt_stacktrace.value
                if (ost == "libunwind" or ost == "nitstack") and (platform == null or platform.supports_libunwind) then makefile.write("NEED_LIBUNWIND := YesPlease\n")