mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
backend_tcl: add "licence.txt"; add note to "readme.txt"
re LINK32 tcl/tk libs update_version.php: add year replace for "licence.txt" above
This commit is contained in:
@ -142,6 +142,35 @@ function rc_replace($file, $rc_str1, $rc_str2, $year = '') {
|
||||
}
|
||||
}
|
||||
|
||||
function year_replace($file, $year) {
|
||||
global $basename;
|
||||
|
||||
if (($get = file_get_contents($file)) === false) {
|
||||
exit("$basename: ERROR: Could not read file \"$file\"" . PHP_EOL);
|
||||
}
|
||||
|
||||
$match_pattern = '/Copyright /';
|
||||
$lines = explode("\n", $get);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
// CMakeLists.txt
|
||||
|
||||
$file = $data_dirname . 'CMakeLists.txt';
|
||||
@ -243,6 +272,10 @@ version_replace(2, $data_dirname . 'backend_tcl/zint_tcl.dsp', '/ZINT_VERSION="\
|
||||
|
||||
version_replace(1, $data_dirname . 'backend_tcl/lib/zint/pkgIndex.tcl', '/zint /', '/zint [0-9.]+/', 'zint ' . $v_base_str . '');
|
||||
|
||||
// backend_tcl/licence.txt
|
||||
|
||||
year_replace($data_dirname . 'backend_tcl/licence.txt', $year);
|
||||
|
||||
// frontend/zint.rc
|
||||
|
||||
rc_replace($data_dirname . 'frontend/zint.rc', $rc_str1, $rc_str2, $year);
|
||||
|
Reference in New Issue
Block a user