Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
jiejieTop committed Jun 15, 2022
1 parent 3d38c8d commit 22bbdb3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ main() {
fun_do_config

# [-h] [-e] [-i install path] [-c compiler path]
ARGS=$(getopt -o hdrei::c::s:: --long help,clean,debug,release,example,install::,compiler::,shared::,toolchanin: -- "$@")
ARGS=$(getopt -o hdrei::c:s:: --long help,clean,debug,release,example,install::,compiler:,shared::,toolchanin: -- "$@")
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
Expand Down
35 changes: 26 additions & 9 deletions make_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ fun_do_generate_ld_conf() {
mkdir -p ${work_dir}/${deb_name}${ld_so_config_path}
fi

sudo echo "$mqttclient_ld_conf_file" > ${work_dir}/${deb_name}${ld_so_config_path}/${deb_name}.conf
sudo echo "$mqttclient_ld_conf_file" >${work_dir}/${deb_name}${ld_so_config_path}/${deb_name}.conf
}

fun_do_help() {
echo "usage: $0 [-i install path] [-c compiler / compiler path] [-d] [-r] [-s <on> <off>] [-n <name>]"
echo "usage: $0 [-i install path] [-c compiler / compiler path] [-s <on> <off>] [-n <name>]"
echo "[-r / --release] [-d / --debug] [--toolchanin <toolchanin file>]"
echo " [-i] install path: install $deb_name path"
echo " [-c] compiler: specify the compiler you are using, default: gcc"
echo " [-c] compiler path: specify the compiler path you are using"
Expand All @@ -59,12 +60,12 @@ fun_do_help() {
echo " $0"
echo " $0 -i"
echo " $0 -i /usr/lib/"
echo " $0 -carm-linux-gnueabihf-gcc"
echo " $0 -c/usr/bin/arm-linux-gnueabihf-gcc"
echo " $0 -c arm-linux-gnueabihf-gcc"
echo " $0 -c /usr/bin/arm-linux-gnueabihf-gcc"
echo " $0 -r"
echo " $0 -d"
echo " $0 -soff"
echo " $0 -son"
echo " $0 -n <name>"
echo " $0 --toolchanin [toolchanin file]"
}

fun_do_install() {
Expand All @@ -78,6 +79,11 @@ fun_do_install() {
fun_do_compiler() {
if [ " $1" != " " ]; then
compiler=$1
compiler_path=$(which $compiler)
if [ " $compiler_path" == " " ]; then
echo -e "\033[31mNo $compiler compiler found in the system\033[0m"
exit
fi
fi
}

Expand All @@ -95,6 +101,12 @@ fun_do_config_shared() {
fi
}

fun_do_toolchanin() {
if [ " $1" != " " ]; then
toolchanin=$1
fi
}

fun_do_config_name() {
if [ " $1" != " " ]; then
deb_name=$1
Expand All @@ -109,13 +121,13 @@ fun_do_make_deb() {
# 去掉临时安装目录的前缀
sudo sed -i "s#${work_dir}/$deb_name##g" $(find ${work_dir}/$deb_name -name "*.cmake")
# 分号换行,避免太长
sudo sed -i "s#;#;\n#g" $(find ${work_dir}/$deb_name -name "*.cmake")
sudo sed -i "s#;#;#g" $(find ${work_dir}/$deb_name -name "*.cmake")
$work_dir/build_deb.sh "${work_dir}/$deb_name/" "$deb_name.deb"
}

fun_do_arg_init() {
if [ " $compiler_path" != " " ]; then
build_arg="-c${compiler_path} ${build_arg}"
build_arg="-c ${compiler_path} ${build_arg}"
fi

if [ " $install_path" != " " ]; then
Expand All @@ -134,7 +146,7 @@ fun_do_arg_init() {
}

main() {
ARGS=$(getopt -o hrdi::c::s::n: --long help,release,debug,install::,compiler::,shared::,name: -- "$@")
ARGS=$(getopt -o hrdi::c:s::n: --long help,release,debug,install::,compiler::,shared:,name:,toolchanin: -- "$@")
if [ $? != 0 ]; then
echo "Terminating..." >&2
exit 1
Expand Down Expand Up @@ -167,6 +179,11 @@ main() {
fun_do_build_debug
shift
;;
--toolchanin)
fun_do_toolchanin $2
shift
exit 0
;;
-h | --help)
fun_do_help
shift
Expand Down

0 comments on commit 22bbdb3

Please sign in to comment.