logrotate: enable selinux support
[buildroot-gz.git] / package / fastd / 0001-cmake-use-INTERPROCEDURAL_OPTIMIZATION-target-proper.patch
blob489c7269f82779c56be9e35f3008a94382df7fcd
1 From: Alexander Dahl <alex@netz39.de>
2 Date: Wed, 28 Oct 2015 16:04:13 +0100
3 Subject: [PATCH] cmake: use INTERPROCEDURAL_OPTIMIZATION target property
5 Instead of hacking on compiler flags use the cmake way for handling
6 interprocedural optimization. Tests showed cmake currently ignores this
7 for gcc and clang, at least on Debian Wheezy and Jessie. This actually
8 results in no interprocedural optimization for the moment. However it
9 allows to compile fastd against a toolchain without LTO support, which
10 was broken because of a hack included here for finding binutils.
12 According to the upstream author of fastd the main reason for enabling
13 LTO was binary size on an OpenWRT target for Freifunk Gluon, where they
14 have very few space left on devices with only 4 MB flash memory.
16 Signed-off-by: Alexander Dahl <post@lespocky.de>
17 ---
18 cmake/checks.cmake | 14 --------------
19 src/CMakeLists.txt | 9 +++++++++
20 2 files changed, 9 insertions(+), 14 deletions(-)
22 diff --git a/cmake/checks.cmake b/cmake/checks.cmake
23 index 27c073f..8a671a1 100644
24 --- a/cmake/checks.cmake
25 +++ b/cmake/checks.cmake
26 @@ -10,20 +10,6 @@ if(ARCH_X86 OR ARCH_X86_64)
27 endif(ARCH_X86 OR ARCH_X86_64)
31 -if(ENABLE_LTO)
32 - set(CFLAGS_LTO "-flto")
33 - set(CFLAGS_NO_LTO "-fno-lto")
35 - check_c_compiler_flag("-fwhole-program" HAVE_FLAG_WHOLE_PROGRAM)
36 - if(HAVE_FLAG_WHOLE_PROGRAM)
37 - set(LDFLAGS_LTO "-flto -fwhole-program")
38 - else(HAVE_FLAG_WHOLE_PROGRAM)
39 - set(LDFLAGS_LTO "-flto")
40 - endif(HAVE_FLAG_WHOLE_PROGRAM)
41 -endif(ENABLE_LTO)
44 check_c_source_compiles("
45 #include <sys/types.h>
46 #include <sys/socket.h>
47 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
48 index 829b3ab..7612b40 100644
49 --- a/src/CMakeLists.txt
50 +++ b/src/CMakeLists.txt
51 @@ -48,6 +48,15 @@ add_executable(fastd
52 set_property(TARGET fastd PROPERTY COMPILE_FLAGS "${FASTD_CFLAGS}")
53 set_property(TARGET fastd PROPERTY LINK_FLAGS "${PTHREAD_LDFLAGS} ${LIBUECC_LDFLAGS_OTHER} ${NACL_LDFLAGS_OTHER} ${JSON_C_LDFLAGS_OTHER} ${LDFLAGS_LTO}")
54 set_property(TARGET fastd APPEND PROPERTY INCLUDE_DIRECTORIES ${LIBCAP_INCLUDE_DIR} ${NACL_INCLUDE_DIRS} ${JSON_C_INCLUDE_DIR})
55 +if(ENABLE_LTO)
56 + set_target_properties(fastd PROPERTIES
57 + INTERPROCEDURAL_OPTIMIZATION ON
58 + )
59 +else(ENABLE_LTO)
60 + set_target_properties(fastd PROPERTIES
61 + INTERPROCEDURAL_OPTIMIZATION OFF
62 + )
63 +endif(ENABLE_LTO)
64 target_link_libraries(fastd protocols methods ciphers macs ${RT_LIBRARY} ${LIBCAP_LIBRARY} ${LIBUECC_LIBRARIES} ${NACL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY} ${JSON_C_LIBRARIES})
66 add_dependencies(fastd version)
67 --
68 2.1.4