RESOLVED FIXED 55438
Cleanup: Separate port-specific implementation details from webkitdirs::buildCMakeProject()
https://bugs.webkit.org/show_bug.cgi?id=55438
Summary Cleanup: Separate port-specific implementation details from webkitdirs::build...
Daniel Bates
Reported 2011-02-28 19:00:52 PST
webkitdirs::buildCMakeProject() should be a port-independent function for building a port that uses a CMake build system. Currently, this function also includes logic that is specific to the WinCE and EFL ports. We should extract these details so as to make this function port-independent.
Attachments
Patch (8.92 KB, patch)
2011-02-28 19:45 PST, Daniel Bates
no flags
Patch (9.20 KB, patch)
2011-02-28 19:48 PST, Daniel Bates
no flags
Patch (9.22 KB, patch)
2011-02-28 19:52 PST, Daniel Bates
no flags
Patch (9.06 KB, patch)
2011-03-01 10:25 PST, Daniel Bates
no flags
Patch (9.25 KB, patch)
2011-03-01 13:33 PST, Daniel Bates
no flags
Patch (11.06 KB, patch)
2011-03-09 14:10 PST, Daniel Bates
no flags
Patch (11.04 KB, patch)
2011-03-09 14:13 PST, Daniel Bates
ddkilzer: review+
Daniel Bates
Comment 1 2011-02-28 19:45:28 PST
Created attachment 84177 [details] Patch I am not very familiar with CMake or the EFL and WinCE ports. So, I would appreciate if this patch is scrutinized for correctness. I implemented the functionality for cleaning a CMake project (i.e. build-webkit --clean) using cmake --build ... --target clean. Currently, the code "cleans" a project by removing the build directory (why?).
Daniel Bates
Comment 2 2011-02-28 19:48:53 PST
WebKit Review Bot
Comment 3 2011-02-28 19:49:02 PST
WebKit Review Bot
Comment 4 2011-02-28 19:50:32 PST
Daniel Bates
Comment 5 2011-02-28 19:52:20 PST
Gyuyoung Kim
Comment 6 2011-02-28 22:48:12 PST
There is build break on EFL port. Please do not land this patch by fixing this error. Failed to run "['Tools/Scripts/build-webkit', '--release', '--efl', '--makeargs="-j8"']" exit_code: 1 perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.US-ASCII" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). CMake Error at CMakeLists.txt:97 (INCLUDE): include could not find load file: OptionsEFL -- Platform-specific CMakeLists not found: /mnt/eflews/git/webkit/Source/JavaScriptCore/CMakeListsEFL.txt -- Platform-specific CMakeLists not found: /mnt/eflews/git/webkit/Source/JavaScriptCore/wtf/CMakeListsEFL.txt -- Platform-specific CMakeLists not found: /mnt/eflews/git/webkit/Source/JavaScriptCore/shell/CMakeListsEFL.txt -- Platform-specific CMakeLists not found: /mnt/eflews/git/webkit/Source/WebCore/CMakeListsEFL.txt -- Platform-specific CMakeLists not found: /mnt/eflews/git/webkit/Source/WebKit/efl/CMakeListsEFL.txt You have called ADD_LIBRARY for library WebKit without any source files. This typically indicates a problem with your CMakeLists.txt file -- Platform-specific CMakeLists not found: /mnt/eflews/git/webkit/Source/../Tools/CMakeListsEFL.txt -- Enabled features: -- Configuring incomplete, errors occurred
Daniel Bates
Comment 7 2011-02-28 23:01:00 PST
Comment on attachment 84180 [details] Patch Clearing review flag while I look into this some more.
Daniel Bates
Comment 8 2011-03-01 10:25:53 PST
Daniel Bates
Comment 9 2011-03-01 13:33:13 PST
Patrick R. Gansterer
Comment 10 2011-03-07 12:04:17 PST
Comment on attachment 84287 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=84287&action=review Sorry for the long delay. LGTM, but one change is required to work (at least on my machine). > Tools/Scripts/build-webkit:542 > + buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, ('-DCMAKE_WINCE_SDK="STANDARDSDK_500 (ARMV4I)"', cMakeArgsFromFeatures())); I don't know why, but it only works when chanig the quotes: buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, ("-DCMAKE_WINCE_SDK='STANDARDSDK_500 (ARMV4I)'", cMakeArgsFromFeatures()));
Daniel Bates
Comment 11 2011-03-09 13:46:01 PST
(In reply to comment #10) > (From update of attachment 84287 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=84287&action=review > > [...] > I don't know why, but it only works when chanig the quotes: > buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, ("-DCMAKE_WINCE_SDK='STANDARDSDK_500 (ARMV4I)'", cMakeArgsFromFeatures())); Notice, buildCMakeProjectOrExit() passes the argument @cmakeArgs to generateBuildSystemFromCMakeProject(). We don't need the inner quotes around the value of DCMAKE_WINCE_SDK since generateBuildSystemFromCMakeProject() calls system() using the Program, List form of this subroutine. This form of the subroutine passes the argument list directly to Program (instead of calling the system shell first) as per <http://perldoc.perl.org/functions/system.html>. In particular, the CMake argument "DCMAKE_WINCE_SDK='STANDARDSDK_500 (ARMV4I)'" will be passed directly. Hence, we don't need the quotes around the value of DCMAKE_WINCE_SDK.
Daniel Bates
Comment 12 2011-03-09 14:10:17 PST
Created attachment 85228 [details] Patch Simplified logic for $makeArgs by initializing it to the empty string.
Daniel Bates
Comment 13 2011-03-09 14:13:00 PST
David Kilzer (:ddkilzer)
Comment 14 2011-03-11 11:11:32 PST
Comment on attachment 85230 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=85230&action=review r=me assuming the other CMake port maintainers are okay with this. > Tools/Scripts/build-webkit:60 > +my $makeArgs = ""; # We initialize this to the empty string to simplify its use in string operations. Nit: Comment probably isn't necessary unless someone removes the initialization in the future. > Tools/Scripts/build-webkit:537 > + buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, ("-DCMAKE_WINCE_SDK=STANDARDSDK_500 (ARMV4I)", cMakeArgsFromFeatures())); I don't think the -DCMAKE_WINCE_SDK=STANDARDSDK_500 (ARMV4I) argument be quoted correctly. This should be (unless calling system() simply does the right thing without quoting): buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, ("-DCMAKE_WINCE_SDK=\"STANDARDSDK_500 (ARMV4I)\"", cMakeArgsFromFeatures())); > Tools/Scripts/webkitdirs.pm:1487 > + chdir($buildPath); Nit: Might consider adding back the "or die..." code to the chdir here. > Tools/Scripts/webkitdirs.pm:1492 > + push @args, "-DPORT=$port"; > + push @args, "-DCMAKE_INSTALL_PREFIX=$prefixPath" if $prefixPath; > + push @args, "-DCMAKE_BUILD_TYPE=$config"; Nit: To be extra-safe and future-proof, you could double-quote the values. At least consider doing this for the $prefixPath value since paths can have spaces in them (unless the system() call obviates the need for this): push @args, "-DPORT=\"$port\""; push @args, "-DCMAKE_INSTALL_PREFIX=\"$prefixPath\"" if $prefixPath; push @args, "-DCMAKE_BUILD_TYPE=\"$config\""; Nit: The old code didn't assume that $config was always "Debug" or "Release". What happens if someone uses "release" instead? Will cmake still do the correct thing? > Tools/Scripts/webkitdirs.pm:1494 > + push @args, sourceDir() . "/Source"; Nit: I know the original code didn't do this, but this should probably use File::Spec->catdir(sourceDir(), "Source").
Daniel Bates
Comment 15 2011-03-14 09:56:16 PDT
(In reply to comment #14) > (From update of attachment 85230 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=85230&action=review > [...] > > Tools/Scripts/build-webkit:60 > > +my $makeArgs = ""; # We initialize this to the empty string to simplify its use in string operations. > > Nit: Comment probably isn't necessary unless someone removes the initialization in the future. Will remove. > > > Tools/Scripts/build-webkit:537 > > + buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, ("-DCMAKE_WINCE_SDK=STANDARDSDK_500 (ARMV4I)", cMakeArgsFromFeatures())); > > I don't think the -DCMAKE_WINCE_SDK=STANDARDSDK_500 (ARMV4I) argument be quoted correctly. This should be (unless calling system() simply does the right thing without quoting): I'll add quotes around this value and change the call to system() (in generateBuildSystemFromCMakeProject()) so that it passes through the shell for processing (similar to what is done in buildCMakeGeneratedProject()). Currently, quotes are unnecessary since I'm using the PROGRAM-LIST form of system() with a LIST that consists of more than one argument in generateBuildSystemFromCMakeProject(): <http://perldoc.perl.org/functions/system.html>. > > buildCMakeProjectOrExit($clean, "WinCE", $prefixPath, $makeArgs, ("-DCMAKE_WINCE_SDK=\"STANDARDSDK_500 (ARMV4I)\"", cMakeArgsFromFeatures())); > > > Tools/Scripts/webkitdirs.pm:1487 > > + chdir($buildPath); > > Nit: Might consider adding back the "or die..." code to the chdir here. Will add. > > > Tools/Scripts/webkitdirs.pm:1492 > > + push @args, "-DPORT=$port"; > > + push @args, "-DCMAKE_INSTALL_PREFIX=$prefixPath" if $prefixPath; > > + push @args, "-DCMAKE_BUILD_TYPE=$config"; > > Nit: To be extra-safe and future-proof, you could double-quote the values. At least consider doing this for the $prefixPath value since paths can have spaces in them (unless the system() call obviates the need for this): > > push @args, "-DPORT=\"$port\""; > push @args, "-DCMAKE_INSTALL_PREFIX=\"$prefixPath\"" if $prefixPath; > push @args, "-DCMAKE_BUILD_TYPE=\"$config\""; > Will change. Currently, the form of system() used obviates the need for quotes as explained above. > Nit: The old code didn't assume that $config was always "Debug" or "Release". What happens if someone uses "release" instead? Will cmake still do the correct thing? Will change this to read: if ($config =~ /release/i) { push @args, "-DCMAKE_BUILD_TYPE=Release"; } elsif ($config =~ /debug/i) { push @args, "-DCMAKE_BUILD_TYPE=Debug"; } > > > Tools/Scripts/webkitdirs.pm:1494 > > + push @args, sourceDir() . "/Source"; > > Nit: I know the original code didn't do this, but this should probably use File::Spec->catdir(sourceDir(), "Source"). Will change.
Daniel Bates
Comment 16 2011-03-14 11:14:04 PDT
(In reply to comment #14) > (From update of attachment 85230 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=85230&action=review > > r=me assuming the other CMake port maintainers are okay with this. Patrick Gansterer said the patch "LGTM" with a remark to use quotes (which I have corrected) in comment 10. Also, the patch builds on EFL according the EFL EWS bot. I don't foresee issues with the changes you suggested. I will land this patch shortly and watch the build bots.
Daniel Bates
Comment 17 2011-03-14 11:24:46 PDT
David Kilzer (:ddkilzer)
Comment 18 2011-03-15 14:26:41 PDT
Note You need to log in before you can comment on or make changes to this bug.