~midori/midori/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Copyright (C) 2013 Christian Dywan <christian@twotoasts.de>

set(EXTENSIONDIR "${CMAKE_INSTALL_FULL_LIBDIR}/${CMAKE_PROJECT_NAME}")
include_directories(
                    "${CMAKE_SOURCE_DIR}"
                    "${CMAKE_SOURCE_DIR}/midori"
                    "${CMAKE_SOURCE_DIR}/katze"
                    ${DEPS_INCLUDE_DIRS}
                    ${OPTS_INCLUDE_DIRS}
                    ${DEPS_GTK_INCLUDE_DIRS}
                    ${OPTS_GTK_INCLUDE_DIRS}
                    ${CMAKE_BINARY_DIR}
                    "${CMAKE_BINARY_DIR}/midori"
                    )
file(GLOB EXTENSIONS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
if (HALF_BRO_INCOM_WEBKIT2)
    list(REMOVE_ITEM EXTENSIONS
         "cookie-permissions"
         "addons.c"
         "formhistory"
         "external-download-manager.vala"
         "nojs"
         "nsplugin-manager.vala"
         "tabs2one.c"
         )
endif ()

# FIXME: re-enable webmedia extension
# once we have working notifications on win
if (WIN32)
    list(REMOVE_ITEM EXTENSIONS "webmedia-now-playing.vala")
endif()

# FIXME: not stable enough for release
if (NOT REVISION)
    list(REMOVE_ITEM EXTENSIONS "tabs2one.c")
endif()

foreach(UNIT_SRC ${EXTENSIONS})
    string(FIND ${UNIT_SRC} ".c" UNIT_EXTENSION)
    if (UNIT_EXTENSION GREATER -1)
        string(REPLACE ".c" "" UNIT ${UNIT_SRC})
        add_library(${UNIT} MODULE ${UNIT_SRC})
        target_link_libraries(${UNIT}
                              ${LIBMIDORI}
                              )
        set_target_properties(${UNIT} PROPERTIES
                              COMPILE_FLAGS ${CFLAGS}
                              )
        install(TARGETS ${UNIT}
            LIBRARY DESTINATION ${EXTENSIONDIR}
                )
    endif ()
endforeach ()

foreach(UNIT_SRC ${EXTENSIONS})
    string(FIND ${UNIT_SRC} "." UNIT_EXTENSION)
    if (UNIT_EXTENSION EQUAL -1)
        file(GLOB UNIT_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${UNIT_SRC}/*.c")
        file(GLOB UNIT_FILES_VALA RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${UNIT_SRC}/*.vala")
        if (UNIT_FILES_VALA)
            include(ValaPrecompile)
            vala_precompile(UNIT_SRC_C ${UNIT_SRC}
                ${UNIT_FILES_VALA}
            PACKAGES
                ${PKGS}
            OPTIONS
                ${VALAFLAGS}
                --use-header="${CMAKE_PROJECT_NAME}-core.h"
            GENERATE_HEADER
                "${UNIT_SRC}"
            GENERATE_HEADER
                ${UNIT}
            CUSTOM_VAPIS
                ${EXTRA_VAPIS}
                "${CMAKE_SOURCE_DIR}/midori/midori.vapi"
                "${CMAKE_BINARY_DIR}/midori/${LIBMIDORI}.vapi"
            )
            set(UNIT_FILES ${UNIT_FILES} ${UNIT_SRC_C})
        endif ()
        if (UNIT_FILES)
            add_library(${UNIT_SRC} MODULE ${UNIT_FILES})
            target_link_libraries(${UNIT_SRC}
                                  ${LIBMIDORI}
                                  )
            install(TARGETS ${UNIT_SRC}
                    LIBRARY DESTINATION ${EXTENSIONDIR}
                    )
            # extensions with vala code get the lenient VALA_CFLAGS
            # others get the usual CFLAGS with -Wall and -Werror
	    if (UNIT_FILES_VALA)
		set_target_properties(${UNIT_SRC} PROPERTIES
				      COMPILE_FLAGS ${VALA_CFLAGS}
				      )
	    else ()
		set_target_properties(${UNIT_SRC} PROPERTIES
				      COMPILE_FLAGS ${CFLAGS}
				      )
	    endif ()
        endif ()
    endif ()
endforeach ()

foreach(UNIT_SRC ${EXTENSIONS})
    string(FIND ${UNIT_SRC} ".vala" UNIT_EXTENSION)
    if (UNIT_EXTENSION GREATER -1)
        string(REPLACE ".vala" "" UNIT ${UNIT_SRC})
        include(ValaPrecompile)
        vala_precompile(UNIT_SRC_C ${UNIT}
            ${UNIT_SRC}
        PACKAGES
            ${PKGS}
        OPTIONS
            ${VALAFLAGS}
            --use-header="${CMAKE_PROJECT_NAME}-core.h"
        GENERATE_HEADER
            ${UNIT}
        CUSTOM_VAPIS
            ${EXTRA_VAPIS}
            "${CMAKE_SOURCE_DIR}/midori/midori.vapi"
            "${CMAKE_BINARY_DIR}/midori/${LIBMIDORI}.vapi"
        )
        add_library(${UNIT} MODULE ${UNIT_SRC_C})
        target_link_libraries(${UNIT}
                              ${LIBMIDORI}
                              )
        set_target_properties(${UNIT} PROPERTIES
                              COMPILE_FLAGS "${VALA_CFLAGS}"
                              )
        install(TARGETS ${UNIT}
                LIBRARY DESTINATION ${EXTENSIONDIR}
                )
    endif ()
endforeach ()