File tree 1 file changed +58
-0
lines changed
1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ for i in " $@ "
3
+ do
4
+ case $i in
5
+ PHP=* )
6
+ PHP=" ${i#* =} "
7
+ shift # past argument=value
8
+ ;;
9
+ ICONV=* )
10
+ ICONV=" ${i#* =} "
11
+ shift # past argument=value
12
+ ;;
13
+ HHC=* )
14
+ HHC=" ${i#* =} "
15
+ shift # past argument=value
16
+ ;;
17
+ _7Z=* )
18
+ _7Z=" ${i#* =} "
19
+ shift # past argument=value
20
+ ;;
21
+ VERSION=* )
22
+ VERSION=" ${i#* =} "
23
+ shift # past argument=value
24
+ ;;
25
+ * )
26
+ # unknown option
27
+ ;;
28
+ esac
29
+ done
30
+
31
+ PHP=" ${PHP:- $(which php)} "
32
+ ICONV=" ${ICONV:- $(which iconv)} "
33
+ HHC=" ${HHC:- $(which hhc)} "
34
+ _7Z=" ${_7Z:- $(which 7z)} "
35
+ VERSION=" ${VERSION:- $(date +% Y% m% d)} "
36
+ CPUS=" $( cat /proc/cpuinfo | grep -c ' ^processor' ) "
37
+
38
+ # 在执行下一步之前,移动reference或output目录下文件到当前目录
39
+ rm -rf chmhelp
40
+
41
+ # 防止loadHTMLFile乱码
42
+ find -iname ' *.html' | xargs -P " ${CPUS} " sed -i ' s/<head>/<head><meta charset="utf-8">/ig'
43
+
44
+ sed -e ' s/C \/ C++ 参考文档/C \/ C++ Documentation/g' -e ' s/0x804 中文(简体,中国)/0x409 English (United States)/g' -e ' s/$scriptDir\.DIRECTORY_SEPARATOR \."zh"/$scriptDir.DIRECTORY_SEPARATOR ."en"/' make_chm.php > make_chm_en.php
45
+
46
+ # 生成用于打包chm的文件
47
+ " ${PHP} " make_chm_en.php
48
+
49
+ # 设置ie兼容性,使样式正确显示
50
+ cd chmhelp
51
+ find -iname ' *.html' | xargs -P " ${CPUS} " sed -i ' s/<head>/<head><meta http-equiv="x-ua-compatible" content="ie=edge">/ig'
52
+ cd ..
53
+
54
+ sed " s/cppreference\.chm/cppreference-en-${VERSION} \.chm/" cppreference.hhp > " cppreference-en-${VERSION} .hhp"
55
+
56
+ # Compile and package UTF-8 version
57
+ " ${HHC} " " cppreference-en-${VERSION} .hhp"
58
+ " ${_7Z} " a -mx9 " cppreference-en-${VERSION} -chm-project.7z" " cppreference-en-${VERSION} .hhp" cppreference.{hhc,hhk} hh{a.dll,c.exe} chmhelp/*
You can’t perform that action at this time.
0 commit comments