2 ###################################################################
3 # Helper script to build with various options.
4 ###################################################################
9 # defines global options
10 machines = ("armv7el", "i586")
11 repositories = ("standard", "i586emul")
17 experimentalPatches = (
18 "78cd1be48cb9fe799a80cc3981e6456e1c89db66",
19 "c376936d5a68acdcb8e4303625a75912f0fe9a24"
22 enableInjectedProfile = False
24 enableDryRun = False # To debug
25 buildMachine = machines[0] # default machie is armv7el
26 buildRepository = repositories[0] # default repository is standard
32 def signalHandler(signal, frame):
33 print ' # SIGINT will be ignored for stable work'
42 print("""# helper scripts to build webkit-efl with dynamic options"
44 # tizen-scripts/build-webkit.py [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
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 )
64 wtf_efl javascriptcore_efl jsc_efl webcore_efl WebKit2StaticForDebug ewebkit2
65 WebCoreTestSupport gtest
66 forwarding-headerEfl forwarding-headerSoup
67 PluginProcess WebProcess
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
74 """ % (' | '.join(machines), ' | '.join(repositories), buildRepository))
76 specFileName = "packaging/webkit2-efl.spec"
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)
85 if enableInjectedProfile:
86 execute("python TizenScripts/code-injecter.py")
89 execute("cp %s backupForSpecfile.spec" % specFileName)
91 execute("python TizenScripts/fix-version-of-spec.py")
94 if enableInjectedProfile:
95 execute("python TizenScripts/code-injecter.py reset")
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)
104 execute("mv backupForSpecfile.spec %s" % specFileName)
107 execute('sudo echo build start') # touch sudo
115 directoryDefine = '--define=\\\"\"WEBKIT_BUILD_DIR %s\"\\\"' % directoryPath
117 optionsDefine = ' --define=\\\"\"TIZEN_WEBKIT_EXTRA_OPTIONS %s\"\\\"' % extraOptions
119 optionsDefine = optionsDefine + ' --define=\\\"\"MAKE_OPTION %s\"\\\"' % gMakeOption
122 debugDefine = "--debug"
124 if buildMachine == "i586" and gSimulator:
125 simulatorDefine = ' --define=\\\"\"simulator 1\"\\\"'
127 execute('time osce build %s %s %s %s %s %s %s' % (buildRepository, buildMachine, optionsOnline, debugDefine, directoryDefine, optionsDefine, simulatorDefine))
131 global directoryPath, enableDebug, extraOptions, enableInjectedProfile, buildMachine, buildRepository, optionsOnline, enableDryRun, enableExp, gMakeOption, gSimulator, gFixVersion
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'):
138 if opt in ('--debug', '-d'):
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'):
154 if opt in ('--repository', '-r'):
155 if var not in repositories:
156 print "## ! Error : repository should be %s or %s" % repositories
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
168 if opt in ('--online', '-o'):
169 optionsOnline = "--online"
174 if opt == '--makeargs':
175 print "make args" + var
180 if __name__ == "__main__":