1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-20 08:27:15 +00:00

Make port working on 5.3 and higher (finally)

Thanks to the debian package for the g++ patches.
This commit is contained in:
Edwin Groothuis 2005-10-29 13:48:50 +00:00
parent c15d6133c6
commit f99d409934
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=146660
10 changed files with 325 additions and 13 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= groundhog
PORTVERSION= 1.4
PORTREVISION= 5
PORTREVISION= 6
CATEGORIES= games
MASTER_SITES= http://home-2.tiscali.nl/~cb007736/
@ -18,10 +18,4 @@ USE_GMAKE= yes
USE_GNOME= gtk20
GNU_CONFIGURE= yes
.include <bsd.port.pre.mk>
.if ${OSVERSION} > 502112
BROKEN= "Does not compile on FreeBSD >= 5.x"
.endif
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View File

@ -1,11 +1,40 @@
--- src/highscore.cc/old Sat May 4 23:43:58 2002
+++ src/highscore.cc Thu May 23 14:10:49 2002
@@ -26,6 +26,8 @@
std::string filename = getenv("HOME");
--- src/highscore.cc.orig Sat May 4 23:43:58 2002
+++ src/highscore.cc Sun Oct 30 00:49:25 2005
@@ -17,27 +17,30 @@
*/
#include <fstream.h>
+using namespace std;
#include "highscore.h"
void
HighScore::Read()
{
- std::string filename = getenv("HOME");
+ string filename = getenv("HOME");
filename += "/.groundhog.highscore";
std::ifstream in(filename.c_str());
- std::ifstream in(filename.c_str());
+ ifstream in(filename.c_str());
+ if (in==NULL)
+ return;
in >> _beginner >> _intermediate >> _expert;
}
void
HighScore::Write()
{
- std::string filename = getenv("HOME");
+ string filename = getenv("HOME");
filename += "/.groundhog.highscore";
- std::ofstream out(filename.c_str());
- out << _beginner << std::endl
- << _intermediate << std::endl
- << _expert << std::endl;
+ ofstream out(filename.c_str());
+ out << _beginner << endl
+ << _intermediate << endl
+ << _expert << endl;
}

View File

@ -0,0 +1,49 @@
--- src/game.cc.orig Sun May 5 04:30:51 2002
+++ src/game.cc Sun Oct 30 00:48:40 2005
@@ -18,10 +18,15 @@
#include <config.h>
-#include <strstream.h>
+#include <sstream>
+#include <iostream>
+#include <string>
+
#include <time.h>
#include <unistd.h>
+using namespace std;
+
#include "about_dialog.h"
#include "ball.h"
#include "game.h"
@@ -193,21 +198,19 @@
void
Game::DisplayMoves()
{
- char info[128];
- ostrstream ost(info, sizeof(info));
-
- ost << _("Moves: ") << _nr_of_moves << std::ends;
- gtk_label_set(GTK_LABEL(_moves), info);
+ ostringstream ost;
+ ost << _("Moves: ") << _nr_of_moves << ends; // format string
+ string info = ost.str(); // retrieve formatted string
+ gtk_label_set(GTK_LABEL(_moves), info.c_str());
}
void
Game::DisplayTime()
{
- char info[128];
- ostrstream ost(info, sizeof(info));
-
- ost << _("Time: ") << _seconds << std::ends;
- gtk_label_set(GTK_LABEL(_time), info);
+ ostringstream ost;
+ ost << _("Time: ") << _seconds << ends; // format string
+ string info = ost.str(); // retrieve formatted string
+ gtk_label_set(GTK_LABEL(_time), info.c_str());
}
void

View File

