Ticket #1516: 0ad-r11339-trac-1421.patch

File 0ad-r11339-trac-1421.patch, 8.3 KB (added by pcpa, 12 years ago)

Rediffed as I understood it, for (late) feedback of #1421 comment, and it works in not adding rpath in a rpm build

  • 0ad-r11863-alpha/build/premake/premake4.lua

    diff -up 0ad-r11863-alpha/build/premake/premake4.lua.orig 0ad-r11863-alpha/build/premake/premake4.lua
    old new newoption { trigger = "icc", description  
    77newoption { trigger = "outpath", description = "Location for generated project files" }
    88newoption { trigger = "without-fam", description = "Disable use of FAM API on Linux" }
    99newoption { trigger = "without-audio", description = "Disable use of OpenAL/Ogg/Vorbis APIs" }
     10newoption { trigger = "minimal-flags", description = "Only set compiler/linker flags that are really needed" }
    1011newoption { trigger = "without-nvtt", description = "Disable use of NVTT" }
    1112newoption { trigger = "without-tests", description = "Disable generation of test projects" }
    1213newoption { trigger = "without-pch", description = "Disable generation and usage of precompiled headers" }
    end  
    135136function project_set_build_flags()
    136137
    137138    flags { "Symbols", "NoEditAndContinue" }
    138     if not _OPTIONS["icc"] then
     139    if not _OPTIONS["icc"] and not _OPTIONS["minimal-flags"] then
    139140        -- adds the -Wall compiler flag
    140141        flags { "ExtraWarnings" } -- this causes far too many warnings/remarks on ICC
    141142    end
    function project_set_build_flags()  
    144145        defines { "DEBUG" }
    145146
    146147    configuration "Release"
    147         flags { "OptimizeSpeed" }
     148        if not _OPTIONS["minimal-flags"] then
     149            flags { "OptimizeSpeed" }
     150        end
    148151        defines { "NDEBUG", "CONFIG_FINAL=1" }
    149152
    150153    configuration { }
    function project_set_build_flags()  
    196199                linkoptions { "-multiply_defined","suppress" }
    197200            end
    198201        else
    199             buildoptions {
    200                 -- enable most of the standard warnings
    201                 "-Wno-switch",      -- enumeration value not handled in switch (this is sometimes useful, but results in lots of noise)
    202                 "-Wno-reorder",     -- order of initialization list in constructors (lots of noise)
    203                 "-Wno-invalid-offsetof",    -- offsetof on non-POD types (see comment in renderer/PatchRData.cpp)
    204 
    205                 "-Wextra",
    206                 "-Wno-missing-field-initializers",  -- (this is common in external headers we can't fix)
    207 
    208                 -- add some other useful warnings that need to be enabled explicitly
    209                 "-Wunused-parameter",
    210                 "-Wredundant-decls",    -- (useful for finding some multiply-included header files)
    211                 -- "-Wformat=2",        -- (useful sometimes, but a bit noisy, so skip it by default)
    212                 -- "-Wcast-qual",       -- (useful for checking const-correctness, but a bit noisy, so skip it by default)
    213                 "-Wnon-virtual-dtor",   -- (sometimes noisy but finds real bugs)
    214                 "-Wundef",              -- (useful for finding macro name typos)
    215 
    216                 -- enable security features (stack checking etc) that shouldn't have
    217                 -- a significant effect on performance and can catch bugs
    218                 "-fstack-protector-all",
    219                 "-D_FORTIFY_SOURCE=2",
    220 
    221                 -- always enable strict aliasing (useful in debug builds because of the warnings)
    222                 "-fstrict-aliasing",
    223 
    224                 -- do something (?) so that ccache can handle compilation with PCH enabled
    225                 "-fpch-preprocess",
    226 
    227                 -- don't omit frame pointers (for now), because performance will be impacted
    228                 -- negatively by the way this breaks profilers more than it will be impacted
    229                 -- positively by the optimisation
    230                 "-fno-omit-frame-pointer"
    231             }
     202            if not _OPTIONS["minimal-flags"] then
     203                buildoptions {
     204                    -- enable most of the standard warnings
     205                    "-Wno-switch",      -- enumeration value not handled in switch (this is sometimes useful, but results in lots of noise)
     206                    "-Wno-reorder",     -- order of initialization list in constructors (lots of noise)
     207                    "-Wno-invalid-offsetof",    -- offsetof on non-POD types (see comment in renderer/PatchRData.cpp)
     208
     209                    "-Wextra",
     210                    "-Wno-missing-field-initializers",  -- (this is common in external headers we can't fix)
     211
     212                    -- add some other useful warnings that need to be enabled explicitly
     213                    "-Wunused-parameter",
     214                    "-Wredundant-decls",    -- (useful for finding some multiply-included header files)
     215                    -- "-Wformat=2",        -- (useful sometimes, but a bit noisy, so skip it by default)
     216                    -- "-Wcast-qual",       -- (useful for checking const-correctness, but a bit noisy, so skip it by default)
     217                    "-Wnon-virtual-dtor",   -- (sometimes noisy but finds real bugs)
     218                    "-Wundef",              -- (useful for finding macro name typos)
     219
     220                    -- enable security features (stack checking etc) that shouldn't have
     221                    -- a significant effect on performance and can catch bugs
     222                    "-fstack-protector-all",
     223                    "-D_FORTIFY_SOURCE=2",
     224
     225                    -- always enable strict aliasing (useful in debug builds because of the warnings)
     226                    "-fstrict-aliasing",
     227
     228                    -- do something (?) so that ccache can handle compilation with PCH enabled
     229                    "-fpch-preprocess",
     230
     231                    -- don't omit frame pointers (for now), because performance will be impacted
     232                    -- negatively by the way this breaks profilers more than it will be impacted
     233                    -- positively by the optimisation
     234                    "-fno-omit-frame-pointer"
     235                }
     236            end
    232237
    233             if arch == "x86" or arch == "amd64" then
     238            if (arch == "x86" or arch == "amd64") and not _OPTIONS["minimal-flags"] then
    234239                buildoptions {
    235240                    -- enable SSE intrinsics
    236241                    "-msse"
    function project_set_build_flags()  
    245250                buildoptions { "-mthumb -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp" }
    246251            end
    247252
    248             if os.is("linux") or os.is("bsd") then
     253            if (os.is("linux") or os.is("bsd")) and not _OPTIONS["minimal-flags"] then
    249254                linkoptions { "-Wl,--no-undefined", "-Wl,--as-needed" }
    250255            end
    251256
    function project_set_build_flags()  
    256261
    257262            -- To support intrinsics like __sync_bool_compare_and_swap on x86
    258263            -- we need to set -march to something that supports them
    259             if arch == "x86" then
     264            if arch == "x86" and not _OPTIONS["minimal-flags"] then
    260265                buildoptions { "-march=i686" }
    261266            end
    262267
    function project_set_build_flags()  
    267272            end
    268273        end
    269274
    270         buildoptions {
    271             -- Hide symbols in dynamic shared objects by default, for efficiency and for equivalence with
    272             -- Windows - they should be exported explicitly with __attribute__ ((visibility ("default")))
    273             "-fvisibility=hidden"
    274         }
     275        if not _OPTIONS["minimal-flags"] then
     276            buildoptions {
     277                -- Hide symbols in dynamic shared objects by default, for efficiency and for equivalence with
     278                -- Windows - they should be exported explicitly with __attribute__ ((visibility ("default")))
     279                "-fvisibility=hidden"
     280            }
     281        end
    275282
    276283        -- X11 includes may be installed in one of a gadzillion of three places
    277284        -- Famous last words: "You can't include too much! ;-)"
    function project_set_build_flags()  
    292299            defines { "INSTALLED_LIBDIR=" .. _OPTIONS["libdir"] }
    293300        end
    294301
    295         if os.is("linux") or os.is("bsd") then
     302        -- TODO add "minimal-flags" here too?
     303        if (os.is("linux") or os.is("bsd")) and not _OPTIONS["with-system-mozjs185"] then
    296304            -- To use our local SpiderMonkey library, it needs to be part of the
    297305            -- runtime dynamic linker path. Add it with -rpath to make sure it gets found.
    298306            if _OPTIONS["libdir"] then
    function project_create(project_name, ta  
    325333
    326334    project_set_target(project_name)
    327335    project_set_build_flags()
     336
     337    if _OPTIONS["minimal-flags"] then
     338        flags { "Symbols" }
     339    end
    328340end
    329341
    330342
    function setup_atlas_project(project_nam  
    841853        -- install_name settings aren't really supported yet by premake, but there are plans for the future.
    842854        -- we currently use this hack to work around some bugs with wrong install_names.
    843855        if target_type == "SharedLib" then
    844             linkoptions { "-install_name @executable_path/lib"..project_name..".dylib" }       
     856            linkoptions { "-install_name @executable_path/lib"..project_name..".dylib" }
    845857        end
    846858    end
    847859
    function setup_collada_project(project_n  
    10271039        -- install_name settings aren't really supported yet by premake, but there are plans for the future.
    10281040        -- we currently use this hack to work around some bugs with wrong install_names.
    10291041        if target_type == "SharedLib" then
    1030             linkoptions { "-install_name @executable_path/lib"..project_name..".dylib" }       
     1042            linkoptions { "-install_name @executable_path/lib"..project_name..".dylib" }
    10311043        end
    10321044
    10331045        buildoptions { "-fno-strict-aliasing" }