Skip to content

Commit 2c1c7ae

Browse files
committed
Add prepare-release.
修改: .gitignore 修改: m4/readfile.m4 新文件: tools/prepare-release
1 parent 2d734eb commit 2c1c7ae

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ config.status
1818
# Build outputs
1919
include/libplatform.h
2020
Makefile
21+
22+
# Dist directory
23+
libplatform-*

m4/readfile.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# readfile.m4
2-
dnl Copyright (C) 2023 ChenPi11.
2+
dnl Copyright (C) 2023 The C++ Plus Project.
33
dnl This file is free software; The C++ Plus Project
44
dnl gives unlimited permission to copy and/or distribute it,
55
dnl with or without modifications, as long as this notice is preserved.

tools/prepare-release

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env bash
2+
3+
# Prepare libplatform release.
4+
# You need call this script on libplatform root directory.
5+
6+
# The libplatform library is free software; you can redistribute it
7+
# and/or modify it under the terms of the The Unlicense
8+
# as published by the unlicense.org.
9+
#
10+
# The libplatform library is distributed in the hope that it will be
11+
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the The
13+
# Unlicense for more details.
14+
#
15+
# You should have received a copy of the The Unlicense
16+
# along with the libplatform library; see the file LICENSE.
17+
# If not, see <https://unlicense.org>.
18+
19+
# Usage: ./prepare-releace [VERSION]
20+
#
21+
22+
usage()
23+
{
24+
echo "Usage: $0: [VERSION]"
25+
exit 1
26+
}
27+
28+
if [ "$1" == "" ]
29+
then
30+
usage
31+
else
32+
export VERSION="$1"
33+
fi
34+
35+
# Check git status
36+
if [[ $(git status --porcelain) ]]
37+
then
38+
# There are uncommitted changes
39+
git clean -fdxn
40+
echo "Warning: You need to store uncommitted changes or untracked files, or the release will be unsafe"
41+
echo "AND YOU UNTRACKED DATA WILL *LOST FOREVER*!!!!!!!!!!"
42+
exit 1
43+
fi
44+
45+
# Clean repo
46+
git clean -fdx
47+
48+
# Generate files
49+
make -f Makefile.devel
50+
51+
# Add project name to version
52+
export VERSION="libplatform-$VERSION"
53+
54+
# Remove old dist
55+
rm -rf $VERSION
56+
57+
# Copy files
58+
mkdir -p $VERSION
59+
60+
for f in $(ls -d * --color=never); do
61+
if [ "$f" != "tools" ] && [ "$f" != "$VERSION" ]
62+
then
63+
echo "Add file or directory: $f"
64+
cp -r "$f" $VERSION
65+
fi
66+
done

0 commit comments

Comments
 (0)