Closed yzgyyang closed 6 years ago
I am working on making a port for Electron on FreeBSD, and since using the newest Chrome port will avoid several patches, I am just wondering if we could do that now. Thanks!
https://github.com/prash-wghats/Electron-VSCode-Atom-For-FreeBSD/tree/master/electron.
This is a beta release of electron
using Chromium-61.0.3163.100
.
When a stable release for electron with Chromium-61.0.3163.100
, is released there might be some changes to the current patches.
The script works perfectly fine. Thanks!
However, I am not able to find the error raised when I rewrote it in Makefile and build libchromiumcontent. I must be missing something during the preparation stage, but I am not familiar with gn. Here's the error:
➜ libchromiumcontent-2bdad00587 (master) ✗ sudo script/update -t x64 --skip_gclient
Warning: No "*.patch" files found in the "/usr/home/guangyuan/freebsd-ports-libchromiumcontent/work/libchromiumcontent-2bdad00587/patches/third_party" folder.
ERROR at //chromiumcontent/BUILD.gn:6:7: Undefined identifier
if (is_electron_build) {
^----------------
See build arg file (use "gn args <out_dir>" to edit):4:21: which caused the file to be included.
root_extra_deps = [ "//chromiumcontent:chromiumcontent" ]
^----------------------------------
ERROR at //chromiumcontent/BUILD.gn:6:7: Undefined identifier
if (is_electron_build) {
^----------------
See build arg file (use "gn args <out_dir>" to edit):4:21: which caused the file to be included.
root_extra_deps = [ "//chromiumcontent:chromiumcontent" ]
^----------------------------------
ERROR at //chromiumcontent/BUILD.gn:6:7: Undefined identifier
if (is_electron_build) {
^----------------
See build arg file (use "gn args <out_dir>" to edit):4:21: which caused the file to be included.
root_extra_deps = [ "//chromiumcontent:chromiumcontent" ]
^----------------------------------
Additionally, here's my new port directory with the failing steps commented out:
https://people.freebsd.org/~ygy/electron/freebsd_ports_libchromiumcontent.zip
22 #do-build:
23 # (cd ${WRKSRC} && script/update -t x64 --skip_gclient)
24 # (cd ${WRKSRC} && script/build --no_shared_library -t x64)
25 # (cd ${WRKSRC} && script/create-dist -c static_library -t x64)
Are you able to help me identify the problem? Thanks!
@yzgyyang Did you ever get it to work?
@yzgyyang. I tried your port. Works beautifully till the error mentioned above.This error is due to the patch from patches
directory not being applied. The update
script uses git to apply the patches, It looks like, if the .git/
folder is not present the patches are not being applied.
@prash-wghats Thanks for the help, I guess that's the problem then! Did a quick search in libchromiumcontent/scripts:
➜ script (2bdad00) ✗ ag git_apply
patch.py
14:from lib.git import apply as git_apply
44: applied_successfully = git_apply(repo, patch_path, reverse=reverse)
➜ script (2bdad00) ✗ ag git | ag apply
lib/git.py:11: args = ['git', 'apply',
Instead of making git apply
to work, I think it's better to use patch
directly (['patch', '-p1'], stdin=xxx
).
@yzgyyang yes. I have listed below a patch for git.py using patch
.
--- a/script/lib/git.py 2018-02-18 16:56:16.725209000 +0400
+++ b/script/lib/git.py 2018-02-18 17:06:30.905649000 +0400
@@ -8,15 +8,13 @@
def apply(repo, patch_path, reverse=False):
- args = ['git', 'apply',
+ args = ['patch', '-p1',
'--directory', repo,
- '--ignore-space-change',
- '--ignore-whitespace',
- '--whitespace', 'fix'
+ '--ignore-whitespace'
]
if reverse:
args += ['--reverse']
- args += ['--', patch_path]
+ args += ['--input', patch_path]
return_code = subprocess.call(args)
applied_successfully = (return_code == 0)
@prash-wghats Here's a similar error when building Electron with the ports structure (that is, submodules are handled by ports, no .git is present):
git submodule status vendor/libchromiumcontent
error: pathspec 'vendor/libchromiumcontent' did not match any file(s) known to git.
Traceback (most recent call last):
File "script/bootstrap.py", line 282, in <module>
sys.exit(main())
File "script/bootstrap.py", line 61, in main
libcc_static_library_path)
File "script/bootstrap.py", line 152, in setup_libchromiumcontent
args = ['-f', '-c', get_libchromiumcontent_commit(), '--target_arch',
File "script/bootstrap.py", line 268, in get_libchromiumcontent_commit
output = execute(['git', 'submodule', 'status', 'vendor/libchromiumcontent'])
File "/usr/home/guangyuan/freebsd-ports-electron/work/electron-4dab824/script/lib/util.py", line 174, in execute
raise e
subprocess.CalledProcessError: Command '['git', 'submodule', 'status', 'vendor/libchromiumcontent']' returned non-zero exit status 1
*** Error code 1
Stop.
make: stopped in /usr/home/guangyuan/freebsd-ports-electron
➜ electron-4dab824 (master) ✗ git submodule status vendor/libchromiumcontent
error: pathspec 'vendor/libchromiumcontent' did not match any file(s) known to git.
Please see my current electron port for more info: https://people.freebsd.org/~ygy/electron/freebsd_ports_electron.zip
Thanks!
@yzgyyang. Almost there!. The below listed patch will solve the error. The second change is the commit SHA of libchromiumcontent, which i have hard coded. After continuing the build, i get a error saying missing file grit.py
in pdfviewer\vendor\girt\
.
cd ../../vendor/pdf_viewer; python vendor/grit/grit.py -i resources.grd build -o ../../out/R/gen/grit
python: can't open file 'vendor/grit/grit.py': [Errno 2] No such file or directory
The sub modules for pdfviewer
are missing.
--- a/script/bootstrap.py 2018-02-26 10:33:36.910870000 +0400
+++ b/script/bootstrap.py 2018-02-26 10:34:00.760017000 +0400
@@ -31,7 +31,7 @@
if sys.platform == 'cygwin':
update_win32_python()
- update_submodules()
+ #update_submodules()
libcc_source_path = args.libcc_source_path
libcc_shared_library_path = args.libcc_shared_library_path
@@ -149,7 +149,7 @@
target_dir = os.path.join(DOWNLOAD_DIR, 'libchromiumcontent')
script = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script',
'download')
- args = ['-f', '-c', get_libchromiumcontent_commit(), '--target_arch',
+ args = ['-f', '-c', '2bdad00', '--target_arch',
target_arch, url, target_dir]
if (libcc_source_path != None and
libcc_shared_library_path != None and
@prash-wghats Tried your patch, worked beautifully. The submodules handling error is due to a ports framework bug, and I expect it to be resolved soon. I will let you know! 😄
Edit: Fix is in review at https://reviews.freebsd.org/D14532
Edit: Fixed 😄
@prash-wghats The next error:
(cd /usr/home/guangyuan/freebsd-ports-electron/work/electron-4dab824 && script/create-dist.py)
test/main.ts(434,24): error TS2345: Argument of type '{ url: string; headers: { key: string; }; serverType: string; }' is not assignable to parameter of type 'string'.
test/main.ts(571,13): error TS2345: Argument of type '{ x: number; y: number; }' is not assignable to parameter of type 'BrowserWindow'.
Object literal may only specify known properties, and 'x' does not exist in type 'BrowserWindow'.
Traceback (most recent call last):
File "script/create-dist.py", line 349, in <module>
sys.exit(main())
File "script/create-dist.py", line 121, in main
create_typescript_definitions()
File "script/create-dist.py", line 222, in create_typescript_definitions
'--out={0}'.format(outfile)], env=env)
File "/usr/home/guangyuan/freebsd-ports-electron/work/electron-4dab824/script/lib/util.py", line 174, in execute
raise e
subprocess.CalledProcessError: Command '['electron-typescript-definitions', '--in=dist/electron-api.json', '--out=dist/electron.d.ts']' returned non-zero exit status 1
*** Error code 1
Stop.
make: stopped in /usr/home/guangyuan/freebsd-ports-electron
Is this a mismatch of TypeScript versions? I have no idea since I'm not really a TS guy 🤕
Edit: I tried your script, same error encountered >_< Will try another FreeBSD machine.
@yzgyyang You are right. It is downloading the latest version of electron-typescript-definitions
, which seems not to compile.( I am no TS Guy too ).
--- a/package.json 2018-03-01 12:54:32.485760000 +0400
+++ b/package.json 2018-03-01 12:50:17.509265000 +0400
@@ -12,7 +12,7 @@
"dugite": "^1.45.0",
"electabul": "~0.0.4",
"electron-docs-linter": "^2.3.4",
- "electron-typescript-definitions": "^1.2.11",
+ "electron-typescript-definitions": "1.2.11",
"github": "^9.2.0",
"husky": "^0.14.3",
"minimist": "^1.2.0",
@prash-wghats Worked like a charm!
Though there's still a lot to do, Electron 1.8 Beta2 is now buildable with the ports structure! Thanks for all the help. I will let you know 😄
Please help to test this port: https://github.com/yzgyyang/freebsd-ports-electron/commit/4c48ee6f68cd72cb7dcbf41c6e1b73a688edf28d (Please update the ports first to make sure that this patch is in https://svnweb.freebsd.org/ports?view=revision&revision=463301). Although a couple of metadata is missing, it is now fully functional 😄
Hi @prash-wghats ! Currently Chromium is 61.0.3163.100 in the ports. What are the considerations not to use the newest version?