您的位置:首页 > 其它

MinGW 自动批量下载源码

2012-12-02 20:03 176 查看
最近工作中要用FORTRAN,自然就想到了要用MinGW,官方给的mingw-get-inst还是很好用的。如果网络不给力,可以网搜索MinGW离线下载安装包。

如果想要获得相应包的码,可以使用mingw-get source pakcagename

如果想要获得已安装包的全部源码,怎么办?

那就动手改一下mingw-get的源码。

已改好的,可以直接下载使用:

http://download.csdn.net/detail/waji2000/4837926

1、将mingw-get-0.dll覆盖C:\MinGW\libexec\mingw-get目录下的原文件。

2、将mingw-get.exe覆盖C:\MinGW\bin目录下的原文件。

3、使用命令

mingw-get update

mingw-get --download-only upgrade

说明:基于mingw-get-0.5-mingw32-beta-20120426-1-src修改。

修改的地方:

1、在pkgbase.h中类pkgXmlDocument添加相应的函数,可直接加在 void RescheduleInstalledPackages( unsigned long );下面:

void DownloadSourcePackages( unsigned long );

2、在pkgdeps.cpp中添加如下函数:

void pkgXmlDocument::DownloadSourcePackages( unsigned long action )

{

/* Wrapper function to retrieve the list of all installed packages,

* passing each entry in turn to the standard task scheduler. We

* begin by locating the first sysroot entry in the XML database...

*/

pkgXmlNode *sysroot = GetRoot()->FindFirstAssociate( sysroot_key );

/* ...then, while we have sysroots to examine...

*/

while( sysroot != NULL )

{

/* ...we retrieve the first package installation record within

* the current sysroot data set.

*/

pkgXmlNode *package = sysroot->FindFirstAssociate( installed_key );

/* Within each sysroot, until we've retrieved all embedded

* installation records...

*/

while( package != NULL )

{

/* ...we read the canonical tarname for the package,

* and when it is appropriately specified...

*/

const char *tarname = package->GetPropVal( tarname_key, NULL );

if( tarname != NULL )

{

/* ...we decode it, to determine the package name,

* subsystem name and component class.

*/

pkgSpecs decode( tarname );

const char *pkgname = decode.GetPackageName();

const char *sysname = decode.GetSubSystemName();

const char *cptname = decode.GetComponentClass();

/* From these three, we need to reconstruct an effective

* package name for the scheduler look-up; this reconstruction

* is performed using the following formatted buffer.

*/

const char *fmt = "%s-%s";

char refname[3 + strlen( sysname ) + strlen( pkgname ) + strlen( cptname )];

if( FindPackageByName( pkgname, sysname ) == NULL )

{

/* The package name alone is insufficient for a successful

* look-up; assume that the effective package name has been

* defined by prefixing the sysroot name.

*/

sprintf( refname, fmt, sysname, pkgname );

pkgname = refname;

}

if( cptname != NULL )

{

/* A fully qualified logical package name should include

* the component class name, abstracted from the canonical

* tarname, and appended to the package name.

*/

sprintf( refname, fmt, pkgname, cptname );

pkgname = refname;

}

/* Having constructed the effective logical package name,

* we download the source

*/

GetSourceArchive( pkgname, action );

}

/* ...then move on to the next installed package, if any,

* within the current sysroot data set...

*/

package = package->FindNextAssociate( installed_key );

}

/* ...and ultimately, to the next sysroot, if any, in the

* XML database.

*/

sysroot = sysroot->FindNextAssociate( sysroot_key );

}

}

3、在climain.cpp中在 dbase.RescheduleInstalledPackages( ACTION_UPGRADE );下增加如下语句:

dbase.DownloadSourcePackages(ACTION_SOURCE);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: