Fixed when user tap on linkable contents, somtimes focus ring is not shown.
[framework/web/webkit-efl.git] / TizenScripts / build-webkit
1 #!/usr/bin/python
2 ###################################################################
3 # Helper script to build with various options.
4 ###################################################################
5 import sys, os
6 import getopt
7 import signal
8
9 # defines global options
10 machines = ("armv7el", "i586")
11 repositories = ("standard", "i586emul")
12
13 extraOptions = ""
14
15 enableDebug = False
16 enableExp = False
17 experimentalPatches = (
18     "78cd1be48cb9fe799a80cc3981e6456e1c89db66",
19     "c376936d5a68acdcb8e4303625a75912f0fe9a24"
20     )
21
22 enableInjectedProfile = False
23 directoryPath = ""
24 enableDryRun = False # To debug
25 buildMachine = machines[0] # default machie is armv7el
26 buildRepository = repositories[0] # default repository is standard
27 optionsOnline = ""
28 gMakeOption = ""
29 gSimulator = False
30 gFixVersion = False
31
32 def signalHandler(signal, frame):
33     print ' # SIGINT will be ignored for stable work'
34
35 def execute(command):
36     if enableDryRun:
37         print(command)
38     else:
39         os.system(command)
40
41 def help():
42     print("""# helper scripts to build webkit-efl with dynamic options"
43 #
44 # tizen-scripts/build-webkit.py [options]
45 #
46
47 [options]
48   -h, --help : print  this message.
49   -d, --debug : build with debug info.
50   -e : build with experimental patches.
51   -i, --injected-profile : build with injected profile code
52   -l, --layouttest : build for layout test
53   -m, --machine [ %s ]
54   -n, --dry-run : Don't actually run any commands; just print them.
55   -o, --online : build with --online option.
56   -r, --repository [ %s ] : choose repository (default is %s)
57   -s : Add simulator definition (just for testing emulator)
58   -v : Fix package version to 123997_0.999.0. It will prevent CMakeCache Errors although version is changed.
59   -u, --unittest : build for unit test
60   -0, --disable-tizen-options : build without tizen options (not supported yet)
61   --makeargs [ targets ] : Just call make targets instead of calling 'cmake ... && make'
62                            Below are possible targets ( /fast would be faster but not safe )
63
64     wtf_efl javascriptcore_efl jsc_efl webcore_efl WebKit2StaticForDebug ewebkit2
65     WebCoreTestSupport gtest
66     forwarding-headerEfl forwarding-headerSoup
67     PluginProcess WebProcess
68     aboutFeatures po
69     ewk2UnitTestUtils
70     test_ewk2_context test_ewk2_cookie_manager test_ewk2_download_job test_ewk2_settings test_ewk2_view
71     wk2-web-inspector-resources
72     DefaultTheme MiniBrowser
73
74 """ % (' | '.join(machines), ' | '.join(repositories), buildRepository))
75
76 specFileName = "packaging/webkit2-efl.spec"
77 def prepare():
78     if enableExp:
79         pHandler = signal.signal(signal.SIGINT, signalHandler)
80         execute("git diff > backupForBuildScript.patch") # backup.patch is to restore local changes.
81         execute("git diff %s^ %s > exp.patch" % experimentalPatches)
82         execute("patch -p1 < exp.patch")
83         signal.signal(signal.SIGINT, pHandler)
84
85     if enableInjectedProfile:
86         execute("python TizenScripts/code-injecter.py")
87
88     if gFixVersion:
89         execute("cp %s backupForSpecfile.spec" % specFileName)
90
91         execute("python TizenScripts/fix-version-of-spec.py")
92
93 def cleanup():
94     if enableInjectedProfile:
95         execute("python TizenScripts/code-injecter.py reset")
96
97     if enableExp:
98         pHandler = signal.signal(signal.SIGINT, signalHandler)
99         execute("patch -p1 -R < exp.patch")
100         execute("rm exp.patch")
101         signal.signal(signal.SIGINT, pHandler)
102
103     if gFixVersion:
104         execute("mv backupForSpecfile.spec %s" % specFileName)
105
106 def build():
107     execute('sudo echo build start') # touch sudo
108     prepare()
109
110     directoryDefine = ""
111     optionsDefine = ""
112     debugDefine = ""
113     simulatorDefine = ""
114     if directoryPath:
115         directoryDefine = '--define=\\\"\"WEBKIT_BUILD_DIR %s\"\\\"' % directoryPath
116     if extraOptions:
117         optionsDefine = ' --define=\\\"\"TIZEN_WEBKIT_EXTRA_OPTIONS %s\"\\\"' % extraOptions
118     if gMakeOption:
119         optionsDefine = optionsDefine + ' --define=\\\"\"MAKE_OPTION %s\"\\\"' % gMakeOption
120
121     if enableDebug:
122         debugDefine = "--debug"
123
124     if buildMachine == "i586" and gSimulator:
125         simulatorDefine = ' --define=\\\"\"simulator 1\"\\\"'
126
127     execute('time osce build %s %s %s %s %s %s %s' % (buildRepository, buildMachine, optionsOnline, debugDefine, directoryDefine, optionsDefine, simulatorDefine))
128     cleanup()
129
130 def main():
131     global directoryPath, enableDebug, extraOptions, enableInjectedProfile, buildMachine, buildRepository, optionsOnline, enableDryRun, enableExp, gMakeOption, gSimulator, gFixVersion
132
133     optlist, args = getopt.getopt(sys.argv[1:], 'hdeilunm:r:osv', [ 'help', 'debug', 'injected-profile', 'layouttest', 'unittest', 'dry-run', 'machine=', 'online', 'makeargs=', 'repository=' ])
134     for opt, var in optlist:
135         if opt in ('--help', '-h'):
136             help()
137             exit()
138         if opt in ('--debug', '-d'):
139             enableDebug = True
140         if opt in ('-e'):
141             enableExp = True
142         if opt in ('--injected-profile', '-i'):
143             enableInjectedProfile = True
144             extraOptions += " -DENABLE_TIZEN_PROFILE=On"
145         if opt in ('--layouttest', '-l'):
146             directoryPath = "WebKitBuild/Release"
147             extraOptions += " -DENABLE_TIZEN_WEBKIT2_EFL_WTR=1"
148         if opt in ('--unittest', '-u'):
149             directoryPath = "WebKitBuild/Release"
150             # TIZEN_GESTURE and TIZEN_WEBKIT2_TEXT_SELECTION cause segmentation fault while running unit tests.
151             extraOptions += " '-DENABLE_API_TESTS=1 -DENABLE_TIZEN_WEBKIT2_UNIT_TESTS=1 -DENABLE_TIZEN_WEBKIT2_TEXT_SELECTION=0 -DENABLE_TIZEN_GESTURE=0'"
152         if opt in ('--dry-run', '-n'):
153             enableDryRun = True
154         if opt in ('--repository', '-r'):
155             if var not in repositories:
156                 print "## ! Error : repository should be %s or %s" % repositories
157                 print
158                 help()
159                 exit()
160             buildRepository = var
161         if opt in ('--machine', '-m'):
162             if var not in machines:
163                 print "## ! Error : machine should be %s or %s" % machines
164                 print
165                 help()
166                 exit()
167             buildMachine = var
168         if opt in ('--online', '-o'):
169             optionsOnline = "--online"
170         if opt == '-s':
171             gSimulator = True
172         if opt == '-v':
173             gFixVersion = True
174         if opt == '--makeargs':
175             print "make args" + var
176             gMakeOption = var
177
178     build()
179
180 if __name__ == "__main__":
181     main()