From aae14f4eb48851ab55101821c6597789a0ed2627 Mon Sep 17 00:00:00 2001 From: yuyi Date: Tue, 25 Feb 2020 01:01:35 +0800 Subject: [PATCH] tool: setup thirdparty 'freetype' --- cmd/tools/vsetup-freetype.v | 29 +++++++++++++++++++++++++++++ cmd/v/internal/help/doc_help.v | 4 +++- cmd/v/v.v | 3 ++- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 cmd/tools/vsetup-freetype.v diff --git a/cmd/tools/vsetup-freetype.v b/cmd/tools/vsetup-freetype.v new file mode 100644 index 0000000000..7bed948c47 --- /dev/null +++ b/cmd/tools/vsetup-freetype.v @@ -0,0 +1,29 @@ +module main + +import ( + os + filepath + v.pref +) + +fn main() { + $if windows { + println('Setup freetype...') + vroot := filepath.dir(pref.vexe_path()) + os.chdir(vroot) + + if os.is_dir('./thirdparty/freetype') { + println('Thirdparty "freetype" is already installed.') + } + else { + s := os.exec('git clone --depth=1 https://github.com/ubawurinna/freetype-windows-binaries ./thirdparty/freetype/') or { + panic(err) + } + println(s.output) + println('Thirdparty "freetype" installed successfully.') + } + } + $else { + println('It is only for Windows to setup thirdparty "freetype".') + } +} diff --git a/cmd/v/internal/help/doc_help.v b/cmd/v/internal/help/doc_help.v index 274acffc13..b660315386 100644 --- a/cmd/v/internal/help/doc_help.v +++ b/cmd/v/internal/help/doc_help.v @@ -35,6 +35,8 @@ The commands are: test-fmt test if all files in the current directory is formatted properly test-compiler run the V self-test suite to make sure V is working properly + setup-freetype setup thirdparty freetype on Windows + For a comprehensive list of options, please refer to `v help --verbose`.' //Use "v help " for more information about a command.' //TODO When docs have been written for all the subcommands, delete the verbose help text and @@ -116,6 +118,7 @@ Commands: doc Run vdoc over the source code and produce documentation. translate Translates C to V. [wip, will be available in V 0.3] create Create a new v project interactively. Answer the questions, and run it with `v run projectname` + setup-freetype Setup thirdparty freetype on Windows. V package management commands: search keywords Search the https://vpm.vlang.io/ module repository for matching modules and shows their details. @@ -128,4 +131,3 @@ V package management commands: - To disable automatic formatting: v -nofmt file.v */ - diff --git a/cmd/v/v.v b/cmd/v/v.v index 0ddfe6b7c4..c9f1a1094e 100644 --- a/cmd/v/v.v +++ b/cmd/v/v.v @@ -18,7 +18,8 @@ const ( 'test', 'test-fmt', 'test-compiler', 'bin2v', 'repl', - 'build-tools', 'build-examples', 'build-vbinaries'] + 'build-tools', 'build-examples', 'build-vbinaries', + 'setup-freetype'] ) fn main() {