Ticket #5157: slackware_pkgconfig_v1.patch

File slackware_pkgconfig_v1.patch, 6.9 KB (added by s0600204, 6 years ago)

Prospective patch to resolve over-inclusion of contents of /usr/include

  • build/premake/extern_libs5.lua

    diff --git a/build/premake/extern_libs5.lua b/build/premake/extern_libs5.lua
    index 6807dc7e0..c4002a50b 100644
    a b extern_lib_defs = {  
    262262        compile_settings = function()
    263263            if os.istarget("windows") then
    264264                add_default_include_paths("gloox")
    265             elseif os.istarget("macosx") then
    266                 -- Support GLOOX_CONFIG for overriding the default PATH-based gloox-config
     265            elseif not _OPTIONS["android"] then
     266                -- Support GLOOX_CONFIG for overriding the default (pkg-config --cflags gloox)
     267                -- i.e. on OSX where it gets set in update-workspaces.sh
    267268                gloox_config_path = os.getenv("GLOOX_CONFIG")
    268                 if not gloox_config_path then
    269                     gloox_config_path = "gloox-config"
    270                 end
    271                 pkgconfig.add_includes(nil, gloox_config_path.." --cflags")
     269                if gloox_config_path then
     270                    pkgconfig.add_includes(nil, gloox_config_path.." --cflags")
     271                else
     272                    pkgconfig.add_includes("gloox")
     273                end
    272274            end
    273275        end,
    274276        link_settings = function()
    275277            if os.istarget("windows") then
    276278                add_default_lib_paths("gloox")
    277             end
    278             if os.istarget("macosx") then
    279                 gloox_config_path = os.getenv("GLOOX_CONFIG")
    280                 if not gloox_config_path then
    281                     gloox_config_path = "gloox-config"
    282                 end
    283                 pkgconfig.add_links(nil, gloox_config_path.." --libs")
    284             else
    285                 -- TODO: consider using pkg-config on non-Windows (for compile_settings too)
    286279                add_default_links({
    287280                    win_names  = { "gloox-1.0" },
    288                     unix_names = { "gloox" },
    289281                    no_delayload = 1,
    290282                })
     283            elseif not _OPTIONS["android"] then
     284                gloox_config_path = os.getenv("GLOOX_CONFIG")
     285                if gloox_config_path then
     286                    pkgconfig.add_links(nil, gloox_config_path.." --libs")
     287                else
     288                    pkgconfig.add_links("gloox")
     289                end
    291290            end
    292291        end,
    293292    },
    extern_lib_defs = {  
    540539            if os.istarget("windows") then
    541540                includedirs { libraries_dir .. "sdl2/include/SDL" }
    542541            elseif not _OPTIONS["android"] then
    543                 -- Support SDL2_CONFIG for overriding the default PATH-based sdl2-config
     542                -- Support SDL2_CONFIG for overriding the default (pkg-config sdl2)
     543                -- i.e. on OSX where it gets set in update-workspaces.sh
    544544                sdl_config_path = os.getenv("SDL2_CONFIG")
    545                 if not sdl_config_path then
    546                     sdl_config_path = "sdl2-config"
     545                if sdl_config_path then
     546                    pkgconfig.add_includes(nil, sdl_config_path.." --cflags")
     547                else
     548                    pkgconfig.add_includes("sdl2")
    547549                end
    548 
    549                 pkgconfig.add_includes(nil, sdl_config_path.." --cflags")
    550550            end
    551551        end,
    552552        link_settings = function()
    extern_lib_defs = {  
    554554                add_default_lib_paths("sdl2")
    555555            elseif not _OPTIONS["android"] then
    556556                sdl_config_path = os.getenv("SDL2_CONFIG")
    557                 if not sdl_config_path then
    558                     sdl_config_path = "sdl2-config"
     557                if sdl_config_path then
     558                    pkgconfig.add_links(nil, sdl_config_path.." --libs")
     559                else
     560                    pkgconfig.add_links("sdl2")
    559561                end
    560                 pkgconfig.add_links(nil, sdl_config_path.." --libs")
    561562            end
    562563        end,
    563564    },
    extern_lib_defs = {  
    684685        end,
    685686    },
    686687    x11 = {
     688        compile_settings = function()
     689            if not os.istarget("windows") and not os.istarget("macosx") then
     690                pkgconfig.add_includes("x11")
     691            end
     692        end,
    687693        link_settings = function()
    688             add_default_links({
    689                 win_names  = { },
    690                 unix_names = { "X11" },
    691             })
     694            if not os.istarget("windows") and not os.istarget("macosx") then
     695                pkgconfig.add_links("x11")
     696            end
    692697        end,
    693698    },
    694699    xcursor = {
  • build/premake/premake5.lua

    diff --git a/build/premake/premake5.lua b/build/premake/premake5.lua
    index 36928fb29..de8f858c4 100644
    a b function project_set_build_flags()  
    367367    end
    368368end
    369369
    370 -- add X11 includes paths after all the others so they don't conflict with
    371 -- bundled libs
    372 function project_add_x11_dirs()
    373     if not os.istarget("windows") and not os.istarget("macosx") then
    374         -- X11 includes may be installed in one of a gadzillion of five places
    375         -- Famous last words: "You can't include too much! ;-)"
    376         sysincludedirs {
    377             "/usr/X11R6/include/X11",
    378             "/usr/X11R6/include",
    379             "/usr/local/include/X11",
    380             "/usr/local/include",
    381             "/usr/include/X11"
    382         }
    383         libdirs { "/usr/X11R6/lib" }
    384     end
    385 end
    386 
    387370-- create a project and set the attributes that are common to all projects.
    388371function project_create(project_name, target_type)
    389372
    function setup_static_lib_project (project_name, rel_source_dirs, extern_libs, e  
    528511    project_create(project_name, target_type)
    529512    project_add_contents(source_root, rel_source_dirs, {}, extra_params)
    530513    project_add_extern_libs(extern_libs, target_type)
    531     project_add_x11_dirs()
    532514
    533515    if not extra_params["no_default_link"] then
    534516        table.insert(static_lib_names, project_name)
    function setup_shared_lib_project (project_name, rel_source_dirs, extern_libs, e  
    551533    project_create(project_name, target_type)
    552534    project_add_contents(source_root, rel_source_dirs, {}, extra_params)
    553535    project_add_extern_libs(extern_libs, target_type)
    554     project_add_x11_dirs()
    555536
    556537    if not extra_params["no_default_link"] then
    557538        table.insert(static_lib_names, project_name)
    function setup_main_exe ()  
    961942    }
    962943    project_add_contents(source_root, {}, {}, extra_params)
    963944    project_add_extern_libs(used_extern_libs, target_type)
    964     project_add_x11_dirs()
    965945
    966946    dependson { "Collada" }
    967947
    function setup_atlas_project(project_name, target_type, rel_source_dirs, rel_inc  
    10571037
    10581038    project_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params)
    10591039    project_add_extern_libs(extern_libs, target_type)
    1060     project_add_x11_dirs()
    10611040
    10621041    -- Platform Specifics
    10631042    if os.istarget("windows") then
    function setup_atlas_frontend_project (project_name)  
    11801159
    11811160    local target_type = get_main_project_target_type()
    11821161    project_create(project_name, target_type)
    1183     project_add_x11_dirs()
    11841162
    11851163    local source_root = rootdir.."/source/tools/atlas/AtlasFrontends/"
    11861164    files { source_root..project_name..".cpp" }
    function setup_collada_project(project_name, target_type, rel_source_dirs, rel_i  
    12201198    extra_params["pch_dir"] = source_root
    12211199    project_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params)
    12221200    project_add_extern_libs(extern_libs, target_type)
    1223     project_add_x11_dirs()
    12241201
    12251202    -- Platform Specifics
    12261203    if os.istarget("windows") then
    function setup_tests()  
    13641341
    13651342    project_add_contents(source_root, {}, {}, extra_params)
    13661343    project_add_extern_libs(used_extern_libs, target_type)
    1367     project_add_x11_dirs()
    13681344
    13691345    dependson { "Collada" }
    13701346
  • source/lib/sysdep/os/unix/x/x.cpp

    diff --git a/source/lib/sysdep/os/unix/x/x.cpp b/source/lib/sysdep/os/unix/x/x.cpp
    index e7649cd6e..a3e199f5b 100644
    a b  
    4141
    4242#define Cursor X__Cursor
    4343
    44 #include <Xlib.h>
     44#include <X11/Xlib.h>
    4545#include <stdlib.h>
    46 #include <Xatom.h>
    47 #include <Xcursor/Xcursor.h>
     46#include <X11/Xatom.h>
     47#include <X11/Xcursor/Xcursor.h>
    4848
    4949#include "SDL.h"
    5050#include "SDL_syswm.h"