win32: update README, changing Visual Studio example from

2017 -> 2022 (2017 moved to "vs2017") and simplifying lpng
  build (use "nmake" - "libpng16_static.lib" -> "libpng.lib");
  update various ".sln", ".vcxproj" & "*.pro" files
update_version.php: update copyright year also in "*.rc" files
manual: note Ultracode 2023 now released but not yet supported
This commit is contained in:
gitlost 2023-12-16 13:06:48 +00:00
parent c9f0e61d78
commit f59bad1e6d
17 changed files with 238 additions and 429 deletions

View file

@ -2,7 +2,7 @@
/* Update Zint version number in various files */
/*
libzint - the open source barcode library
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2023 Robin Stuart <rstuart114@gmail.com>
*/
/* SPDX-License-Identifier: BSD-3-Clause */
@ -52,6 +52,8 @@ if ($build) {
$rc_str1 = "$major,$minor,$release,$build";
$rc_str2 = "$major.$minor.$release.$build";
$year = date("Y");
/* `$to_do` is no. of lines that should get replaced/changed, not no. of replacements */
function version_replace($to_do, $file, $match_pattern, $replace_pattern, $replace_str) {
global $basename;
@ -83,7 +85,7 @@ function version_replace($to_do, $file, $match_pattern, $replace_pattern, $repla
}
}
function rc_replace($file, $rc_str1, $rc_str2) {
function rc_replace($file, $rc_str1, $rc_str2, $year = '') {
global $basename;
if (($get = file_get_contents($file)) === false) {
@ -117,6 +119,24 @@ function rc_replace($file, $rc_str1, $rc_str2) {
if ($done !== 2) {
exit("$basename: ERROR: Only did $done replacements of 2 in file \"$file\"" . PHP_EOL);
}
if ($year !== '') {
$match_pattern = '/VALUE[ \t]+"LegalCopyright",[ \t]+"Copyright /';
$done = 0;
foreach ($lines as $li => $line) {
if (preg_match($match_pattern, $line)) {
$cnt = 0;
$lines[$li] = preg_replace('/[0-9]+/', $year, $line, 1, $cnt);
if ($cnt === 0 || $lines[$li] === NULL) {
exit("$basename: ERROR: Could not replace \"$match_pattern\" in file \"$file\"" . PHP_EOL);
}
$done++;
break;
}
}
if ($done !== 1) {
exit("$basename: ERROR: Failed to replace Copyright year in file \"$file\"" . PHP_EOL);
}
}
if (!file_put_contents($file, implode("\n", $lines))) {
exit("$basename: ERROR: Could not write file \"$file\"" . PHP_EOL);
}
@ -167,7 +187,7 @@ version_replace(1, $data_dirname . 'zint.nsi', '/^!define +PRODUCT_VERSION/', '/
// backend/libzint.rc
rc_replace($data_dirname . 'backend/libzint.rc', $rc_str1, $rc_str2);
rc_replace($data_dirname . 'backend/libzint.rc', $rc_str1, $rc_str2, $year);
// backend/zintconfig.h
@ -225,7 +245,7 @@ version_replace(1, $data_dirname . 'backend_tcl/lib/zint/pkgIndex.tcl', '/zint /
// frontend/zint.rc
rc_replace($data_dirname . 'frontend/zint.rc', $rc_str1, $rc_str2);
rc_replace($data_dirname . 'frontend/zint.rc', $rc_str1, $rc_str2, $year);
// frontend/Makefile.mingw
@ -253,7 +273,7 @@ version_replace(1, $data_dirname . 'docs/zint.1.pmd', '/^% ZINT\(1\) Version /',
// frontend_qt/res/qtZint.rc
rc_replace($data_dirname . 'frontend_qt/res/qtZint.rc', $rc_str1, $rc_str2);
rc_replace($data_dirname . 'frontend_qt/res/qtZint.rc', $rc_str1, $rc_str2, $year);
// win32/libzint.vcxproj
@ -265,7 +285,7 @@ version_replace(2, $data_dirname . 'win32/zint.vcxproj', '/ZINT_VERSION="/', '/Z
// win32/zint_cmdline_vc6/zint.rc
rc_replace($data_dirname . 'win32/zint_cmdline_vc6/zint.rc', $rc_str1, $rc_str2);
rc_replace($data_dirname . 'win32/zint_cmdline_vc6/zint.rc', $rc_str1, $rc_str2, $year);
// win32/zint_cmdline_vc6/zint_cmdline_vc6.dsp
@ -291,6 +311,14 @@ version_replace(6, $data_dirname . 'win32/vs2015/zint.vcxproj', '/ZINT_VERSION="
version_replace(1, $data_dirname . 'win32/vs2015/vsx/libzintMD.vcxproj', '/ZINT_VERSION="/', '/ZINT_VERSION="[0-9.]+"/', 'ZINT_VERSION="' . $v_str . '"');
// win32/vs2017/libzint.vcxproj
version_replace(2, $data_dirname . 'win32/vs2017/libzint.vcxproj', '/ZINT_VERSION="/', '/ZINT_VERSION="[0-9.]+"/', 'ZINT_VERSION="' . $v_str . '"');
// win32/vs2017/zint.vcxproj
version_replace(2, $data_dirname . 'win32/vs2017/zint.vcxproj', '/ZINT_VERSION="/', '/ZINT_VERSION="[0-9.]+"/', 'ZINT_VERSION="' . $v_str . '"');
// win32/vs2019/libzint.vcxproj
version_replace(2, $data_dirname . 'win32/vs2019/libzint.vcxproj', '/ZINT_VERSION="/', '/ZINT_VERSION="[0-9.]+"/', 'ZINT_VERSION="' . $v_str . '"');