参见:https://blog.csdn.net/weixin_34232744/article/details/91548051

下载和安装

wget 下载有点儿慢,有时候没得科学上网,慢上加慢了。

首先是下载解压安装一条龙:

  1. wget http://jaist.dl.sourceforge.net/project/kmphpfm/mwget/0.1/mwget_0.1.0.orig.tar.bz2
  2. tar -jxvf mwget_0.1.0.orig.tar.bz
  3. cd mwget_0.1.0.orig
  4. /.configure

这时候configure 可能会发生报错:

configure: error: Your intltool is too old.  You need intltool 0.35.0 or later.

切换一下环境,尝试用conda 安装一下:

conda activate mess

conda install intltool

再次编译安装:

./configure

make


make 又发生报错了:

ttpplugin.cpp:149:14: error: ‘strstr’ was not declared in this scope
  149 |   filename = strstr(filename, "filename=");
      |              ^~~~~~
httpplugin.cpp:149:14: note: ‘strstr’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
httpplugin.cpp:151:16: error: ‘strlen’ was not declared in this scope
  151 |    filename += strlen("filename=");
      |                ^~~~~~
httpplugin.cpp:151:16: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
make[2]: *** [Makefile:385: httpplugin.o] Error 1
make[2]: Leaving directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig/src'
make[1]: *** [Makefile:323: all-recursive] Error 1
make[1]: Leaving directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig'

参考:https://blog.csdn.net/lihengchang0212/article/details/89946235

主要对两个文件修改一下:

make[2]: *** [Makefile:385: httpplugin.o] Error 1
Leaving directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig/src'
make[1]: *** [Makefile:323: all-recursive] Error 1
make[1]: Leaving directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig'

在httpplugin.cpp头文件中添加:

#include <string.h>
#include <string>
using std::string;

又报错了,接着来:

make[2]: *** [Makefile:385: ftpplugin.o] Error 1
make[2]: Leaving directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig/src'

(后面还经历了几次报错,这里统一记录一下)在ftpplugin.cpp, downloader.cpp添加一下:

#include <string.h>
#include <string>
using std::string;

终于成功了:

...
file=`echo zh_CN | sed 's,.*/,,'`.gmo \
  && rm -f $file && /home/yzpeng/miniconda3/envs/mess/bin/msgfmt -o $file zh_CN.po
make[2]: Leaving directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig/po'
make[2]: Entering directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig'
make[2]: Leaving directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig'
make[1]: Leaving directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig'

接着make install 又发生了权限错误:

make install

...
/usr/bin/install: cannot create regular file '/usr/local/bin/mwget': Permission denied
make[2]: *** [Makefile:315: install-binPROGRAMS] Error 1
make[2]: Leaving directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig/src'
make[1]: *** [Makefile:506: install-am] Error 2
make[1]: Leaving directory '/home/data/yzpeng/3.biosoft/other_soft/mwget_0.1.0.orig/src'
make: *** [Makefile:323: install-recursive] Error 1

我们需要把软件编译到用户家目录的bin 文件夹中:

make install DESTDIR=/home/user/bin

成功了~

~/0.bin
$ bin/mwget 
mwget: missing URL
Usage:  mwget  [Options]... [URL]...

Try `mwget --help` for more options,Thanks!

我们将它放到bin 目录中:

cd 0.bin
ln -s ../bin/wget .

使用

$ mwget -h
GNU MWget 0.1.0 ,a non-interactive and multiline network retriever of all POSTIX Systems.
Usage:  mwget  [Options]... [URL]...
Options:
  -b,  --debug          Show the debug message
  -c,  --count=num      Set the retry count to [num], no limit when "0", the default is "99"
  -d,  --directory=dir  Set the local direcotry to [dir], the default is "."
  -f,  --file=file      Rename the file to [file]
  -h,  --help           A brief summary of all the options
  -i,  --interval=num   Set the ftp retry interval to [num] seconds, the default is "5"
  -n,  --number=num     Use [num] connections instead of the default (4)
  -r,  --referer=URL    Include `Referer: [URL]' header in HTTP request.
  -t,  --timeout=num    Set the connection timeout to [num] seconds, the default is "30"
  -v,  --version        Show the version of the mwget and exit
  -x,  --proxy=URL      Set the proxy [URL]


Mail bug reports and suggestions to <sa@kmlinux.tk><xiao_suo@hotmail.com>
On website bug reports and suggestions to <http://mwget.sourceforge.net/> <http://www.kmlinux.tk/>
We Welcome your BUG REPORT!

其实最主要的参数还是这个 -n,设置多线程下载的数目。

尝试下载一个annovar 上的数据:

nohup mwget -n 16 --file=hg38_1000g2015aug.zip http://www.openbioinformatics.org/annovar/download/hg38_1000g2015aug.zip &

比较一下速度:

# mwget
Begin to download: hg38_exac03.txt.idx.gz
FileSize: 6.1M
100% [=========================================>===] [6.1M] [1.9M/s]

# wget
hg38_exac03.txt.idx  36%[======>             ]   2.22M   174KB/s    eta 21s

快了不少。