• R/O
  • SSH
  • HTTPS

ttssh2: コミット


コミットメタ情報

リビジョン8623 (tree)
日時2020-03-27 00:38:55
作者zmatsuo

ログメッセージ

svnrev_perl/ 追加

- teraterm/svnrev の置き換え

- teraterm/svnrev/ 削除

- 生成ファイル

- teraterm/ttpdlg/svnversion.h
- svnrev_perl/sourcetree_info.bat

- 書き込まれる情報

- リビジョン番号(従来と同じ)
- リリース版か否か (svnのブランチ名から判定)
- ブランチ名

- サポートするプロジェクト

- vs2005
- vs2019
- cmake

- perl

- perl のダウンロード (libs/getperl.bat) を追加
- libs/ をビルドしているとき strawberry perl が見つからなかった場合は自動でダウンロードする

変更サマリ

差分

--- branches/unicode_macro/CMakeLists.txt (revision 8622)
+++ branches/unicode_macro/CMakeLists.txt (revision 8623)
@@ -12,11 +12,6 @@
1212 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
1313 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
1414
15-if(NOT DEFINED SNAPSHOT_DIR)
16- string(TIMESTAMP SNAPSHOT_DIR "snapshot-%Y%m%d_%H%M%S")
17-endif()
18-set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/${SNAPSHOT_DIR}")
19-
2015 # _WIN32_WINNT_WIN10 0x0a00
2116 set(_WIN32_WINNT "0x0a00")
2217 if(MSVC)
@@ -113,7 +108,38 @@
113108 @ONLY)
114109 message("revision=\"${SVNVERSION}\"")
115110
116-####
111+### tool
112+# perl
113+if (MSVC OR ("$ENV{MSYSTEM}" MATCHES "MINGW"))
114+ find_program(
115+ PERL perl.exe
116+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/libs/perl/perl/bin
117+ HINTS c:/Strawberry/perl/bin
118+ HINTS c:/Perl64/bin
119+ HINTS c:/Perl/bin
120+ HINTS c:/cygwin/usr/bin
121+ HINTS c:/cygwin64/usr/bin
122+ )
123+else()
124+ set(PERL "perl")
125+endif()
126+message("perl=${PERL}")
127+
128+if(NOT $ENV{USER})
129+ set(USER $ENV{USER})
130+elseif(NOT $ENV{USERNAME})
131+ set(USER $ENV{USERNAME})
132+else()
133+ set(USER "NONAME")
134+endif()
135+
136+if(NOT DEFINED SNAPSHOT_DIR)
137+ string(TIMESTAMP SNAPSHOT_DIR "snapshot-r${SVNVERSION}-%Y%m%d_%H%M%S-${USER}")
138+endif()
139+set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/${SNAPSHOT_DIR}")
140+
141+### subdirectories
142+add_subdirectory(svnrev_perl)
117143 add_subdirectory(teraterm)
118144 add_subdirectory(ttpmenu)
119145 add_subdirectory(TTProxy)
@@ -124,12 +150,3 @@
124150 endif()
125151 add_subdirectory(installer)
126152 add_subdirectory(doc)
127-
128-####
129-# ソースツリー内に生成ファイルが存在していたら削除する
130-if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/teraterm/ttpdlg/svnversion.h")
131- file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/teraterm/ttpdlg/svnversion.h")
132-endif()
133-if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ttssh2/ttxssh/puttyversion.h")
134- file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/ttssh2/ttxssh/puttyversion.h")
135-endif()
--- branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_clang_x64.bat (revision 8622)
+++ branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_clang_x64.bat (nonexistent)
@@ -1,17 +0,0 @@
1-setlocal
2-set COMPILER=mingw_x64
3-set GENERATOR=Unix Makefiles
4-set CMAKE_COMMAND=cmake
5-set CMAKE_OPTION_LIBS=
6-set CMAKE_OPTION_GENERATE=-DCMAKE_BUILD_TYPE=Release
7-set CMAKE_OPTION_BUILD=
8-set MINGW_CC=clang
9-set MINGW_CXX=clang++
10-set BUILD_DIR=build_%COMPILER%_msys2_clang_x64
11-set REV=9999
12-set DATE_TIME=20200228
13-set ZIP_FILE=snapshot-r%REV%-%DATE_TIME%-appveyor-%COMPILER%_clang_x64.zip
14-set SNAPSHOT_DIR=snapshot-r%REV%-%DATE_TIME%-appveyor-%COMPILER%_clang_x64
15-
16-cd /d %~dp0..
17-call ci_scripts\build_appveyor.bat
--- branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_gcc_x64.bat (revision 8622)
+++ branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_gcc_x64.bat (nonexistent)
@@ -1,17 +0,0 @@
1-setlocal
2-set COMPILER=mingw_x64
3-set GENERATOR=Unix Makefiles
4-set CMAKE_COMMAND=cmake
5-set CMAKE_OPTION_LIBS=
6-set CMAKE_OPTION_GENERATE=-DCMAKE_BUILD_TYPE=Release
7-set CMAKE_OPTION_BUILD=
8-set MINGW_CC=gcc
9-set MINGW_CXX=g++
10-set BUILD_DIR=build_%COMPILER%_msys2_gcc_x64
11-set REV=9999
12-set DATE_TIME=20200228
13-set ZIP_FILE=snapshot-r%REV%-%DATE_TIME%-appveyor-%COMPILER%_x64.zip
14-set SNAPSHOT_DIR=snapshot-r%REV%-%DATE_TIME%-appveyor-%COMPILER%_x64
15-
16-cd /d %~dp0..
17-call ci_scripts\build_appveyor.bat
--- branches/unicode_macro/ci_scripts/build_appveyor.bat (revision 8622)
+++ branches/unicode_macro/ci_scripts/build_appveyor.bat (revision 8623)
@@ -1,3 +1,5 @@
1+call svnrev_perl\svnrev.bat
2+call svnrev_perl\sourcetree_info.bat
13 if "%GENERATOR%" == "Visual Studio 8 2005" (
24 cd libs
35 call getcmake.bat nopause
@@ -38,6 +40,8 @@
3840 if not exist %BUILD_DIR% mkdir %BUILD_DIR%
3941 cd %BUILD_DIR%
4042 if exist cmakecache.txt del cmakecache.txt
43+set ZIP_FILE=snapshot-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY%.zip
44+set SNAPSHOT_DIR=snapshot-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY%
4145 "%CMAKE_COMMAND%" .. -G "%GENERATOR%" %CMAKE_OPTION_GENERATE% -DSNAPSHOT_DIR=%SNAPSHOT_DIR%
4246 "%CMAKE_COMMAND%" --build . --target install %CMAKE_OPTION_BUILD%
4347 "%CMAKE_COMMAND%" -E tar "cvf" %ZIP_FILE% --format=zip %SNAPSHOT_DIR%
--- branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_clang.bat (revision 8622)
+++ branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_clang.bat (revision 8623)
@@ -1,5 +1,6 @@
11 setlocal
22 set COMPILER=mingw
3+set COMPILER_FRIENDLY=mingw_clang
34 set GENERATOR=Unix Makefiles
45 set CMAKE_COMMAND=cmake
56 set CMAKE_OPTION_LIBS=
@@ -7,11 +8,7 @@
78 set CMAKE_OPTION_BUILD=
89 set MINGW_CC=clang
910 set MINGW_CXX=clang++
10-set BUILD_DIR=build_%COMPILER%_msys2_clang
11-set REV=9999
12-set DATE_TIME=20200228
13-set ZIP_FILE=snapshot-r%REV%-%DATE_TIME%-appveyor-%COMPILER%_clang.zip
14-set SNAPSHOT_DIR=snapshot-r%REV%-%DATE_TIME%-appveyor-%COMPILER%_clang
11+set BUILD_DIR=build_%COMPILER_FRIENDLY%_msys2
1512
1613 cd /d %~dp0..
1714 call ci_scripts\build_appveyor.bat
--- branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_gcc.bat (revision 8622)
+++ branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_gcc.bat (revision 8623)
@@ -1,5 +1,6 @@
11 setlocal
22 set COMPILER=mingw
3+set COMPILER_FRIENDLY=mingw_gcc
34 set GENERATOR=Unix Makefiles
45 set CMAKE_COMMAND=cmake
56 set CMAKE_OPTION_LIBS=
@@ -7,11 +8,7 @@
78 set CMAKE_OPTION_BUILD=
89 set MINGW_CC=gcc
910 set MINGW_CXX=g++
10-set BUILD_DIR=build_%COMPILER%_msys2_gcc
11-set REV=9999
12-set DATE_TIME=20200228
13-set ZIP_FILE=snapshot-r%REV%-%DATE_TIME%-appveyor-%COMPILER%.zip
14-set SNAPSHOT_DIR=snapshot-r%REV%-%DATE_TIME%-appveyor-%COMPILER%
11+set BUILD_DIR=build_%COMPILER_FRIENDLY%_msys2
1512
1613 cd /d %~dp0..
1714 call ci_scripts\build_appveyor.bat
--- branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_x64_clang.bat (nonexistent)
+++ branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_x64_clang.bat (revision 8623)
@@ -0,0 +1,14 @@
1+setlocal
2+set COMPILER=mingw_x64
3+set COMPILER_FRIENDLY=mingw_x64_clang
4+set GENERATOR=Unix Makefiles
5+set CMAKE_COMMAND=cmake
6+set CMAKE_OPTION_LIBS=
7+set CMAKE_OPTION_GENERATE=-DCMAKE_BUILD_TYPE=Release
8+set CMAKE_OPTION_BUILD=
9+set MINGW_CC=clang
10+set MINGW_CXX=clang++
11+set BUILD_DIR=build_%COMPILER_FRIENDLY%_msys2
12+
13+cd /d %~dp0..
14+call ci_scripts\build_appveyor.bat
--- branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_x64_gcc.bat (nonexistent)
+++ branches/unicode_macro/ci_scripts/build_local_appveyor_mingw_x64_gcc.bat (revision 8623)
@@ -0,0 +1,14 @@
1+setlocal
2+set COMPILER=mingw_x64
3+set COMPILER_FRIENDLY=mingw_x64_gcc
4+set GENERATOR=Unix Makefiles
5+set CMAKE_COMMAND=cmake
6+set CMAKE_OPTION_LIBS=
7+set CMAKE_OPTION_GENERATE=-DCMAKE_BUILD_TYPE=Release
8+set CMAKE_OPTION_BUILD=
9+set MINGW_CC=gcc
10+set MINGW_CXX=g++
11+set BUILD_DIR=build_%COMPILER_FRIENDLY%_msys2
12+
13+cd /d %~dp0..
14+call ci_scripts\build_appveyor.bat
--- branches/unicode_macro/ci_scripts/build_local_appveyor_vs2005.bat (revision 8622)
+++ branches/unicode_macro/ci_scripts/build_local_appveyor_vs2005.bat (revision 8623)
@@ -1,15 +1,12 @@
11 setlocal
22 set COMPILER=VS_80
3+set COMPILER_FRIENDLY=vs2005
34 set GENERATOR=Visual Studio 8 2005
45 set CMAKE_COMMAND=..\libs\cmake-3.11.4-win32-x86\bin\cmake.exe
56 set CMAKE_OPTION_LIBS=-DARCHITECTURE=Win32
67 set CMAKE_OPTION_GENERATE=
78 set CMAKE_OPTION_BUILD=--config Release
8-set BUILD_DIR=build_vs2005
9-set REV=9999
10-set DATE_TIME=20200228
11-set ZIP_FILE=snapshot-r%REV%-%DATE_TIME%-appveyor-vs2005.zip
12-set SNAPSHOT_DIR=snapshot-r%REV%-%DATE_TIME%-appveyor-vs2005
9+set BUILD_DIR=build_%COMPILER_FRIENDLY%
1310
1411 cd /d %~dp0..
1512 call ci_scripts\build_appveyor.bat
--- branches/unicode_macro/ci_scripts/build_local_appveyor_vs2019.bat (revision 8622)
+++ branches/unicode_macro/ci_scripts/build_local_appveyor_vs2019.bat (revision 8623)
@@ -1,15 +1,12 @@
11 setlocal
22 set COMPILER=VS_142
3+set COMPILER_FRIENDLY=vs2019
34 set GENERATOR=Visual Studio 16 2019
45 set CMAKE_COMMAND=cmake
56 set CMAKE_OPTION_LIBS=-DARCHITECTURE=Win32
67 set CMAKE_OPTION_GENERATE=-A Win32
78 set CMAKE_OPTION_BUILD=--config Release
8-set BUILD_DIR=build_vs2019
9-set REV=9999
10-set DATE_TIME=20200228
11-set ZIP_FILE=snapshot-r%REV%-%DATE_TIME%-appveyor-vs2019.zip
12-set SNAPSHOT_DIR=snapshot-r%REV%-%DATE_TIME%-appveyor-vs2019
9+set BUILD_DIR=build_%COMPILER_FRIENDLY%
1310
1411 cd /d %~dp0..
1512 call ci_scripts\find_cmake.bat
--- branches/unicode_macro/ci_scripts/build_local_appveyor_vs2019_x64.bat (revision 8622)
+++ branches/unicode_macro/ci_scripts/build_local_appveyor_vs2019_x64.bat (revision 8623)
@@ -1,15 +1,12 @@
11 setlocal
22 set COMPILER=VS_142_x64
3+set COMPILER_FRIENDLY=vs2019_x64
34 set GENERATOR=Visual Studio 16 2019
45 set CMAKE_COMMAND=cmake
56 set CMAKE_OPTION_LIBS=-DARCHITECTURE=x64
67 set CMAKE_OPTION_GENERATE=-A x64
78 set CMAKE_OPTION_BUILD=--config Release
8-set BUILD_DIR=build_vs2019_x64
9-set REV=9999
10-set DATE_TIME=20200228
11-set ZIP_FILE=snapshot-r%REV%-%DATE_TIME%-appveyor-vs2019_x64.zip
12-set SNAPSHOT_DIR=snapshot-r%REV%-%DATE_TIME%-appveyor-vs2019_x64
9+set BUILD_DIR=build_%COMPILER_FRIENDLY%
1310
1411 cd /d %~dp0..
1512 call ci_scripts\find_cmake.bat
--- branches/unicode_macro/installer/build.bat (revision 8622)
+++ branches/unicode_macro/installer/build.bat (revision 8623)
@@ -165,15 +165,15 @@
165165 CALL buildall.bat
166166 popd
167167
168+
169+rem "rebuild"を指定しない場合、svnversion.h を更新する。
170+if not exist ..\teraterm\ttpdlg\svnversion.h goto create_svnversion_h
168171 if "%BUILD%" == "rebuild" goto build
169172
170-rem "rebuild"を指定しない場合、SVNリビジョンを更新する。
171-if exist ..\teraterm\release\svnrev.exe goto svnrev
172-devenv /build release %TERATERMSLN% /project svnrev /projectconfig release
173+del ..\teraterm\ttpdlg\svnversion.h
174+:create_svnversion_h
175+call ..\svnrev_perl\svnrev.bat
173176
174-:svnrev
175-..\teraterm\release\svnrev.exe ..\libs\svn\bin\svnversion.exe .. ..\teraterm\ttpdlg\svnversion.h
176-
177177 :build
178178 devenv /%BUILD% release %TERATERMSLN%
179179 if ERRORLEVEL 1 goto fail
--- branches/unicode_macro/libs/getperl.bat (nonexistent)
+++ branches/unicode_macro/libs/getperl.bat (revision 8623)
@@ -0,0 +1,8 @@
1+@echo off
2+setlocal
3+cd /d %~dp0
4+echo perlをダウンロードしてlib/perlに展開します
5+pause
6+powershell -NoProfile -ExecutionPolicy Unrestricted .\getperl.ps1
7+endlocal
8+pause
--- branches/unicode_macro/svnrev_perl/CMakeLists.txt (nonexistent)
+++ branches/unicode_macro/svnrev_perl/CMakeLists.txt (revision 8623)
@@ -0,0 +1,20 @@
1+
2+add_custom_target(
3+ svnversion_h ALL
4+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/../teraterm/ttpdlg/svnversion.h
5+ SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/svnrev.pl
6+ COMMENT Generate "${CMAKE_CURRENT_BINARY_DIR}/../teraterm/ttpdlg/svnversion.h"
7+ )
8+
9+add_custom_command(
10+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../teraterm/ttpdlg/svnversion.h
11+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../teraterm/ttpdlg/
12+ COMMAND ${PERL} svnrev.pl --svn ${Subversion_SVN_EXECUTABLE} --git ${GIT_EXECUTABLE} --root ${CMAKE_SOURCE_DIR} --header ${CMAKE_CURRENT_BINARY_DIR}/../teraterm/ttpdlg/svnversion.h
13+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
14+ )
15+
16+####
17+# ソースツリー内に生成ファイルが存在していたら削除する
18+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../teraterm/ttpdlg/svnversion.h")
19+ file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/../teraterm/ttpdlg/svnversion.h")
20+endif()
--- branches/unicode_macro/svnrev_perl/readme.md (nonexistent)
+++ branches/unicode_macro/svnrev_perl/readme.md (revision 8623)
@@ -0,0 +1,38 @@
1+# svnrev
2+
3+- svn(又は git)の情報からヘッダファイルとバッチファイルを作成する
4+ - `../teraterm/ttpdlg/svnversion.h`
5+ - `svnversion.bat`
6+
7+## 準備
8+
9+- svn(又は git)を実行できるようパスを設定する
10+ - 実行できない場合もヘッダファイルは作成されます
11+- perlを実行できるようパスを設定する
12+ - libs/perl があれば利用します
13+ - libs/getperl.bat をダブルクリックすると
14+ strawberry perl を libs/perl に展開します
15+
16+# ヘッダの作成方法
17+
18+- Visual Studioを利用している場合
19+ - svnrev_perl プロジェクトから自動的に生成される
20+- Windows の場合
21+ - svnrev.bat をダブルクリックでヘッダが作成される
22+- cmake の場合
23+ - buildフォルダで次のように実行する
24+ - `cmake --build . --target svnversion_h`
25+- コマンドラインで直接実行する場合
26+ - `perl svnrev.pl --root .. --header ../teraterm/ttpdlg/svnversion.h`
27+
28+## svnrev.pl のオプション
29+
30+- --root
31+ - プロジェクトファイルのパス
32+ - '.svn/' 又は '.git/' の存在するパス
33+- --header
34+ - ヘッダファイルのパス
35+- --svn
36+ - svnコマンドのパス
37+- --git
38+ - gitコマンドのパス
--- branches/unicode_macro/svnrev_perl/svnrev.bat (nonexistent)
+++ branches/unicode_macro/svnrev_perl/svnrev.bat (revision 8623)
@@ -0,0 +1,14 @@
1+@echo off
2+setlocal
3+cd /d %~dp0
4+
5+set SVNVERSION_H=../teraterm/ttpdlg/svnversion.h
6+
7+if EXIST %SVNVERSION_H% goto finish
8+
9+set PERL=..\libs\perl\perl\bin\perl.exe
10+if NOT EXIST %PERL% set PERL=perl.exe
11+
12+%PERL% svnrev.pl --root .. --header %SVNVERSION_H%
13+
14+:finish
--- branches/unicode_macro/svnrev_perl/svnrev.pl (nonexistent)
+++ branches/unicode_macro/svnrev_perl/svnrev.pl (revision 8623)
@@ -0,0 +1,121 @@
1+use utf8;
2+use Getopt::Long 'GetOptions';
3+use POSIX 'strftime';
4+
5+$svn = "svn";
6+$git = "git";
7+$out_header = "svnversion.h";
8+$out_bat = "sourcetree_info.bat";
9+$source_root = "..";
10+$date = strftime "%Y%m%d", localtime;
11+$time = strftime "%H%M%S", localtime;
12+
13+GetOptions(
14+ 'root=s' => \$source_root,
15+ 'svn=s' => \$svn,
16+ 'git=s' => \$git,
17+ 'header=s' => \$out_header,
18+ 'bat=s' => \$out_bat
19+);
20+
21+if (-d "$source_root/.svn") {
22+ # svn infoを実行、出力をすべて取り込む
23+ if (!open(my $FD, "-|", "$svn info $source_root 2>&1")) {
24+ # svn が実行できない
25+ print "'$svn' can not execute\n";
26+ }
27+ else {
28+ # 出力をすべて取り込む
29+ my $text = do { local $/; <$FD> };
30+ close($FD);
31+
32+ # 必要な情報を取り込む
33+ my @text = split(/[\r\n]+/, $text);
34+ foreach my $l (@text) {
35+ if ($l =~ /Revision: (\d+)/) {
36+ $svninfo{'Revision'} = $1;
37+ } elsif ($l =~ /Relative URL: (.+)$/) {
38+ my $url = $1;
39+ my $name = $url;
40+ $name =~ s/^\^\/(.*)$/$1/; # "\/" を削除する
41+ $svninfo{'name'} = $name;
42+ my $release = 0;
43+ if ($url =~ /tags\/(teraterm-(\d+)_(\d+))/) {
44+ # パス名からリリースと判定
45+ my $tag = $1;
46+ my $version = "$2.$3";
47+ $release = 1;
48+ }
49+ $svninfo{'release'} = $release;
50+ }
51+ }
52+ }
53+}
54+elsif(-d "$source_root/.git") {
55+ my $branch = `$git rev-parse --abbrev-ref HEAD`;
56+ if ($branch eq '') {
57+ # git が実行できない
58+ print "'$git' can not execute\n";
59+ }
60+ else {
61+ $branch =~ s/[\r\n]$//g;
62+ $svninfo{'name'} = $branch;
63+
64+
65+ if (-d "$source_root/.git/svn") {
66+ # use git svn log
67+ my $revision = `$git svn log --oneline -1 2>&1`;
68+ $revision =~ s/^r(\d+).*$/$1/;
69+ $svninfo{'Revision'} = $1;
70+ }
71+ else {
72+ $svninfo{'Revision'} = undef;
73+ }
74+
75+ my $release = 0;
76+ if ($branch =~ /tags\/(teraterm-(\d+)_(\d+))/) {
77+ # リリースと判定
78+ my $tag = $1;
79+ my $version = "$2.$3";
80+ $release = 1;
81+ }
82+ $svninfo{'release'} = $release;
83+ }
84+}
85+else {
86+ # do not use VCS
87+}
88+
89+if ($svninfo{'release'} != 1) {
90+ $svninfo{'release'} = 0;
91+}
92+local $revision = $svninfo{'Revision'};
93+
94+# output for source(C,C++) header
95+open(my $FD, ">$out_header") || die "error $out_header";
96+print $FD "/* This file was generated by svnrev_perl/svnrev.pl */\n";
97+if ($revision == undef) {
98+ print $FD "#undef SVNVERSION\n";
99+} else {
100+ print $FD "#define SVNVERSION $revision\n";
101+}
102+if ($svninfo{'release'}) {
103+ print $FD "#define TERATERM_RELEASE 1\n";
104+} else {
105+ print $FD "#undef TERATERM_RELEASE\n";
106+}
107+print $FD "#define BRANCH_NAME \"$svninfo{'name'}\"\n";
108+close($FD);
109+
110+# output for bat file
111+open(my $FD, ">$out_bat") || die "error $out_bat";
112+print $FD "\@rem This file was generated by svnrev_perl/svnrev.pl\n";
113+if ($revision == undef) {
114+ print $FD "set SVNVERSION=unknown\n";
115+} else {
116+ print $FD "set SVNVERSION=$revision\n";
117+}
118+print $FD "set RELEASE=$svninfo{'release'}\n";
119+print $FD "set DATE=$date\n";
120+print $FD "set TIME=$time\n";
121+close($FD);
--- branches/unicode_macro/teraterm/svnrev/svnrev.h (revision 8622)
+++ branches/unicode_macro/teraterm/svnrev/svnrev.h (nonexistent)
@@ -1,30 +0,0 @@
1-/*
2- * Copyright (C) 1994-1998 T. Teranishi
3- * (C) 2009-2017 TeraTerm Project
4- * All rights reserved.
5- *
6- * Redistribution and use in source and binary forms, with or without
7- * modification, are permitted provided that the following conditions
8- * are met:
9- *
10- * 1. Redistributions of source code must retain the above copyright
11- * notice, this list of conditions and the following disclaimer.
12- * 2. Redistributions in binary form must reproduce the above copyright
13- * notice, this list of conditions and the following disclaimer in the
14- * documentation and/or other materials provided with the distribution.
15- * 3. The name of the author may not be used to endorse or promote products
16- * derived from this software without specific prior written permission.
17- *
18- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
19- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28- */
29-
30-#pragma once
--- branches/unicode_macro/teraterm/svnrev/svnrev.cpp (revision 8622)
+++ branches/unicode_macro/teraterm/svnrev/svnrev.cpp (nonexistent)
@@ -1,152 +0,0 @@
1-/*
2- * Copyright (C) 2009-2018 TeraTerm Project
3- * All rights reserved.
4- *
5- * Redistribution and use in source and binary forms, with or without
6- * modification, are permitted provided that the following conditions
7- * are met:
8- *
9- * 1. Redistributions of source code must retain the above copyright
10- * notice, this list of conditions and the following disclaimer.
11- * 2. Redistributions in binary form must reproduce the above copyright
12- * notice, this list of conditions and the following disclaimer in the
13- * documentation and/or other materials provided with the distribution.
14- * 3. The name of the author may not be used to endorse or promote products
15- * derived from this software without specific prior written permission.
16- *
17- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20- * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27- */
28-
29-#include <windows.h>
30-#include <stdio.h>
31-#include "svnrev.h"
32-
33-int get_svn_revision(char *svnversion, char *path) {
34- FILE *fp;
35- char command[MAX_PATH*2];
36- char result[32]= "";
37- int revision = -1;
38- char arg1[MAX_PATH], arg2[MAX_PATH];
39-
40- // subversion 1.7 から .svn\entries のフォーマットが変わったため、
41- // .svn\entries を直接読み込むのをやめ、
42- // svnversion.exe コマンドを呼び出した結果を返す
43-
44- // 渡された svnversion が存在すれば実行するが、
45- // そうでなければ "svnversion" を実行する (PATH から検索される)
46- if ((fopen_s(&fp, svnversion, "r")) == 0) {
47- DWORD r;
48-
49- fclose(fp);
50-
51- // _popen はスペースが含まれる場合にダブルクォートで囲んでも
52- // うまく動かないため 8.3 形式に変換
53- r = GetShortPathName(svnversion, arg1, sizeof(arg1));
54- if (r == 0) {
55- return -1; // svn did not exist
56- }
57- GetShortPathName(path, arg2, sizeof(arg2));
58-
59- _snprintf_s(command, sizeof(command), _TRUNCATE, "%s -n %s", arg1, arg2);
60-
61- }
62- else {
63- GetShortPathName(path, arg2, sizeof(arg2));
64-
65- _snprintf_s(command, sizeof(command), _TRUNCATE, "svnversion -n %s", arg2);
66- }
67-
68- if ((fp = _popen(command, "rt")) == NULL) {
69- return -1;
70- }
71-
72- fread(result, sizeof(result), sizeof(result)-1, fp);
73- revision = atoi(result);
74- _pclose(fp);
75-
76- if (strlen(result) == 0) {
77- return -1;
78- }
79-
80- if (revision == 0) {
81- revision = -1;
82- }
83-
84- return revision;
85-}
86-
87-BOOL write_svn_revesion(char *filename, int revision) {
88- FILE *fp;
89- char buf[64] = "";
90- int file_revision = -1;
91-
92- // print to stdout
93- if (strcmp(filename, "-") == 0) {
94- fprintf(stdout, "#define SVNVERSION %d\n", revision);
95- return TRUE;
96- }
97-
98- // read current file
99- if (fopen_s(&fp, filename, "r") == 0) {
100- fread(buf, sizeof(char), sizeof(buf)-1, fp);
101- fclose(fp);
102-
103- sscanf_s(buf, "#define SVNVERSION %d", &file_revision);
104- }
105-
106- // compare revisions
107- // .svn 配下のファイルが存在しない(-1)場合においても、ビルドができるように、
108- // ヘッダファイルは作成する。企業のイントラネットから SourceForge のSVNリポジトリへ
109- // 直接アクセスできない場合、tarballをダウンロードするしかなく、その際 .svn ディレクトリが
110- // 存在しない。
111- if (file_revision != -1 &&
112- (file_revision >= revision)) {
113- return TRUE;
114- }
115-
116- if (fopen_s(&fp, filename, "w+") != 0) {
117- return FALSE;
118- }
119-
120- if (revision >= 1) {
121- fprintf(fp, "#define SVNVERSION %d\n", revision);
122- }
123- else {
124- fprintf(fp, "#undef SVNVERSION\n");
125- }
126-
127- fclose(fp);
128-
129- return TRUE;
130-}
131-
132-int main(int argc, char* argv[])
133-{
134- int revision = -1;
135- char *svnversion, *input, *output;
136-
137- if (argc != 4) {
138- printf("USAGE: %s svnversion path output\n", argv[0]);
139- return -1;
140- }
141-
142- svnversion = argv[1]; // svnversion.exe
143- input = argv[2]; // top of source tree
144- output = argv[3]; // output to
145- revision = get_svn_revision(svnversion, input);
146-
147- if (!write_svn_revesion(output, revision)) {
148- return 1;
149- }
150-
151- return 0;
152-}
--- branches/unicode_macro/teraterm/teraterm/svnversion.h.in (revision 8622)
+++ branches/unicode_macro/teraterm/teraterm/svnversion.h.in (nonexistent)
@@ -1 +0,0 @@
1-#cmakedefine SVNVERSION @SVNVERSION@
--- branches/unicode_macro/teraterm/teraterm/CMakeLists.txt (revision 8622)
+++ branches/unicode_macro/teraterm/teraterm/CMakeLists.txt (revision 8623)
@@ -76,8 +76,7 @@
7676 tt-version.rc
7777 teraterm_manifest.rc
7878 #
79- svnversion.h.in
80- ${CMAKE_CURRENT_BINARY_DIR}/../ttpdlg/svnversion.h
79+# ${CMAKE_CURRENT_BINARY_DIR}/../ttpdlg/svnversion.h
8180 #
8281 unicode_test.h
8382 unicode.h
@@ -217,7 +216,6 @@
217216 #
218217 gdi32
219218 comctl32
220- comctl32
221219 ws2_32
222220 imagehlp
223221 delayimp
@@ -224,10 +222,10 @@
224222 uuid
225223 )
226224
227-####
228-configure_file(
229- svnversion.h.in
230- ../ttpdlg/svnversion.h @ONLY)
225+add_dependencies(
226+ teraterm
227+ svnversion_h
228+ )
231229
232230 install(
233231 TARGETS teraterm
--- branches/unicode_macro/ttssh2/ttxssh/CMakeLists.txt (revision 8622)
+++ branches/unicode_macro/ttssh2/ttxssh/CMakeLists.txt (revision 8623)
@@ -174,3 +174,9 @@
174174 RUNTIME
175175 DESTINATION .
176176 )
177+
178+####
179+# ソースツリー内に生成ファイルが存在していたら削除する
180+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ttssh2/ttxssh/puttyversion.h")
181+ file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/ttssh2/ttxssh/puttyversion.h")
182+endif()
旧リポジトリブラウザで表示