From 54e728078bcc9538516698220bf42d53a4762835 Mon Sep 17 00:00:00 2001
From: Justin Lecher <jlec@gentoo.org>
Date: Wed, 30 Jun 2010 20:55:04 +0000
Subject: Fixed broken allignment, #315387 (Portage version: 2.2_rc67/cvs/Linux
 x86_64)

---
 sci-libs/mmdb/ChangeLog                   |   8 +-
 sci-libs/mmdb/files/1.21-allignment.patch | 278 ++++++++++++++++++++++++++++++
 sci-libs/mmdb/mmdb-1.21-r1.ebuild         |  48 ++++++
 3 files changed, 333 insertions(+), 1 deletion(-)
 create mode 100644 sci-libs/mmdb/files/1.21-allignment.patch
 create mode 100644 sci-libs/mmdb/mmdb-1.21-r1.ebuild

(limited to 'sci-libs/mmdb')

diff --git a/sci-libs/mmdb/ChangeLog b/sci-libs/mmdb/ChangeLog
index 70ee5d6f21e3..1686ede8eb33 100644
--- a/sci-libs/mmdb/ChangeLog
+++ b/sci-libs/mmdb/ChangeLog
@@ -1,6 +1,12 @@
 # ChangeLog for sci-libs/mmdb
 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sci-libs/mmdb/ChangeLog,v 1.6 2010/06/28 21:36:43 angelos Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/mmdb/ChangeLog,v 1.7 2010/06/30 20:55:04 jlec Exp $
+
+*mmdb-1.21-r1 (30 Jun 2010)
+
+  30 Jun 2010; Justin Lecher <jlec@gentoo.org> +files/1.21-allignment.patch,
+  +mmdb-1.21-r1.ebuild:
+  Fixed broken allignment, #315387
 
   28 Jun 2010; Christoph Mende <angelos@gentoo.org> mmdb-1.21.ebuild:
   Stable on amd64 wrt bug #326031
