perlを自動的に探すようにした, 使用する svn を toolinfo.txt に書くようにした
- perl は次のデフォルトフォルダを探す
@@ -42,6 +42,7 @@ | ||
42 | 42 | ISTool 5.3.0.1 (https://sourceforge.net/projects/istool/) |
43 | 43 | - others |
44 | 44 | Cygwin 1.5.x (1.7.x doesn't support Windows 9x) |
45 | +------ | |
45 | 46 | ActivePerl 5.10 or later version |
46 | 47 | converts character-code and return-code of documents for building OpenSSL. |
47 | 48 | Subversion for Windows (http://sourceforge.net/projects/win32svn/) |
@@ -48,7 +49,19 @@ | ||
48 | 49 | Use the compatible version for check-outed svn version. |
49 | 50 | Extract into libs\svn. ("svnversion.exe" is located in libs\svn\bin directory.) |
50 | 51 | |
52 | + Cygwin 1.5.x (1.7.x は Windows 9x をサポートしていないので不可) | |
53 | + ActivePerl 5.10 以上 または Strawberry perl 5.30.1.1 以上 | |
54 | + ビルド過程で使用します | |
55 | + - OpenSSL のコンパイル(必須) | |
56 | + - ドキュメントファイルの文字コード・改行コード変換(必須) | |
57 | + - リビジョン番号取得 (perlがない場合リビジョン番号を取得せずにビルドします) | |
58 | + Subversion for Windows (http://sourceforge.net/projects/win32svn/) | |
59 | + リビジョン番号取得時に使用します | |
60 | + svnrev_perl/toolinfo.txt に svn.exe のフルパスを記述いてください。 | |
61 | + 詳しくは svnrev_perl/readme.md を参照ください | |
62 | +------ | |
51 | 63 | |
64 | + | |
52 | 65 | * Libraries |
53 | 66 | - Oniguruma 6.9.3 (https://github.com/kkos/oniguruma) |
54 | 67 | - OpenSSL 1.1.1d (http://www.openssl.org/) |
@@ -46,11 +46,15 @@ | ||
46 | 46 | ISTool 5.3.0.1 (https://sourceforge.net/projects/istool/) |
47 | 47 | - その他 |
48 | 48 | Cygwin 1.5.x (1.7.x は Windows 9x をサポートしていないので不可) |
49 | - ActivePerl 5.10 以上 | |
50 | - OpenSSL のコンパイル、ドキュメントファイルの文字コード・改行コード変換に必要です。 | |
49 | + ActivePerl 5.10 以上 または Strawberry perl 5.30.1.1 以上 | |
50 | + ビルド過程で使用します | |
51 | + - OpenSSL のコンパイル(必須) | |
52 | + - ドキュメントファイルの文字コード・改行コード変換(必須) | |
53 | + - リビジョン番号取得 (perlがない場合リビジョン番号を取得せずにビルドします) | |
51 | 54 | Subversion for Windows (http://sourceforge.net/projects/win32svn/) |
52 | - ソースのチェックアウトに使った svn と互換性のあるバージョン。 | |
53 | - libs\svn へ解凍します。("svnversion.exe" が libs\svn\bin に配置されるようにしてください) | |
55 | + リビジョン番号取得時に使用します | |
56 | + svnrev_perl/toolinfo.txt に svn.exe のフルパスを記述いてください。 | |
57 | + 詳しくは svnrev_perl/readme.md を参照ください | |
54 | 58 | |
55 | 59 | |
56 | 60 | ■ ライブラリ |
@@ -2,16 +2,21 @@ | ||
2 | 2 | |
3 | 3 | - svn(又は git)の情報からヘッダファイルとバッチファイルを作成する |
4 | 4 | - `../teraterm/ttpdlg/svnversion.h` |
5 | - - `svnversion.bat` | |
5 | + - `sourcetree_info.bat` | |
6 | 6 | |
7 | 7 | ## 準備 |
8 | 8 | |
9 | -- svn(又は git)を実行できるようパスを設定する | |
10 | - - 実行できない場合もヘッダファイルは作成されます | |
11 | -- perlを実行できるようパスを設定する | |
12 | - - libs/perl があれば利用します | |
13 | - - buildtools/getperl.bat をダブルクリックすると | |
14 | - strawberry perl を libs/perl に展開します | |
9 | +- perl を実行できるようにしておく | |
10 | + - perl が実行できるよう環境変数 PATH を設定する | |
11 | + - または、../buildtools/libs/perl があれば使用する | |
12 | + - ../buildtools/getperl.bat をダブルクリックすると | |
13 | + strawberry perl が buildtools/perl に展開される | |
14 | + - または、いくつかのメジャーなperlを探して見つければ使用する | |
15 | + - perl が見つからない場合は svnversion.default.h が使用される | |
16 | +- svn(又は git)を実行できるようにする | |
17 | + - svn が実行できるよう環境変数 PATH を設定する | |
18 | + - または、toolinfo.txt にツールのパスを書いておく | |
19 | + - ツールが実行できない場合もヘッダファイルは作成されます | |
15 | 20 | |
16 | 21 | # ヘッダの作成方法 |
17 | 22 |
@@ -36,3 +41,5 @@ | ||
36 | 41 | - svnコマンドのパス |
37 | 42 | - --git |
38 | 43 | - gitコマンドのパス |
44 | + | |
45 | +オプションが toolinfo.txt より優先されます |
@@ -1,14 +1,47 @@ | ||
1 | 1 | @echo off |
2 | 2 | setlocal |
3 | 3 | cd /d %~dp0 |
4 | +set BAT=%~n0%~x0 | |
4 | 5 | |
5 | 6 | set SVNVERSION_H=../teraterm/ttpdlg/svnversion.h |
7 | +set SVNVERSION_H_DOS=..\teraterm\ttpdlg\svnversion.h | |
6 | 8 | |
7 | -if EXIST %SVNVERSION_H% goto finish | |
9 | +if NOT EXIST %SVNVERSION_H% goto env_perl | |
10 | +@echo %BAT%: already exist %SVNVERSION_H% | |
11 | +goto finish | |
8 | 12 | |
9 | -set PERL=..\libs\perl\perl\bin\perl.exe | |
10 | -if NOT EXIST %PERL% set PERL=perl.exe | |
13 | +:env_perl | |
14 | +if NOT "%PERL%" == "" goto found_perl | |
11 | 15 | |
16 | +:search_perl | |
17 | +set PERL=perl.exe | |
18 | +where %PERL% > nul 2>&1 | |
19 | +if %errorlevel% == 0 goto found_perl | |
20 | +set PERL=%~dp0..\buildtools\perl\perl\bin\perl.exe | |
21 | +if exist %PERL% goto found_perl | |
22 | +set PERL=C:\Strawberry\perl\bin\perl.exe | |
23 | +if exist %PERL% goto found_perl | |
24 | +set PERL=C:\Perl64\bin\perl.exe | |
25 | +if exist %PERL% goto found_perl | |
26 | +set PERL=C:\Perl\bin\perl.exe | |
27 | +if exist %PERL% goto found_perl | |
28 | +set PERL=C:\cygwin64\usr\bin\perl.exe | |
29 | +if exist %PERL% goto found_perl | |
30 | +set PERL=C:\cygwin\usr\bin\perl.exe | |
31 | +if exist %PERL% goto found_perl | |
32 | +goto no_perl | |
33 | + | |
34 | +:no_perl | |
35 | +@echo %BAT%: perl not found | |
36 | +@echo %BAT%: default svnversion.h is used | |
37 | +if exist sourcetree_info.bat del sourcetree_info.bat | |
38 | +type svnversion.default.h > %SVNVERSION_H_DOS% | |
39 | +goto finish | |
40 | + | |
41 | +:found_perl | |
42 | +@echo %BAT%: perl=%PERL% | |
12 | 43 | %PERL% svnrev.pl --root .. --header %SVNVERSION_H% |
44 | +goto finish | |
13 | 45 | |
46 | + | |
14 | 47 | :finish |
@@ -1,6 +1,7 @@ | ||
1 | 1 | use utf8; |
2 | 2 | use Getopt::Long 'GetOptions'; |
3 | 3 | use POSIX 'strftime'; |
4 | +binmode STDOUT, ':encoding(utf8)'; | |
4 | 5 | |
5 | 6 | $version = "5.0"; |
6 | 7 | $svn = "svn"; |
@@ -14,6 +15,30 @@ | ||
14 | 15 | $verbose = 0; |
15 | 16 | $script_name = $0; |
16 | 17 | |
18 | +sub read_toolinfo { | |
19 | + my $info = "toolinfo.txt"; | |
20 | + if (!-f $info) { | |
21 | + return; | |
22 | + } | |
23 | + open(my $FD, "<:utf8:crlf", $info); | |
24 | + while (my $l = <$FD>) { | |
25 | + chomp $l; | |
26 | + $str =~ s/^\x{FEFF}//; # remove BOM | |
27 | + if ($l =~ /^#/) { | |
28 | + next; | |
29 | + } | |
30 | + if ($l =~ /^svn=\s*(.*)$/) { | |
31 | + $svn = $1; | |
32 | + } | |
33 | + if ($l =~ /^git=\s*(.*)$/) { | |
34 | + $git = $1; | |
35 | + } | |
36 | + } | |
37 | + close($FD); | |
38 | +} | |
39 | + | |
40 | +&read_toolinfo(); | |
41 | + | |
17 | 42 | GetOptions( |
18 | 43 | 'root=s' => \$source_root, |
19 | 44 | 'svn=s' => \$svn, |
@@ -20,11 +45,14 @@ | ||
20 | 45 | 'git=s' => \$git, |
21 | 46 | 'header=s' => \$out_header, |
22 | 47 | 'bat=s' => \$out_bat, |
23 | - 'cmake=s' => \$out_cmake | |
48 | + 'cmake=s' => \$out_cmake, | |
49 | + 'verbose' => \$verbose | |
24 | 50 | ); |
25 | 51 | |
26 | 52 | $git =~ s/"//g; |
53 | +$git =~ s/\\/\//g; | |
27 | 54 | $svn =~ s/"//g; |
55 | +$svn =~ s/\\/\//g; | |
28 | 56 | |
29 | 57 | if ($verbose != 0) { |
30 | 58 | print "root=$source_root\n"; |
@@ -0,0 +1,4 @@ | ||
1 | +/* default svnversion.h */ | |
2 | +#define SVNVERSION 0000 | |
3 | +#undef TERATERM_RELEASE | |
4 | +#define BRANCH_NAME "unknown" |
@@ -0,0 +1,4 @@ | ||
1 | +# tool info | |
2 | +# | |
3 | +svn="C:\Program Files\TortoiseSVN\bin\svn.exe" | |
4 | +git="C:\Program Files\Git\bin\git.exe" |