MinGW 自动批量下载源码

最近工作中要用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);

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值