@ -0,0 +1,19 @@
--- src/pocket.h.orig Sun Oct 30 00:51:58 2005
+++ src/pocket.h Sun Oct 30 00:52:09 2005
@@ -20,6 +20,7 @@
#define _POCKET_H_
#include <list>
+using namespace std;
#include <gtk/gtk.h>
@@ -54,7 +55,7 @@
};
class SetOffPockets {
- std::list<Pocket*> _set;
+ list<Pocket*> _set;
public:
SetOffPockets() {}
void Add(Pocket* pocket) {_set.push_back(pocket);}

View File

@ -0,0 +1,74 @@
--- src/score.cc.orig Sun Oct 30 00:52:15 2005
+++ src/score.cc Sun Oct 30 00:53:45 2005
@@ -17,20 +17,21 @@
*/
#include <iostream>
+using namespace std;
#include "score.h"
-std::ostream&
-operator<<(std::ostream& s, const Score& score)
+ostream&
+operator<<(ostream& s, const Score& score)
{
return s << "(\"" << score._name << "\" " << score._seconds << ')';
}
-std::istream&
-operator>>(std::istream& s, Score& score)
+istream&
+operator>>(istream& s, Score& score)
{
char c;
- std::ios::fmtflags flag = s.flags();
- s.flags(flag & ~std::ios::skipws);
+ ios::fmtflags flag = s.flags();
+ s.flags(flag & ~ios::skipws);
score._name = "";
s >> c >> c;
@@ -54,14 +55,14 @@
bool
ScoreList::IsNewHighScore(int seconds)
{
- std::list<Score>::iterator last = _list.end();
+ list<Score>::iterator last = _list.end();
return _list.size() < 10 || seconds < (*--last).GetSeconds();
}
void
ScoreList::AddHighScore(Score& score)
{
- std::list<Score>::iterator i;
+ list<Score>::iterator i;
for (i = _list.begin(); i != _list.end(); i++)
if (score < *i)
break;
@@ -74,18 +75,18 @@
}
}
-std::ostream&
-operator<<(std::ostream& s, const ScoreList& slist)
+ostream&
+operator<<(ostream& s, const ScoreList& slist)
{
- s << '(' << std::endl;
- for (std::list<Score>::const_iterator i = slist._list.begin();
+ s << '(' << endl;
+ for (list<Score>::const_iterator i = slist._list.begin();
i != slist._list.end(); i++)
- s << *i << std::endl;
- return s << ')' << std::endl;
+ s << *i << endl;
+ return s << ')' << endl;
}
-std::istream&
-operator>>(std::istream& s, ScoreList& slist)
+istream&
+operator>>(istream& s, ScoreList& slist)
{
char c;
s >> c;

View File

@ -0,0 +1,50 @@
--- src/score.h.orig Sun Oct 30 00:53:49 2005
+++ src/score.h Sun Oct 30 00:54:22 2005
@@ -20,34 +20,37 @@
#define _SCORE_H
#include <list>
+#include <iostream>
#include <string>
+using namespace std;
+
class Score {
- std::string _name;
+ string _name;
int _seconds;
protected:
public:
Score() {}
- Score(const std::string& name, int seconds) : _name(name),
+ Score(const string& name, int seconds) : _name(name),
_seconds(seconds) {}
int operator<(Score& score);
- friend std::ostream& operator<<(std::ostream& s, const Score& score);
- friend std::istream& operator>>(std::istream& s, Score& score);
- const std::string& GetName() const {return _name;}
+ friend ostream& operator<<(ostream& s, const Score& score);
+ friend istream& operator>>(istream& s, Score& score);
+ const string& GetName() const {return _name;}
int GetSeconds() const {return _seconds;}
};
class ScoreList {
- std::list<Score> _list;
+ list<Score> _list;
protected:
public:
ScoreList() {}
bool IsNewHighScore(int seconds);
void AddHighScore(Score& score);
- friend std::ostream& operator<<(std::ostream& s, const ScoreList& slist);
- friend std::istream& operator>>(std::istream& s, ScoreList& slist);
- std::list<Score>::const_iterator Begin() const {return _list.begin();}
- std::list<Score>::const_iterator End() const {return _list.end();}
+ friend ostream& operator<<(ostream& s, const ScoreList& slist);
+ friend istream& operator>>(istream& s, ScoreList& slist);
+ list<Score>::const_iterator Begin() const {return _list.begin();}
+ list<Score>::const_iterator End() const {return _list.end();}
};
#endif // _SCORE_H

View File

@ -0,0 +1,51 @@
--- src/highscore_tab.cc.orig Sun Oct 30 00:49:30 2005
+++ src/highscore_tab.cc Sun Oct 30 00:51:04 2005
@@ -16,7 +16,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <strstream.h>
+#include <sstream>
+#include <string>
+using namespace std;
#include "highscore_tab.h"
#include "intl.h"
@@ -37,11 +39,12 @@
gtk_table_attach_defaults(GTK_TABLE(table), label, 2, 3, 0, 1);
for (int i = 1; i <= 10; i++) {
- char scratch[16];
- std::ostrstream ost(scratch, sizeof(scratch));
-
- ost << i << std::ends;
- GtkWidget* index_label = gtk_label_new(scratch);
+ ostringstream ost;
+ ost << i << ends; // format string
+ string temp = ost.str(); // retrieve formatted string
+
+ GtkWidget* index_label = gtk_label_new(temp.c_str());
+
gtk_table_attach_defaults(GTK_TABLE(table), index_label, 0, 1, i, i + 1);
_names[i] = gtk_label_new(N_(""));
@@ -66,14 +69,12 @@
HighScoreTab::Fill(const ScoreList& slist)
{
int index = 1;
- for (std::list<Score>::const_iterator i = slist.Begin();
+ for (list<Score>::const_iterator i = slist.Begin();
i != slist.End(); i++) {
- char scratch[16];
- std::ostrstream ost(scratch, sizeof(scratch));
-
- ost << (*i).GetSeconds() << std::ends;
-
- FillOneScore(index++, (*i).GetName().c_str(), scratch);
+ ostringstream ost;
+ ost << (*i).GetSeconds() << ends; // format string
+ string temp = ost.str(); // retrieve string
+ FillOneScore(index++, (*i).GetName().c_str(), temp.c_str());
}
for (; index <= 10; index++)

View File

@ -0,0 +1,19 @@
--- src/new_highscore_dialog.h.orig Sun Oct 30 00:51:13 2005
+++ src/new_highscore_dialog.h Sun Oct 30 00:51:28 2005
@@ -20,6 +20,7 @@
#define _NEW_HIGHSCORE_DIALOG_H
#include <string>
+using namespace std;
#include "dialog.h"
class Game;
@@ -28,7 +29,7 @@
Game* _game;
GtkWidget* _name;
char* GetLoginName();
- std::string GetUserName();
+ string GetUserName();
protected:
void OnOk();
public:

View File

@ -0,0 +1,27 @@
--- src/solved_dialog.cc.orig Sun Oct 30 00:54:28 2005
+++ src/solved_dialog.cc Sun Oct 30 00:54:56 2005
@@ -16,7 +16,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <strstream.h>
+#include <sstream>
+#include <string>
+using namespace std;
#include "intl.h"
#include "solved_dialog.h"
@@ -33,9 +35,8 @@
void
SolvedDialog::SetLabel(int moves)
{
- char info[128];
- std::ostrstream ost(info, sizeof(info));
-
- ost << _(" Game solved in ") << moves << _(" moves!") << std::ends;
- gtk_label_set(GTK_LABEL(_label), info);
+ ostringstream ost;
+ ost << _(" Game solved in ") << moves << _(" moves!") << ends;
+ string info = ost.str();
+ gtk_label_set(GTK_LABEL(_label), info.c_str());
}