• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision8933 (tree)
Time2020-09-05 00:54:26
Authorzmatsuo

Log Message

svnrev_perl/svnrev.pl にビルド用情報出力をまとめた

- Tera Term のバージョン情報

- teraterm/common/tt-version.h と svnrev.pl

- svnリビジョン番号の取得は svnrev_perl に一本化

- cmake時、従来は CMakeLists.txt 内でもリビジョン番号を取得していた

- cmake 用のファイルも出力できるようにした

- ${CMAKE_BINARY_DIR}/build_config.cmake を出力

- setup.exe,zipファイル名修正

- version追加
- teraterm-5.0.exe(zip) (release時)
- teraterm-5.0-r9999-YYMMDD_hhmmss-user

- cmake ビルドで svnrev_perl/ から CMakeLists.txt を削除

- svnversion_h ターゲット削除
- 依存関係を修正
- execute_process() で perl を呼び出すようにした

Change Summary

Incremental Difference

--- trunk/CMakeLists.txt (revision 8932)
+++ trunk/CMakeLists.txt (revision 8933)
@@ -3,7 +3,6 @@
33
44 project(teraterm_all)
55
6-option(SETUP_RELEASE "build setup.exe for release" OFF)
76 option(ENABLE_TTXSAMPLES "TTXSamples" ON)
87 option(MORE_WARNING "stronger warning" OFF)
98
@@ -69,42 +68,6 @@
6968 set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -s -Wl,--gc-sections")
7069 endif()
7170
72-if(EXISTS "${CMAKE_SOURCE_DIR}/.git/svn")
73- # git-svn
74- find_package(Git)
75- if(Git_FOUND)
76- message("git=${GIT_EXECUTABLE}")
77- execute_process(
78- COMMAND ${GIT_EXECUTABLE} svn log --oneline -1
79- RESULT_VARIABLE rv
80- OUTPUT_VARIABLE ov
81- ERROR_QUIET)
82- if(${rv})
83- message("git svn error? please check git svn")
84- else()
85- string(REGEX MATCH "[0-9]+" SVNVERSION "${ov}")
86- endif()
87- endif()
88-elseif(EXISTS "${CMAKE_SOURCE_DIR}/.svn")
89- # svn
90- find_package(Subversion)
91- if(SUBVERSION_FOUND)
92- if("CMAKE_COMMAND=${CMAKE_COMMAND}" MATCHES "msys")
93- # svn on msys
94- file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR} MSYS_CMAKE_SOURCE_DIR)
95- string(REGEX REPLACE "^([a-zA-Z]):/" "/\\1/" MSYS_CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR})
96- Subversion_WC_INFO(${MSYS_CMAKE_SOURCE_DIR} TT)
97- else()
98- Subversion_WC_INFO(${CMAKE_SOURCE_DIR} TT)
99- endif()
100- set(SVNVERSION "${TT_WC_REVISION}")
101- endif()
102-else()
103- # build without svn,git?
104- #set(SVNVERSION "0000")
105-endif()
106-message("revision=\"${SVNVERSION}\"")
107-
10871 ### tool
10972 # perl
11073 if (MSVC OR (MINGW AND (EXISTS "c:/windows")))
@@ -123,6 +86,16 @@
12386 )
12487 endif()
12588 message("perl=${PERL}")
89+# svn / git-svn
90+if(EXISTS "${CMAKE_SOURCE_DIR}/.git/svn")
91+ # git-svn
92+ find_package(Git)
93+ message("git=${GIT_EXECUTABLE}")
94+elseif(EXISTS "${CMAKE_SOURCE_DIR}/.svn")
95+ # svn
96+ find_package(Subversion)
97+ message("svn=${Subversion_SVN_EXECUTABLE}")
98+endif()
12699
127100 if(NOT $ENV{USER})
128101 set(USER $ENV{USER})
@@ -138,8 +111,9 @@
138111 endif()
139112
140113 if(NOT EXISTS "${CMAKE_BINARY_DIR}/build_config.cmake")
114+ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/teraterm/ttpdlg)
141115 execute_process(
142- COMMAND ${PERL} svnrev.pl --svn \"${Subversion_SVN_EXECUTABLE}\" --git \"${GIT_EXECUTABLE}\" --root ${CMAKE_SOURCE_DIR} --header ${CMAKE_CURRENT_BINARY_DIR}/../teraterm/ttpdlg/svnversion.h --cmake ${CMAKE_BINARY_DIR}/build_config.cmake
116+ COMMAND ${PERL} svnrev.pl --svn \"${Subversion_SVN_EXECUTABLE}\" --git \"${GIT_EXECUTABLE}\" --root ${CMAKE_SOURCE_DIR} --header ${CMAKE_BINARY_DIR}/teraterm/ttpdlg/svnversion.h --cmake ${CMAKE_BINARY_DIR}/build_config.cmake
143117 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/svnrev_perl
144118 )
145119 endif()
@@ -147,9 +121,9 @@
147121 message("revision=\"${SVNVERSION}\"")
148122
149123 if(DEFINED SVNVERSION)
150- set(REVISION_TIME_USER "r${SVNVERSION}-${BUILD_TIME}-${USER}")
124+ set(REVISION_TIME_USER "r${SVNVERSION}-${DATE}_${TIME}-${USER}")
151125 else()
152- set(REVISION_TIME_USER "unknown-${BUILD_TIME}-${USER}")
126+ set(REVISION_TIME_USER "unknown-${DATE}_${TIME}-${USER}")
153127 endif()
154128 if(NOT DEFINED SNAPSHOT_DIR)
155129 set(SNAPSHOT_DIR "snapshot-${REVISION_TIME_USER}")
@@ -156,10 +130,19 @@
156130 endif()
157131 set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/${SNAPSHOT_DIR}")
158132 if(NOT DEFINED SETUP_EXE)
159- set(SETUP_EXE "teraterm-${REVISION_TIME_USER}")
133+ # not need ".exe"
134+ if(RELEASE)
135+ set(SETUP_EXE "teraterm-${VERSION}")
136+ else()
137+ set(SETUP_EXE "teraterm-${VERSION}-${REVISION_TIME_USER}")
138+ endif()
160139 endif()
161140 if(NOT DEFINED SETUP_ZIP)
162- set(SETUP_ZIP "teraterm-${REVISION_TIME_USER}.zip")
141+ if(RELEASE)
142+ set(SETUP_ZIP "teraterm-${VERSION}.zip")
143+ else()
144+ set(SETUP_ZIP "teraterm-${VERSION}-${REVISION_TIME_USER}.zip")
145+ endif()
163146 endif()
164147
165148 ### create buildinfo.txt
@@ -169,7 +152,6 @@
169152 @ONLY)
170153
171154 ### subdirectories
172-add_subdirectory(svnrev_perl)
173155 add_subdirectory(teraterm)
174156 add_subdirectory(ttpmenu)
175157 add_subdirectory(TTProxy)
--- trunk/TTXSamples/TTXCheckUpdate/CMakeLists.txt (revision 8932)
+++ trunk/TTXSamples/TTXCheckUpdate/CMakeLists.txt (revision 8933)
@@ -16,6 +16,7 @@
1616 ../../teraterm/common/codeconv.h
1717 ../../teraterm/common/dlglib.h
1818 ../../teraterm/common/getcontent.h
19+ ${CMAKE_CURRENT_BINARY_DIR}/../../teraterm/ttpdlg/svnversion.h
1920 )
2021
2122 source_group(
@@ -58,11 +59,6 @@
5859 wininet.lib
5960 )
6061
61-add_dependencies(
62- TTXCheckUpdate
63- svnversion_h
64- )
65-
6662 install(
6763 TARGETS TTXCheckUpdate
6864 RUNTIME
--- trunk/ci_scripts/build_appveyor.bat (revision 8932)
+++ trunk/ci_scripts/build_appveyor.bat (revision 8933)
@@ -40,8 +40,8 @@
4040 if not exist %BUILD_DIR% mkdir %BUILD_DIR%
4141 cd %BUILD_DIR%
4242 if exist cmakecache.txt del cmakecache.txt
43-set ZIP_FILE=snapshot-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY%.zip
44-set SETUP_FILE=snapshot-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY%
43+set ZIP_FILE=snapshot-%VERSION%-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY%.zip
44+set SETUP_FILE=snapshot-%VERSION%-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY%
4545 set SNAPSHOT_DIR=snapshot-r%SVNVERSION%-%DATE%_%TIME%-appveyor-%COMPILER_FRIENDLY%
4646 "%CMAKE_COMMAND%" .. -G "%GENERATOR%" %CMAKE_OPTION_GENERATE% -DSNAPSHOT_DIR=%SNAPSHOT_DIR% -DSETUP_ZIP=%ZIP_FILE% -DSETUP_EXE=%SETUP_FILE% -DSETUP_RELEASE=%RELEASE%
4747 "%CMAKE_COMMAND%" --build . --target install %CMAKE_OPTION_BUILD%
--- trunk/installer/CMakeLists.txt (revision 8932)
+++ trunk/installer/CMakeLists.txt (revision 8933)
@@ -322,9 +322,8 @@
322322 NEWLINE_STYLE CRLF
323323 )
324324
325- set(ISCC_OPTION "/DOUTPUT_FILENAME=${SETUP_EXE}")
326- if (SETUP_RELEASE)
327- list(APPEND ISCC_OPTION "/DSETUP_RELEASE=1")
325+ if (RELEASE)
326+ set(ISCC_OPTION "/DSETUP_RELEASE=1")
328327 endif()
329328 add_custom_target(
330329 inno_setup
--- trunk/installer/teraterm_cmake.iss.in (revision 8932)
+++ trunk/installer/teraterm_cmake.iss.in (revision 8933)
@@ -1,9 +1,4 @@
11 #define AppName "Tera Term"
2-#define AppVer "5.0"
3-#ifdef SETUP_RELEASE
4-#else
5-#define snapshot GetDateTimeString('yyyymmdd_hhnnss', '', '');
6-#endif
72
83 [InnoIDE_PreCompile]
94 Name: makechm.bat
@@ -36,11 +31,11 @@
3631 AppSupportURL=https://ttssh2.osdn.jp/
3732 AppName={#AppName}
3833 #ifdef SETUP_RELEASE
39-AppVersion={#AppVer}
40-AppVerName={#AppName} {#AppVer}
34+AppVersion=@VERSION@
35+AppVerName={#AppName} @VERSION@
4136 #else
42-AppVersion={#AppVer}+ snapshot-{#snapshot}
43-AppVerName={#AppName} {#AppVer}+
37+AppVersion=@VERSION@+ snapshot-r@SVNVERSION@-@DATE@
38+AppVerName={#AppName} @VERSION@+
4439 #endif
4540 LicenseFile=@PROJECT_SOURCE_DIR@/installer\release\license.txt
4641 DefaultDirName={pf}\teraterm
@@ -48,11 +43,7 @@
4843 ShowLanguageDialog=yes
4944 AllowNoIcons=true
5045 UninstallDisplayIcon={app}\ttermpro.exe
51-#ifdef SETUP_RELEASE
52-OutputBaseFilename=teraterm-{#AppVer}
53-#else
54-OutputBaseFilename={#OUTPUT_FILENAME}
55-#endif
46+OutputBaseFilename=@SETUP_EXE@
5647 PrivilegesRequired=none
5748 SolidCompression=yes
5849 Compression=lzma2/ultra64
--- trunk/svnrev_perl/CMakeLists.txt (revision 8932)
+++ trunk/svnrev_perl/CMakeLists.txt (nonexistent)
@@ -1,20 +0,0 @@
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()
--- trunk/svnrev_perl/svnrev.pl (revision 8932)
+++ trunk/svnrev_perl/svnrev.pl (revision 8933)
@@ -2,13 +2,16 @@
22 use Getopt::Long 'GetOptions';
33 use POSIX 'strftime';
44
5+$version = "5.0";
56 $svn = "svn";
67 $git = "git";
78 $out_header = "svnversion.h";
89 $out_bat = "sourcetree_info.bat";
10+$out_cmake = "";
911 $source_root = "..";
1012 $date = strftime "%Y%m%d", localtime;
1113 $time = strftime "%H%M%S", localtime;
14+$verbose = 0;
1215
1316 GetOptions(
1417 'root=s' => \$source_root,
@@ -15,9 +18,24 @@
1518 'svn=s' => \$svn,
1619 'git=s' => \$git,
1720 'header=s' => \$out_header,
18- 'bat=s' => \$out_bat
21+ 'bat=s' => \$out_bat,
22+ 'cmake=s' => \$out_cmake
1923 );
2024
25+$git =~ s/"//g;
26+$svn =~ s/"//g;
27+
28+if ($verbose != 0) {
29+ print "root=$source_root\n";
30+ print "svn=\"$svn\"\n";
31+ print "git=\"$git\"\n";
32+ print "header=$out_header\n";
33+ print "bat=$out_bat\n";
34+ print "cmake=$out_cmak\n";
35+}
36+
37+$header = "This file was generated by svnrev_perl/svnrev.pl";
38+
2139 if (-d "$source_root/.svn") {
2240 # svn infoを実行、出力をすべて取り込む
2341 if (!open(my $FD, "-|", "\"$svn\" info $source_root 2>&1")) {
@@ -93,7 +111,8 @@
93111
94112 # output for source(C,C++) header
95113 open(my $FD, ">$out_header") || die "error $out_header";
96-print $FD "/* This file was generated by svnrev_perl/svnrev.pl */\n";
114+print $FD "/* $header */\n";
115+print $FD "/* #define TT_VERSION_STR \"$version\" check teraterm/common/tt-version.h */\n";
97116 if ($revision == undef) {
98117 print $FD "#undef SVNVERSION\n";
99118 } else {
@@ -109,7 +128,8 @@
109128
110129 # output for bat file
111130 open(my $FD, ">$out_bat") || die "error $out_bat";
112-print $FD "\@rem This file was generated by svnrev_perl/svnrev.pl\n";
131+print $FD "\@rem $header\n";
132+print $FD "set VERSION=$version\n";
113133 if ($revision == undef) {
114134 print $FD "set SVNVERSION=unknown\n";
115135 } else {
@@ -119,3 +139,19 @@
119139 print $FD "set DATE=$date\n";
120140 print $FD "set TIME=$time\n";
121141 close($FD);
142+
143+# output for cmake
144+if ($out_cmake ne "") {
145+ open(my $FD, ">$out_cmake") || die "error $out_cmake";
146+ print $FD "# $header\n";
147+ print $FD "set(VERSION \"$version\")\n";
148+ if ($revision == undef) {
149+ print $FD "#set(SVNVERSION \"0000\")\n";
150+ } else {
151+ print $FD "set(SVNVERSION \"$revision\")\n";
152+ }
153+ print $FD "set(RELEASE $svninfo{'release'})\n";
154+ print $FD "set(DATE \"$date\")\n";
155+ print $FD "set(TIME \"$time\")\n";
156+ close($FD);
157+}
--- trunk/teraterm/teraterm/CMakeLists.txt (revision 8932)
+++ trunk/teraterm/teraterm/CMakeLists.txt (revision 8933)
@@ -91,7 +91,7 @@
9191 tt-version.rc
9292 teraterm_manifest.rc
9393 #
94-# ${CMAKE_CURRENT_BINARY_DIR}/../ttpdlg/svnversion.h
94+ ${CMAKE_CURRENT_BINARY_DIR}/../ttpdlg/svnversion.h
9595 #
9696 unicode_test.h
9797 unicode.h
@@ -245,11 +245,6 @@
245245 uuid
246246 )
247247
248-add_dependencies(
249- teraterm
250- svnversion_h
251- )
252-
253248 install(
254249 TARGETS teraterm
255250 DESTINATION .
Show on old repository browser