first version.
[build-srcpkg.git] / bin / codetmpl
bloba1e6acd2210e1587d030d86be2873a94e7a4fddb
1 #!/bin/bash
2 ############################################################
3 # source: template
4 # author: CottonCandyOwner(CottonCandyOwner@126.com)
5 # date: 2023-03-02
6 ############################################################
7 # note:
8 # it's a code template utility.
9 ############################################################
12 # todoļ¼š
13 # @
14 # @
17 . shlibinc
19 include gplib.shlib
21 include stdio.shlib
22 #include term.shlib
23 include args.shlib
26 ##############################
27 # section: public comment info
28 ##############################
32 ##############################
33 # section: variable define
34 ##############################
38 dev_desc_str="
39 |prog $0 'project build util-program.'
40 |blank '[compile operation]'
42 |blank '[general]'
43 |param |- |-- |---help |= |%<help> |&<on_help> |'this helper text.'
45 |blank '[integrate srcpkg]'
46 |param |- |-- |---list |= |%<pkglist> |&<on_pkglist> |'list packages.'
47 #|param |- |-- |---listclear |= |%<pkglistclear> |&<on_pkglistclear> |'clear package list in current src pkg.'
48 |param |- |-- |---append |= |%<pkgadd> |&<on_pkgadd> |'add a pkg as a sub src pkg.'
49 |param |- |-- |---del |= |%<pkgdel> |&<on_pkgdel> |'delete a pkg from package list.'
50 |param |- |-- |---get |= |%<pkgrename> |&<on_pkgrename> |'rename package, not only pkg dir name, it modify names in all it is a text file.'
51 |param |- |-- |---done |= |%<pkgimport> |&<on_pkgimport> |'import a pkg in current src pkg sub dir.'
53 |blank '[one version task]'
54 |param |- |-- |---launch |=[dest] |%<filelist> |&<on_filelist> |'list files for specified dest in current src pkg to be compiled.'
55 |param |- |-- |---launchback |=[dest] |%<filelistclear> |&<on_filelistclear> |'clear file list for specified dest.'
56 |param |- |-- |---suspend |=[dest] |%<fileadd> |&<on_fileadd> |'add src file to specified dest.'
57 |param |- |-- |---resume |=[dest] |%<filedel> |&<on_filedel> |'delete src file to specified dest.'
58 |param |- |-- |---submit |=[dest] |%<moduleadd> |&<on_moduleadd> |'add module src file to specified dest.'
60 |blank
66 helper="
67 help - this document.
68 [compile operation]
69 clean - clean all the project under this workspace.
70 all - default. use native compiler to compile program.
71 cross - use CROSS_COMPILE to compile a cross program.
73 [install operation]
74 pkg - copy headers libs and programs into pkg dir.
75 devinstall - install pkg to system.
76 install - install executables to system.
77 crosspkg - copy headers libs and programs into pkg dir.
78 crossdevinstall - install pkg to cross-compiler.
79 crossinstall - install executables to system.
81 # [project operation]
82 addtestprj - create test project as a templete, exe & lib.
83 addtestprj - create test project as a templete, exe & lib.
84 list - list project in this workspace
85 addexe PRJ=<name> - add a new executable project from templete.
86 addlib PRJ=<name> - add a new library project from templete.
87 files.
88 listclear - clear all sub project in ws compile list.
89 rename OPRJ=<pld-name> PRJ=<new-name>
90 - rename a project.
92 [version operation]
93 version - get workspace version as A.B.C format.
94 verinc1 - increase first version number A.
95 verinc2 - increase second version number B.
96 verinc3 - increase third version number C.
98 # [misc operation]
99 check-env - check running enviroument, check make, gcc, inc
100 path, lib path, and so on. espesially usefull under
101 CROSS_COMPILE, it can automatically check lib path.
102 # distclean - make src-tarball all project in workspace to
103 - source dir, clean project dirs, move other
104 - dirs to misc.
105 backup - distclean, and src-tarball the workspace.
106 init - init project code in source dir, add them to workspace.
107 src-tarball - make a src tarball for this workspace.
112 # general
113 v_help=
115 # integrate srcpkg
116 v_list=
117 #v_listclear
118 v_append=
119 v_del=
120 v_get=
121 v_done=
123 # one version task
124 v_launch=
125 v_launchback=
126 v_suspend=
127 v_resume=
128 v_submit=
132 ##############################
133 # section: private function
134 ##############################
137 # fsyntax: on_subcmd_proc <param_name> <param_value>
138 # fdesc: on all sub-cmd response. it invoke paramter proc function
139 # defined in src pkg.
141 on_subcmd_proc ()
143 # TBD: invoke sub-cmd proc function defined in src pkg.
148 # fsyntax: on_help
149 # fdesc: on help sub-cmd.
151 on_help ()
153 # TBD:
159 # fsyntax: on_help
160 # fdesc: on help sub-cmd.
162 on_pkglist ()
164 # TBD:
169 # fsyntax: on_help
170 # fdesc: on help sub-cmd.
172 on_pkglistclear ()
174 # TBD:
179 # fsyntax: on_help
180 # fdesc: on help sub-cmd.
182 on_pkgadd ()
184 # TBD:
189 # fsyntax: on_help
190 # fdesc: on help sub-cmd.
192 on_pkgdel ()
194 # TBD:
199 # fsyntax: on_help
200 # fdesc: on help sub-cmd.
202 on_pkgrename ()
204 # TBD:
209 # fsyntax: on_help
210 # fdesc: on help sub-cmd.
212 on_pkgimport ()
214 # TBD:
220 # fsyntax: on_help
221 # fdesc: on help sub-cmd.
223 on_filelist ()
225 # TBD:
230 # fsyntax: on_help
231 # fdesc: on help sub-cmd.
233 on_filelistclear ()
235 # TBD:
240 # fsyntax: on_help
241 # fdesc: on help sub-cmd.
243 on_fileadd ()
245 # TBD:
250 # fsyntax: on_help
251 # fdesc: on help sub-cmd.
253 on_filedel ()
255 # TBD:
260 # fsyntax: on_help
261 # fdesc: on help sub-cmd.
263 on_moduleadd ()
265 # TBD:
271 ##############################
272 # section: public function
273 ##############################
277 main_dev ()
280 return
284 #echo xxxxxxxxxxaaa
285 #exit
287 main_dev "$@"
290 ##############################
291 # section: file tail
292 ##############################