Home | History | Annotate | Download | only in Api
      1 TEMPLATE = lib
      2 TARGET = dummy
      3 
      4 include(headers.pri)
      5 
      6 CONFIG -= debug_and_release
      7 
      8 DESTDIR = ../../../include/QtWebKit
      9 
     10 QUOTE = ""
     11 DOUBLE_ESCAPED_QUOTE = ""
     12 ESCAPE = ""
     13 win32-msvc* | wince* {
     14     ESCAPE = "^"
     15 } else:contains(QMAKE_HOST.os, "Windows"):isEmpty(QMAKE_SH) {
     16     # MinGW's make will run makefile commands using sh, even if make
     17     #  was run from the Windows shell, if it finds sh in the path.
     18     ESCAPE = "^"
     19 } else {
     20     QUOTE = "\'"
     21     DOUBLE_ESCAPED_QUOTE = "\\\'"
     22 }
     23 
     24 qtheader_module.target = $${DESTDIR}/QtWebKit
     25 qtheader_module.depends = $${_PRO_FILE_}
     26 qtheader_module.commands = echo $${QUOTE}$${LITERAL_HASH}ifndef QT_QTWEBKIT_MODULE_H$${QUOTE} > $${qtheader_module.target} &&
     27 qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}define QT_QTWEBKIT_MODULE_H$${QUOTE} >> $${qtheader_module.target} &&
     28 qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}include $${ESCAPE}<QtNetwork/QtNetwork$${ESCAPE}>$${QUOTE} >> $${qtheader_module.target} &&
     29 WEBKIT_CLASS_HEADERS = $${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}PWD/QtWebKit
     30 
     31 regex = ".*\\sclass\\sQWEBKIT_EXPORT\\s(\\w+)\\s(.*)"
     32 
     33 for(HEADER, WEBKIT_API_HEADERS) {
     34     # 1. Append to QtWebKit header that includes all other header files
     35     # Quotes need to be escaped once more when placed in eval()
     36     eval(qtheader_module.commands += echo $${DOUBLE_ESCAPED_QUOTE}\$${LITERAL_HASH}include \\\"$$basename(HEADER)\\\"$${DOUBLE_ESCAPED_QUOTE} >> $${qtheader_module.target} &&)
     37 
     38     HEADER_NAME = $$basename(HEADER)
     39     HEADER_TARGET = $$replace(HEADER_NAME, [^a-zA-Z0-9_], -)
     40     HEADER_TARGET = "qtheader-$${HEADER_TARGET}"
     41 
     42     # 2. Create forwarding header files for qwebframe.h, etc.
     43     # Normally they contain absolute paths, for package builds we make the path relative so that
     44     # the package sources are relocatable.
     45 
     46     PATH_TO_HEADER = $$HEADER
     47     CONFIG(standalone_package): PATH_TO_HEADER = ../../WebKit/qt/Api/$$basename(HEADER)
     48 
     49     eval($${HEADER_TARGET}.target = $${DESTDIR}/$${HEADER_NAME})
     50     eval($${HEADER_TARGET}.depends = $$HEADER)
     51     eval($${HEADER_TARGET}.commands = echo $${DOUBLE_ESCAPED_QUOTE}\$${LITERAL_HASH}include \\\"$$PATH_TO_HEADER\\\"$${DOUBLE_ESCAPED_QUOTE} > $$eval($${HEADER_TARGET}.target))
     52 
     53     QMAKE_EXTRA_TARGETS += $$HEADER_TARGET
     54     qtheader_module.depends += $$eval($${HEADER_TARGET}.target)
     55 
     56     # 3. Extract class names of exported classes from the headers and generate
     57     # the class name header files
     58 
     59     src_words = $$cat($$HEADER)
     60     # Really make sure we're dealing with words
     61     src_words = $$split(src_words, " ")
     62 
     63     src = $$join(src_words, $${LITERAL_WHITESPACE})
     64     for(ever) {
     65         # Looking up by line is faster, so we try that first
     66         res = $$find(src_words, "QWEBKIT_EXPORT")
     67         isEmpty(res):break()
     68 
     69         # Then do a slow lookup to ensure we're dealing with an exported class
     70         res = $$find(src, $$regex)
     71         isEmpty(res):break()
     72 
     73         exp = $$replace(src, $$regex, "EXPORTED_CLASS = \\1")
     74         eval($$exp)
     75 
     76         CLASS_TARGET = "qtheader_$${EXPORTED_CLASS}"
     77 
     78         eval($${CLASS_TARGET}.target = $${DESTDIR}/$${EXPORTED_CLASS})
     79         eval($${CLASS_TARGET}.depends = $$eval($${HEADER_TARGET}.target))
     80         eval($${CLASS_TARGET}.commands = echo $${DOUBLE_ESCAPED_QUOTE}\$${LITERAL_HASH}include \\\"$$basename(HEADER)\\\"$${DOUBLE_ESCAPED_QUOTE} > $$eval($${CLASS_TARGET}.target))
     81 
     82         QMAKE_EXTRA_TARGETS += $$CLASS_TARGET
     83         WEBKIT_CLASS_HEADERS += $${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}PWD/$${EXPORTED_CLASS}
     84 
     85         generated_files.depends += $$eval($${CLASS_TARGET}.target)
     86         qtheader_pri.depends += $$eval($${CLASS_TARGET}.target)
     87 
     88         # Qt's QRegExp does not support inline non-greedy matching,
     89         # so we'll have to work around it by updating the haystack
     90         src = $$replace(src, $$regex, "\\2")
     91         src_words = $$join(src, $${LITERAL_WHITESPACE})
     92     }
     93 }
     94 
     95 qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}endif // QT_QTWEBKIT_MODULE_H$${QUOTE} >> $${qtheader_module.target}
     96 QMAKE_EXTRA_TARGETS += qtheader_module
     97 
     98 qtheader_pri.target = $${DESTDIR}/classheaders.pri
     99 qtheader_pri.depends += $${_PRO_FILE_}
    100 qtheader_pri.commands = echo $${QUOTE}WEBKIT_CLASS_HEADERS = $${WEBKIT_CLASS_HEADERS}$${QUOTE} > $${qtheader_pri.target}
    101 QMAKE_EXTRA_TARGETS += qtheader_pri
    102 
    103 generated_files.depends += $${qtheader_module.target} $${qtheader_pri.target}
    104 QMAKE_EXTRA_TARGETS += generated_files
    105 
    106 
    107 
    108