diff --git a/sci-libs/mmdb/files/1.21-allignment.patch b/sci-libs/mmdb/files/1.21-allignment.patch
new file mode 100644
index 000000000000..d98ddae949eb
--- /dev/null
+++ b/sci-libs/mmdb/files/1.21-allignment.patch
@@ -0,0 +1,278 @@
+diff --git a/src/file_.cpp b/src/file_.cpp
+index 4071886..6bfa648 100644
+--- a/src/file_.cpp
++++ b/src/file_.cpp
+@@ -347,10 +347,10 @@ int  i;
+           if (i>0)  sleep ( 1 );
+ #endif
+           if (TextMode)  {
+-            if (ReadOnly)  hFile = fopen ( FName,"r"   );
++            if (ReadOnly)  hFile = fopen ( FName,"rt"   );
+                      else  hFile = fopen ( FName,"r+t" );
+           } else  {
+-            if (ReadOnly)  hFile = fopen ( FName,"r"   );
++            if (ReadOnly)  hFile = fopen ( FName,"rb"   );
+                      else  hFile = fopen ( FName,"r+b" );
+           }
+ #ifndef _MVS
+diff --git a/src/machine_.h b/src/machine_.h
+old mode 100644
+new mode 100755
+index 2e81264..c658981
+--- a/src/machine_.h
++++ b/src/machine_.h
+@@ -1,4 +1,4 @@
+-//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
++//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
+ //  =================================================================
+ //
+ //   CCP4 Coordinate Library: support of coordinate-related
+@@ -127,8 +127,12 @@
+ # define CALL_LIKE_VMS  1
+ 
+ // MVS stands for Microsoft Visual Studio
+-#elif defined(_MVS) 
++#elif defined(_MSC_VER)
++# if (_MSC_VER) >= 800
++# define CALL_LIKE_MVS  2
++# else
+ # define CALL_LIKE_MVS  1
++# endif
+ 
+ #elif defined(F2C) || defined(G77)
+ # define CALL_LIKE_SUN  8
+@@ -400,6 +404,36 @@ typedef  double     apireal;    // FORTRAN  real*8
+ 
+ #elif defined(CALL_LIKE_MVS)
+ 
++# if ( CALL_LIKE_MVS == 2 )
++
++  typedef pstr fpstr;
++
++# define FTN_STR(s)  s
++# define FTN_LEN(s)  s##_len
++
++# define char_struct(s)           \
++    pstr  s;                      \
++    int   s##_len;
++# define fill_char_struct(s,str)  \
++    s  = str;                     \
++    s##_len = strlen(str);
++
++# ifdef __cplusplus
++#   define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
++    extern "C" void NAME p_sun
++# else
++#   define FORTRAN_SUBR(NAME,name,p_sun,p_stardent,p_mvs) \
++    void NAME p_sun
++# endif
++
++# define FORTRAN_EXTERN(NAME,name,p_sun,p_stardent,p_mvs) \
++    extern "C" void NAME p_sun
++
++# define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
++    NAME p_sun
++
++# else 
++
+   typedef pstr fpstr;
+ 
+ # define FTN_STR(s)  s
+@@ -425,7 +459,7 @@ typedef  double     apireal;    // FORTRAN  real*8
+ 
+ # define FORTRAN_CALL(NAME,name,p_sun,p_stardent,p_mvs) \
+     NAME p_mvs
+-
++# endif
+ #else
+ 
+ # error  Unknown machine!!!
+diff --git a/src/mmdb_atom.h b/src/mmdb_atom.h
+old mode 100644
+new mode 100755
+index 45049c8..672e11a
+--- a/src/mmdb_atom.h
++++ b/src/mmdb_atom.h
+@@ -1,4 +1,4 @@
+-//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
++//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
+ //  =================================================================
+ //
+ //   CCP4 Coordinate Library: support of coordinate-related
+@@ -290,7 +290,7 @@ class CAtom : public CUDData  {
+     void  CalcAtomStatistics ( RSAtomStat AS );
+     realtype GetDist2 ( PCAtom a );
+     realtype GetDist2 ( PCAtom a, mat44 & tm );  // tm applies to A
+-    realtype GetDist2 ( PCAtom a, mat33 & r, vect3 & t );// tm applies to A
++    realtype GetDist2 ( PCAtom a, mat33 & r, vect3 & t );  // tm applies to A
+     realtype GetDist2 ( realtype ax, realtype ay, realtype az );
+ 
+     // GetCosine(a1,a2) calculates cosine of angle a1-this-a2,
+diff --git a/src/mmdb_chain.cpp b/src/mmdb_chain.cpp
+old mode 100644
+new mode 100755
+index a6f66c2..1fa165b
+--- a/src/mmdb_chain.cpp
++++ b/src/mmdb_chain.cpp
+@@ -1,4 +1,4 @@
+-//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
++//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
+ //  =================================================================
+ //
+ //   CCP4 Coordinate Library: support of coordinate-related
+@@ -672,7 +672,8 @@ int  i,k,sN;
+     i  = 0;
+     sN = 1;
+     while (i<numRes)  {
+-      PutInteger ( &(S[8]),sN,2 );
++      //PutInteger ( &(S[8]),sN,2 );
++      PutInteger ( &(S[7]),sN,3 );
+       k = 19;
+       while ((i<numRes) && (k<70))  {
+         if (resName[i][0])
+diff --git a/src/mmdb_rwbrook.cpp b/src/mmdb_rwbrook.cpp
+old mode 100644
+new mode 100755
+index dc33086..ef58641
+--- a/src/mmdb_rwbrook.cpp
++++ b/src/mmdb_rwbrook.cpp
+@@ -1,4 +1,4 @@
+-//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
++//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
+ //  =================================================================
+ //
+ //   CCP4 Coordinate Library: support of coordinate-related
+@@ -1478,7 +1478,6 @@ AltLoc   altLoc;
+ SegID    sgID;
+ Element  element;
+ PCAtom   atom;
+-pstr     p;
+ char     charge[10];
+ 
+   strcpy ( LastFunc,"MMDB_F_Atom" );
+@@ -1552,10 +1551,9 @@ char     charge[10];
+     } else
+       charge [0] = char(0);
+ 
+-/*
+     if (FTN_STR(ID)[0]==' ')  {
+       atomName[0] = char(0);
+-      if ((FTN_STR(AtNam)[1]=='H') ||
++      if ((FTN_STR(AtNam)[1]=='H') && (FTN_STR(AtNam)[0]!='H') ||
+           ((FTN_STR(AtNam)[1]=='D') && (FTN_STR(ID)[2]=='D')))  {
+         i = 0;
+         while ((i<nHydAtomNames) && 
+@@ -1563,12 +1561,16 @@ char     charge[10];
+         if (i<nHydAtomNames)
+           GetStrTer ( atomName,FTN_STR(AtNam),4,5,FTN_LEN(AtNam) );
+       }
+-      if (!atomName[0])  {
++
++      if ((FTN_STR(AtNam)[0]=='A') || ((FTN_STR(AtNam)[0]=='N') && (FTN_STR(ID)[1]!='N'))) {
++        GetStrTer ( atomName,FTN_STR(AtNam),4,5,FTN_LEN(AtNam) );
++      } else if ((FTN_STR(ID)[1]=='N') && ( (FTN_STR(AtNam)[0]=='N') && (FTN_STR(AtNam)[1]=='N') )) {
++        GetStrTer ( atomName,FTN_STR(AtNam),4,5,FTN_LEN(AtNam) );
++      } else if (!atomName[0])  {
+         atomName[0] = ' ';
+         GetStrTer ( &(atomName[1]),FTN_STR(AtNam),3,4,FTN_LEN(AtNam) );
+       }
+     } else
+-*/
+       GetStrTer ( atomName,FTN_STR(AtNam),4,5,4 );
+ 
+ 
+diff --git a/src/mmdb_sbase0.cpp b/src/mmdb_sbase0.cpp
+old mode 100644
+new mode 100755
+index a210d62..3bf0d52
+--- a/src/mmdb_sbase0.cpp
++++ b/src/mmdb_sbase0.cpp
+@@ -1,4 +1,4 @@
+-//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
++//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
+ //  =================================================================
+ //
+ //   CCP4 Coordinate Library: support of coordinate-related
+@@ -1320,7 +1320,11 @@ PPCSBIndex Index1;
+     dirpath = new char[i+10];
+     strcpy ( dirpath,path );
+     if (i>0)  {
++#if defined(_MSC_VER) || defined (WIN32)
++      if (dirpath[i-1]!='\\')  strcat ( dirpath,"\\" );
++#else
+       if (dirpath[i-1]!='/')  strcat ( dirpath,"/" );
++#endif
+     }
+   }
+ 
+diff --git a/src/mmdb_selmngr.cpp b/src/mmdb_selmngr.cpp
+old mode 100644
+new mode 100755
+index b923529..3a9e249
+--- a/src/mmdb_selmngr.cpp
++++ b/src/mmdb_selmngr.cpp
+@@ -1,4 +1,4 @@
+-//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
++//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
+ //  =================================================================
+ //
+ //   CCP4 Coordinate Library: support of coordinate-related
+@@ -1158,7 +1158,7 @@ void  CMMDBSelManager::Select (
+              int   selKey    // selection key
+                     )  {
+ int       i,j,k,n,m1,m2,c, sk,nsel;
+-Boolean   noRes,modelSel,chainSel,resSel,selAND;
++Boolean   noRes,modelSel(False),chainSel,resSel,selAND;
+ PCModel   model;
+ PCChain   chain;
+ PCResidue res;
+diff --git a/src/mmdb_title.cpp b/src/mmdb_title.cpp
+old mode 100644
+new mode 100755
+index b0b2ae5..1033ae5
+--- a/src/mmdb_title.cpp
++++ b/src/mmdb_title.cpp
+@@ -1,4 +1,4 @@
+-//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
++//  $Id: 1.21-allignment.patch,v 1.1 2010/06/30 20:55:04 jlec Exp $
+ //  =================================================================
+ //
+ //   CCP4 Coordinate Library: support of coordinate-related
+@@ -1381,6 +1381,10 @@ MakeStreamFunctions(CRemark)
+ #define  R350_CHAINS         2
+ #define  R350_BIOMT          3
+ 
++#ifdef _WIN32
++#define  strcasestr(s, t) strstr(strupr(s), t)
++#endif
++
+ void getRemarkKey ( RPCRemark rem, int & lkey )  {
+   if (rem)  {
+     if (rem->remarkNum!=350)  lkey = R350_END;
+@@ -1458,7 +1462,7 @@ int      l,lkey,nAdd,j;
+ 
+   while ((i<l) && (lkey==R350_NONE))  {
+ 
+-    p = strcasestr ( rem->Remark,"CHAINS:" );
++    p = strcasestr( rem->Remark,"CHAINS:" );
+     if (p)  p += 7;
+     else  {
+       p = rem->Remark;
+@@ -1513,7 +1517,7 @@ pstr p1,p2;
+ int  l,j,lkey;
+ 
+   sprintf ( PN,"BIOMT%1i",biomtNo );
+-  p1 = strcasestr ( rem->Remark,PN );
++  p1 = strcasestr( rem->Remark,PN );
+   if (!p1)  return R350_ERRBIOMT;
+ 
+   p1 += 6;
+@@ -1972,7 +1976,7 @@ int      i,l;
+     if (rem)  {
+       if (rem->remarkNum==2)  {
+         if (rem->Remark)  {
+-          p = strcasestr ( rem->Remark,"RESOLUTION" );
++          p = strcasestr( rem->Remark,"RESOLUTION" );
+           if (p)  {
+             while ((*p) && (*p!=' '))  p++;
+             if (*p)  {
diff --git a/sci-libs/mmdb/mmdb-1.21-r1.ebuild b/sci-libs/mmdb/mmdb-1.21-r1.ebuild
new file mode 100644
index 000000000000..d056f8c2b7a6
--- /dev/null
+++ b/sci-libs/mmdb/mmdb-1.21-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sci-libs/mmdb/mmdb-1.21-r1.ebuild,v 1.1 2010/06/30 20:55:04 jlec Exp $
+
+EAPI="2"
+
+inherit autotools eutils
+
+DESCRIPTION="The Coordinate Library is designed to assist CCP4 developers in working with coordinate files"
+HOMEPAGE="http://www.ebi.ac.uk/~keb/cldoc/"
+SRC_URI="http://www.ysbl.york.ac.uk/~emsley/software/${P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+DEPEND="!<sci-libs/ccp4-libs-6.1.3"
+RDEPEND=""
+
+src_prepare() {
+	epatch "${FILESDIR}"/${PV}-allignment.patch
+	eautoreconf
+}
+
+src_install() {
+	emake DESTDIR="${D}" install || die "emake install failed"
+
+	# create missing mmdb.pc
+	cat >> ${T}/mmdb.pc <<- EOF
+	prefix="${EPREFIX}"
+	exec_prefix=\$prefix
+	libdir=\$prefix/$(get_libdir)
+	includedir=\$prefix/include
+
+	Name: ${PN}
+	Description: Macromolecular coordinate library
+	Version: ${PV}
+	Requires:
+	Conflicts:
+	Libs: -L\${libdir} -lmmdb
+	Cflags: -I\${includedir}
+
+	EOF
+
+	insinto /usr/$(get_libdir)/pkgconfig
+	doins ${T}/mmdb.pc || die
+}
-- 
cgit v1.2.3-65-gdbad