2 ############################################################
4 # author: CottonCandyOwner(CottonCandyOwner@126.com)
6 ############################################################
7 # Copyright (C) 2022- Free Software Foundation, Inc.
8 # This configure script is free software; the Free Software
9 # Foundation gives unlimited permission to copy, distribute
11 ############################################################
13 # develop operation on srcpkg. this script is oriented
15 # suppose there is a man does not doing coding work,
16 # put the operations here.
17 ############################################################
30 include build-srcpkg
/srcpkg.shlib
36 ##############################
37 # section: public comment info
38 ##############################
42 ##############################
43 # section: variable define
44 ##############################
49 # this comment is used for version id auto update.
56 readonly SRCPKG_VER_DATE
=20240201
59 readonly SRCPKG_PROG
=`basename $0`
61 readonly SRCPKG_PROG_VERSION
="v${SRCPKG_V1}.${SRCPKG_V2}\${SRCPKG_V3:+\".$SRCPKG_V3\"}\${SRCPKG_VEXT:+\"$SRCPKG_VEXT\"}\${SRCPKG_VER_DATE:+\"-$SRCPKG_VER_DATE\"}"
62 SRCPKG_PROG_VERSION_STR
="`eval echo $SRCPKG_PROG_VERSION`
63 Copyright (C) 2023- Free Software Foundation, Inc.
64 This configure script is free software; the Free Software
65 Foundation gives unlimited permission to copy, distribute
68 Writen by CottenCandyOwner(CottenCandyOwner@126.com).
71 SRCPKG_PROG_BANNER
="$SRCPKG_PROG $SRCPKG_PROG_VERSION_STR"
72 SRCPKG_PROG_SYNTAX
='Usage: $SRCPKG_PROG -[${p_shortparam//\|/}]'
73 SRCPKG_PROG_DESC
=" develop operation on srcpkg. this script is oriented srcpkg srcpkg.
74 suppose there is a man does not doing coding work, put the operations here.
77 SRCPKG_PROG_OTHER_DESC
="
80 @ code generating and synchronizing:
83 s[y]nchronize code to output dir.
88 SRCPKG_USAGE_FMT
='$SRCPKG_PROG_BANNER
92 $SRCPKG_PROG_OTHER_DESC'
96 # do not delete this comment, it is used for var define code intert.
98 # args-var-define-begin
103 # desc-str for srcpkg
104 # @ every paramter desc-str-line start with 'param'.
105 # @ every colum start with '|', and seperated by blanks.
106 # @ '|blank' means a blank line dispalyed in helper.
107 # @ follow with a '' quoated string is the option category string.
108 # @ comment '#' in desc-str is also supported, and can be used to
109 # disable some option have not been implemented.
110 # @ desc-str can be in multiple var. and some of them maybe re-used
111 # for other program by 'source xxx --loadshlib'.
113 srcpkg_desc_hdr_str
="
114 |prog $0 'operations in develop. it include srcpkg operation, code operation, project file operation, and other features beyound cmpl.'
117 # @ PARAMETER DEFINE.
118 # this desc str would be referenced in scripttest, consider about opt name space.
119 # =, param name for opt.
120 # %, var name if this opt is enabled.
121 # &, proc func if opt trigged.
124 |param |- |-- |---devinfo |= |%<devinfo> |&<on_devinfo> |'developer info for developping.'
125 |param |- |-- |---mailreg |= |%<mailreg> |&<on_mailreg> |'register a mail by inf in devinfo.'
126 |param |- |-- |---devchk |= |%<devchk> |&<on_devchk> |'genral develop environment check.'
128 |param |- |-- |---author |=[author]|%<author> |&<on_author> |'list author, or switch to specified account.'
129 |param |- |-- |---org |=[org] |%<org> |&<on_org> |'list org, or switch to specified org.'
132 |param |- |-- |---pkgwiz |= |%<pkgwiz> |&<on_pkgwiz> |'srcpkg info cli wizard, and save to .pkginfo.'
133 |param |- |-- |---pkgwizard |= |%<pkgwizard> |&<on_pkgwizard> |'srcpkg info TUI wizard, and save to .pkginfo.'
134 |param |- |-- |---pkginit |=[type] |%<pkginit> |&<on_pkginit> |'init srcpkg dir & files by .pkginfo file.'
135 |'install build-srcpkg/shlib/... into srcpkg, '
136 |'by specifying pkginit type.'
137 |param |- |--gen-dir |--- |= |%<gendir> |&<on_gendir> |'generate dir structure of srcpkg.'
138 |param |- |--instcmpl |--- |=[cmpl] |%<cmpl> |&<on_instcmpl> |'install builder for compile.'
139 |param |- |--initcmpl |--- |= |%<initcmpl> |&<on_initcmpl> |'init for compile dest.'
140 |param |- |--insttest |--- |=[ttype] |%<insttest> |&<on_insttest> |'install builder for compile.'
141 |param |- |--instoptgen |--- |= |%<instoptgen>|&<on_instoptgen>|'install builder for compile.'
142 |param |- |--instcfg |--- |= |%<instcfg> |&<on_instcfg> |'install builder for compile.'
143 |param |- |--instscripttest |--- |= |%<cmpl> |&<on_instscrt> |'install builder for compile.'
144 |param |- |--instfullcmpl |--- |= |%<fullcmpl> |&<on_instfullcmpl>|'install builder for compile.'
145 |param |- |-- |---pkgchk |= |%<pkgchk> |&<on_pkgchk> |'check dirs if it is a standard srcpkg.'
146 |param |- |-- |---pkgreg |= |%<pkgreg> |&<on_pkgreg> |'regist srcpkg on repo.or.cz with info in .pkginfo.'
147 |param |- |-- |---pkgrename |=<pkgname>|%<pkgrename>|&<on_pkgrename> |'rename package, not only pkg dir name, it modify names in all it is a text file.'
148 |param |- |-- |---srcbak |= |%<srcbak> |&<on_srcbak> |'distclean src pkg, and make an archive to backup dir. it is used for src code publish, or daily code backup.'
151 |param |- |-- |---pkginfo |= |%<pkginfo> |&<on_pkginfo> |'.pkginit to .pkginfo file.'
152 |param |- |-- |---listval |= |%<listval> |&<on_listval> |'list var & val in .pkginfo file.'
153 |param |- |-- |---getval |=<vname> |%<vname> |&<on_getval> |'get value for the var in .pkginfo.'
154 |param |- |-- |---setval |=<vname> |%<vname> |&<on_setval> |'set value to specified var in .pkginfo.'
156 |blank '[reporistry]'
157 |param |- |-- |---reposync |= |%<reposync> |&<on_reposync> |'pull code from src reporistray.'
158 |param |- |-- |---branch |=[name] |%<branch> |&<on_branch> |'make new branch for current src pkg, and save it with branch sfx name in upper dir. rename orignial src pkg dir with '-org' sfx. and create a link file to new branch code dir. at the same time, create branch in code reporistray.'
159 |param |- |-- |---combine |=<org|branch> |%<combine> |&<on_combine>|'combine code to specified dir manually, and delete branch dir. synchronize it in src reporistray.'
160 |param |- |-- |---commit |= |%<commit> |&<on_commit> |'push code to src reporistray.'
163 |param |- |-- |---incv1 |= |%<incv1> |&<on_incv1> |'increase major version code id.'
164 |param |- |-- |---incv2 |= |%<incv2> |&<on_incv2> |'increase minor version code id.'
165 |param |- |-- |---incv3 |= |%<incv3> |&<on_incv3> |'increase patching version code id.'
166 |param |- |-- |---decv1 |= |%<decv1> |&<on_decv1> |'decrease major version code id.'
167 |param |- |-- |---decv2 |= |%<decv2> |&<on_decv2> |'decrease minor version code id.'
168 |param |- |-- |---decv3 |= |%<decv3> |&<on_decv3> |'decrease patching version code id.'
169 |param |- |-- |---webpages |= |%<webpages> |&<on_webpages> |'generate web pages for home page.'
170 |param |- |-- |---publish |= |%<publish> |&<on_publish> |'bulid binary and docs, invoke commit, '
171 'invoke srcbak to backup src code, transfer'
172 'them to server space. invoke incvX, webpages,'
173 'webupdate, to update web pages.'
176 |param |- |--install-build |--- |= |%<incv1> |&<on_incv1> |'install build-srcpkg to current srcpkg.'
177 |param |- |--init-dir |--- |= |%<incv1> |&<on_incv1> |'initialize dir structure as a standard srcpkg.'
181 srcpkg_other_desc_str
="
183 |blank 'Version & Helper & Debug:'
184 |param |- |-- |---version |= |%<version> |&<on_version> |'output version info of this program.'
185 |param |- |--help |---help |= |%<help> |&<on_help> |'this helper text doc.'
190 ##############################
191 # section: private function
192 ##############################
196 ##################################################################
198 ##################################################################
203 # fdesc: on author sub-cmd.
207 echo xxxxxxxxxxxxxxxxxxxxxxxx on_author
"$@"
212 # fdesc: on org sub-cmd.
216 echo xxxxxxxxxxxxxxxxxxxxxxxx on_org
"$@"
220 # fsyntax: on_devinfo
221 # fdesc: on devinfo sub-cmd.
225 echo xxxxxxxxxxxxxxxxxxxxxxxx on_devinfo
"$@"
230 ##################################################################
231 # cmdline opt on_xxx() proc.
232 ##################################################################
235 # fsyntax: on_devinfo
236 # fdesc: on devinfo sub-cmd.
240 echo xxxxxxxxxxxxxxxxxxxxxxxx on_devinfo
"$@"
244 # fsyntax: on_mailreg
245 # fdesc: on mailreg sub-cmd.
249 # create dir skeletone
251 # install build-srcpkg & create init
252 echo xxxxxxxxxxxxxxxxxxxxxxxx on_mailreg
"($@)"
257 # fdesc: on pkgwiz sub-cmd.
266 # fsyntax: on_pkgwizard
267 # fdesc: on pkgwizard sub-cmd.
271 # create dir skeletone
273 # install build-srcpkg & create init
274 echo xxxxxxxxxxxxxxxxxxxxxxxx on_pkgwizard
"($@)"
278 # fsyntax: on_pkginfo
279 # fdesc: on pkginfo sub-cmd.
287 # fsyntax: on_listval
288 # fdesc: on listval sub-cmd.
297 # fdesc: on getval sub-cmd.
306 # fdesc: on setval sub-cmd.
316 # fdesc: on pkginit sub-cmd.
320 # load .pkginit & style param.
323 # echo Style = ${Style}
324 # echo CodingStyle = ${CodingStyle}
325 # echo CodingTmpl = ${CodingTmpl}
326 # echo NamingStyle = ${NamingStyle}
327 # echo TmplParam = ${TmplParam}
328 # echo SrcpkgStyle = ${SrcpkgStyle}
329 # echo InstpkgStyle = ${InstpkgStyle}
331 # create dir skeletone
334 # codegen if design/module-design.catalog existing.
335 [[ -e design
/module-design.catalog
]] && codegen
-y
336 [[ -e testing
/testing.catalog
]] && scripttest
-y
340 # fsyntax: on_instcmpl
341 # fdesc: on pkginit sub-cmd.
345 # load .pkginit & style param.
348 # install build-srcpkg
349 srcpkg_install_builder .
/tools
353 # fsyntax: on_initcmpl
354 # fdesc: on pkginit sub-cmd.
358 # load .pkginit & style param.
366 # fsyntax: on_insttest
367 # fdesc: on pkginit sub-cmd.
371 # load .pkginit & style param.
378 # fsyntax: on_instoptgen
379 # fdesc: on pkginit sub-cmd.
383 # load .pkginit & style param.
390 # fsyntax: on_instcfg
391 # fdesc: on pkginit sub-cmd.
395 # load .pkginit & style param.
402 # fsyntax: on_instscrt
403 # fdesc: on pkginit sub-cmd.
407 # load .pkginit & style param.
414 # fsyntax: on_instfullcmpl
415 # fdesc: on pkginit sub-cmd.
419 # load .pkginit & style param.
426 # fsyntax: on_pkginit
427 # fdesc: on pkginit sub-cmd.
434 echo xxxxxxxxxxxxxxxxxxxxxxxx on_pkginit
"($@)"
449 # fdesc: on pkgchk sub-cmd.
453 # create dir skeletone
455 # install build-srcpkg & create init
456 echo xxxxxxxxxxxxxxxxxxxxxxxx on_pkgchk
"($@)"
461 # fdesc: on pkgreg sub-cmd.
465 # create dir skeletone
467 # install build-srcpkg & create init
468 echo xxxxxxxxxxxxxxxxxxxxxxxx on_pkgreg
"($@)"
472 # fsyntax: on_pkgrename
473 # fdesc: on pkgrename sub-cmd.
477 # create dir skeletone
479 # install build-srcpkg & create init
480 echo xxxxxxxxxxxxxxxxxxxxxxxx on_pkgrename
"($@)"
485 # fdesc: on srcbak sub-cmd.
491 dir
="$(basename $PWD)"
492 file="${dir}-$(date +%Y%m%d).zip"
495 mkdir
-pv $
(dirname $file)
496 rm ${file} 2>/dev
/null
497 echo "zip -r ${file} ${dir}"
498 zip -r ${file} ${dir}
501 [[ $SRCBAK_DIR != '../' && $SRCBAK_DIR != '..' ]] && mkdir
-pv $SRCBAK_DIR && mv ..
/$file ${SRCBAK_DIR}/ -f
507 # fsyntax: on_reposync
508 # fdesc: on reposync sub-cmd.
512 # create dir skeletone
514 # install build-srcpkg & create init
515 echo xxxxxxxxxxxxxxxxxxxxxxxx on_reposync
"($@)"
520 # fdesc: on branch sub-cmd.
524 # create dir skeletone
526 # install build-srcpkg & create init
527 echo xxxxxxxxxxxxxxxxxxxxxxxx on_branch
"($@)"
531 # fsyntax: on_combine
532 # fdesc: on combine sub-cmd.
536 # create dir skeletone
538 # install build-srcpkg & create init
539 echo xxxxxxxxxxxxxxxxxxxxxxxx on_combine
"($@)"
544 # fdesc: on commit sub-cmd.
548 # create dir skeletone
550 # install build-srcpkg & create init
551 echo xxxxxxxxxxxxxxxxxxxxxxxx on_commit
"($@)"
556 PRJ_NAME
=`ls *.pc | sed -e "s/\.pc.*$$//g"`
557 sed -e "s/Version:.*$$/Version: $1/g" -i $
$PRJ_NAME.pc
562 # fdesc: on incv1 sub-cmd.
566 echo xxxxxxxxxxxxxxxxxxxxxxxx on_incv1
"($@)"
568 SRCPKG_NAME
=`ls *.pc | sed -e "s/\.pc.*$$//g"`
569 VERSION
=`cat $SRCPKG_NAME.pc | grep -e "Version:" | sed -e "s/Version: //g"`
570 VER1
=`echo $VERSION | cut -d "." -f1`
571 VER1
=`expr $VER1 + 1`
574 echo $
$VER1.$
$VER2.$
$VER3
575 set_prj_version
"$VER1" "$VER2" "$VER3"
580 # fdesc: on incv2 sub-cmd.
584 echo xxxxxxxxxxxxxxxxxxxxxxxx on_incv2
"($@)"
586 SRCPKG_NAME
=`ls *.pc | sed -e "s/\.pc.*$$//g"`
587 VERSION
=`cat SRCPKG_NAME.pc | grep -e "Version:" | sed -e "s/Version: //g"`
588 VER1
=`echo $VERSION | cut -d "." -f1`
589 VER2
=`echo $VERSION | cut -d "." -f2`
590 VER2
=`expr $VER2 + 1`
592 echo $VER1.
$VER2.
$VER3
593 set_prj_version
"$VER1" "$VER2" "$VER3"
598 # fdesc: on incv3 sub-cmd.
602 echo xxxxxxxxxxxxxxxxxxxxxxxx on_incv3
"($@)"
604 SRCPKG_NAME
=`ls *.pc | sed -e "s/\.pc.*$$//g"`
605 VERSION
=`cat $PRJ_NAME.pc | grep -e "Version:" | sed -e "s/Version: //g"`
606 VER1
=`echo $VERSION | cut -d "." -f1`
607 VER2
=`echo $VERSION | cut -d "." -f2`
608 VER3
=`echo $VERSION | cut -d "." -f3`
609 VER3
=`expr $VER3 + 1`
610 echo $VER1.
$VER2.
$VER3
611 set_prj_version
"$VER1" "$VER2" "$VER3"
616 # fdesc: on decv1 sub-cmd.
620 # create dir skeletone
622 # install build-srcpkg & create init
623 echo xxxxxxxxxxxxxxxxxxxxxxxx on_decv1
"($@)"
628 # fdesc: on decv2 sub-cmd.
632 # create dir skeletone
634 # install build-srcpkg & create init
635 echo xxxxxxxxxxxxxxxxxxxxxxxx on_decv2
"($@)"
640 # fdesc: on decv3 sub-cmd.
645 echo xxxxxxxxxxxxxxxxxxxxxxxx on_decv3
"($@)"
649 # fsyntax: on_webpages
650 # fdesc: on webpages sub-cmd.
654 echo xxxxxxxxxxxxxxxxxxxxxxxx on_webpages
"($@)"
656 gendocs.sh
--email bug-gnu-emacs@gnu.org emacs
"GNU Emacs Manual"
660 # fsyntax: on_publish
661 # fdesc: on publish sub-cmd.
665 echo xxxxxxxxxxxxxxxxxxxxxxxx on_publish
"($@)"
667 # update webpages generated in build/output/doc/
672 # fsyntax: on_version
673 # fdesc: on version sub-cmd.
677 eval echo "$CMPL_PROG_VERSION"
684 # fdesc: on help sub-cmd.
688 [[ -z $term_width ]] && term_width
=80
690 helper
="$(opt_helper)"
691 eval SRCPKG_PROG_SYNTAX
="\"$SRCPKG_PROG_SYNTAX\""
692 eval echo -ne "\"$SRCPKG_USAGE_FMT\""
699 ##############################
700 # section: public function
701 ##############################
707 [[ "$@" =~
'--load' ]] && return
712 # prog_opt_dispatch "$@"
713 opt_desc_str_dispatch srcpkg_desc_hdr_str
714 opt_desc_str_dispatch srcpkg_desc_str
715 opt_desc_str_dispatch srcpkg_other_desc_str
718 init_dbglogout
2 testing
20000
719 # set_output_prefix info ""
722 # SRCPKG_DIR="$(pwd)"
723 # TEST_DIR_STR_FMT="$(attr_get catalog::testdir::STR_FMT)"
727 # running action list function for options after init.
728 # the paramter for init will be effact, then execute the
734 if [[ "$@" =~
"--debug" ]]; then
735 declare -g DBGOUTD_OUTPUT
=1
737 # does not need to shift args if the --debug option is not the
738 # first option. it will be ignore in process.
742 if [[ $1 != "--loadshlib" ]]; then
750 ##############################
752 ##############################