summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorMikhail Teterin <mi@FreeBSD.org>2009-04-13 06:14:19 +0000
committerMikhail Teterin <mi@FreeBSD.org>2009-04-13 06:14:19 +0000
commit572de8c94198e57a670c9a8a5d4eefa48d77d583 (patch)
treebfed63ea10a1730bde9fadbb177263d4d38afe2b /games
parentUpdate from 0.7.50 to 0.7.51. (diff)
Ubreak (by porting to modern, if ever-changing C++), fix warnings and 64-bit
related errors. Release back into the wild.
Notes
Notes: svn path=/head/; revision=232285
Diffstat (limited to 'games')
-rw-r--r--games/euchre/Makefile16
-rw-r--r--games/euchre/files/patch-cplusplus345
-rw-r--r--games/euchre/files/patch-src::lib::Options.cpp12
-rw-r--r--games/euchre/files/std-namespace.h3
4 files changed, 363 insertions, 13 deletions
diff --git a/games/euchre/Makefile b/games/euchre/Makefile
index 0e42340a14e9..0d06aecec8cf 100644
--- a/games/euchre/Makefile
+++ b/games/euchre/Makefile
@@ -9,8 +9,7 @@ PORTNAME= euchre
PORTVERSION= 0.7
PORTREVISION= 4
CATEGORIES= games
-MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
-MASTER_SITE_SUBDIR= ${PORTNAME}
+MASTER_SITES= SF
MAINTAINER= ports@FreeBSD.org
COMMENT= Very popular card game with variable skill levels
@@ -18,11 +17,12 @@ COMMENT= Very popular card game with variable skill levels
PLIST_FILES= bin/euchre
USE_AUTOTOOLS= automake:14 autoconf:213
USE_GNOME= gtk12
+CFLAGS+= -include "${FILESDIR}/std-namespace.h" -Werror
+MAKE_JOBS_SAFE= yes
-.include <bsd.port.pre.mk>
+post-patch:
+ ${REINPLACE_CMD} 's,char,const char,' \
+ ${WRKSRC}/src/pixmaps/*.xpm \
+ ${WRKSRC}/src/pixmaps/pixmaps.?pp
-.if ${OSVERSION} >= 700042
-BROKEN= Does not compile with GCC 4.2
-.endif
-
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/games/euchre/files/patch-cplusplus b/games/euchre/files/patch-cplusplus
new file mode 100644
index 000000000000..faa896ddcd68
--- /dev/null
+++ b/games/euchre/files/patch-cplusplus
@@ -0,0 +1,345 @@
+The bulk of porting to modern C++ is in here. Contents of the
+other patch-file, as well as whole-sale s/char/const char/
+substitution in pixmap files is also required for warning-free
+compilations.
+
+Oh, and the `using namespace std', which is provided by a micro-
+-header std-namespace.h...
+
+ -mi
+
+--- src/lib/Card.hpp 2002-09-10 21:48:04.000000000 -0400
++++ src/lib/Card.hpp 2009-04-12 23:15:36.000000000 -0400
+@@ -25,5 +25,5 @@
+ #define CARD_HPP
+
+-class ostream;
++#include <ostream>
+
+ class Card {
+@@ -63,5 +63,5 @@
+
+ static char getSuitChar(Suit suit);
+- static char* getSuitStr(Suit suit);
++ static const char* getSuitStr(Suit suit);
+ static char getNumberChar(Number number);
+
+@@ -69,5 +69,5 @@
+
+ char getSuitChar() const;
+- char* getSuitStr() const;
++ const char* getSuitStr() const;
+ Suit getSuit() const;
+ Suit getAdjSuit() const;
+--- src/lib/Round.hpp 2002-09-10 21:48:04.000000000 -0400
++++ src/lib/Round.hpp 2009-04-12 23:15:36.000000000 -0400
+@@ -25,6 +25,5 @@
+ #define ROUND_HPP
+
+-class iostream;
+-
++#include <ostream>
+ #include "Common.hpp"
+ #include "Card.hpp"
+@@ -50,3 +49,2 @@
+
+ #endif /* ROUND_HPP */
+-
+--- src/lib/Card.cpp 2002-09-10 21:48:04.000000000 -0400
++++ src/lib/Card.cpp 2009-04-12 23:15:36.000000000 -0400
+@@ -22,5 +22,5 @@
+ */
+
+-#include <iostream.h>
++#include <iostream>
+
+ #include "Card.hpp"
+@@ -77,9 +77,9 @@
+ }
+
+-char* Card::getSuitStr() const {
++const char* Card::getSuitStr() const {
+ return getSuitStr(itsSuit);
+ }
+
+-static char* suitStrings[] = {
++static const char* suitStrings[] = {
+ "Diamonds",
+ "Clubs",
+@@ -89,5 +89,5 @@
+ };
+
+-char* Card::getSuitStr(Card::Suit suit) {
++const char* Card::getSuitStr(Card::Suit suit) {
+ if (suit < Diamonds || suit > Spades) {
+ suit = (Suit) (Spades + 1);
+--- src/lib/Common.cpp 2002-03-23 21:43:37.000000000 -0500
++++ src/lib/Common.cpp 2009-04-12 23:15:36.000000000 -0400
+@@ -52,9 +52,9 @@
+ }
+
+-static char* PlayerPositionStrings[] = {
++static const char* PlayerPositionStrings[] = {
+ "North", "East", "South", "West", "None"
+ };
+
+-char* Common::getPlayerPositionStr(PlayerPosition pp) {
++const char* Common::getPlayerPositionStr(PlayerPosition pp) {
+ if (pp < NORTH || pp > WEST) {
+ pp = (PlayerPosition) (WEST + 1);
+@@ -65,9 +65,9 @@
+ }
+
+-static char* BidStrings[] = {
++static const char* BidStrings[] = {
+ "No Bid", "Pass", "Called It", "Loner"
+ };
+
+-char* Common::getBidStr(Bid bid) {
++const char* Common::getBidStr(Bid bid) {
+ if (bid < NOBID || bid > LONER) {
+ return 0;
+@@ -85,3 +85,2 @@
+ return trump;
+ }
+-
+--- src/lib/ComputerPlayerEasy.cpp 2003-02-04 22:34:51.000000000 -0500
++++ src/lib/ComputerPlayerEasy.cpp 2009-04-12 23:15:36.000000000 -0400
+@@ -22,6 +22,4 @@
+ */
+
+-#include <iostream.h>
+-
+ #include "Options.hpp"
+ #include "ComputerPlayerEasy.hpp"
+--- src/lib/Common.hpp 2002-09-10 21:48:04.000000000 -0400
++++ src/lib/Common.hpp 2009-04-12 23:15:36.000000000 -0400
+@@ -54,7 +54,7 @@
+ static PlayerPosition getPartner(PlayerPosition pp);
+ static char getPlayerPositionChar(PlayerPosition pp);
+- static char* getPlayerPositionStr(PlayerPosition pp);
++ static const char* getPlayerPositionStr(PlayerPosition pp);
+
+- static char* getBidStr(Bid bid);
++ static const char* getBidStr(Bid bid);
+
+ static void setTrump(const Card::Suit aTrump);
+--- src/lib/Debug.hpp 2002-04-10 20:22:17.000000000 -0400
++++ src/lib/Debug.hpp 2009-04-12 23:15:36.000000000 -0400
+@@ -25,5 +25,5 @@
+ #define EUCHRE_DEBUG_HPP
+
+-#include <iostream.h>
++#include <iostream>
+ #include <Options.hpp>
+
+--- src/lib/ComputerPlayerHard.cpp 2003-03-24 06:37:59.000000000 -0500
++++ src/lib/ComputerPlayerHard.cpp 2009-04-12 23:15:36.000000000 -0400
+@@ -23,5 +23,5 @@
+
+ #include <string.h>
+-#include <iomanip.h>
++#include <iomanip>
+
+ #include "Debug.hpp"
+--- src/lib/Hand.hpp 2002-09-10 21:48:04.000000000 -0400
++++ src/lib/Hand.hpp 2009-04-12 23:15:36.000000000 -0400
+@@ -25,5 +25,4 @@
+ #define HAND_HPP
+
+-class ostream;
+ #include "Common.hpp"
+ #include "Card.hpp"
+--- src/lib/Deck.hpp 2002-03-23 21:43:37.000000000 -0500
++++ src/lib/Deck.hpp 2009-04-12 23:15:36.000000000 -0400
+@@ -25,6 +25,4 @@
+ #define DECK_HPP
+
+-class ostream;
+-
+ #include "Card.hpp"
+
+--- src/lib/Game.cpp 2003-03-24 07:04:46.000000000 -0500
++++ src/lib/Game.cpp 2009-04-12 23:15:36.000000000 -0400
+@@ -24,6 +24,7 @@
+ #include <stdio.h>
+ #include <unistd.h>
+-#include <iomanip.h>
++#include <iomanip>
+
++using namespace std;
+ #include "Debug.hpp"
+ #include "Game.hpp"
+@@ -61,5 +62,5 @@
+ /* gcc doesn't like conversion from void* to Event so hack around
+ it */
+- Event ev = (Event) (unsigned int) g_slist_nth_data(itsEventList, 0);
++ Event ev = (Event) (uintptr_t) g_slist_nth_data(itsEventList, 0);
+ itsEventList = g_slist_remove(itsEventList, (gpointer) ev);
+
+--- src/lib/Player.hpp 2003-02-04 22:34:51.000000000 -0500
++++ src/lib/Player.hpp 2009-04-12 23:15:36.000000000 -0400
+@@ -25,5 +25,5 @@
+ #define PLAYER_HPP
+
+-class ostream;
++#include <ostream>
+ #include "Common.hpp"
+ #include "Hand.hpp"
+--- src/lib/Options.hpp 2003-02-04 22:34:51.000000000 -0500
++++ src/lib/Options.hpp 2009-04-13 01:58:02.000000000 -0400
+@@ -25,5 +25,5 @@
+ #define OPTIONS_HPP
+
+-#include <fstream.h>
++#include <fstream>
+
+ #include "Common.hpp"
+--- src/gui/GuiGame.cpp 2003-03-24 07:20:41.000000000 -0500
++++ src/gui/GuiGame.cpp 2009-04-13 01:41:01.000000000 -0400
+@@ -446,5 +446,5 @@
+ }
+
+-void GuiGame::updateStatus(char* statusStr) {
++void GuiGame::updateStatus(const char* statusStr) {
+ strcpy(itsStatusText, statusStr);
+ updateStatus();
+@@ -595,5 +595,5 @@
+ }
+
+-char* GuiGame::getPauseText() {
++const char* GuiGame::getPauseText() {
+ if (GuiOptions::get()->getDelayMode() == Options::PAUSE) {
+ return "Click to continue.";
+@@ -688,5 +688,5 @@
+ const int num_in_mainwin = 10;
+
+- char* names[num_names] = {
++ const char* names[num_names] = {
+ "nplayedcard", "eplayedcard", "splayedcard", "wplayedcard",
+ "pcard0_pix", "pcard1_pix", "pcard2_pix", "pcard3_pix",
+@@ -708,5 +708,7 @@
+ gdk_pixmap_colormap_create_from_xpm_d(NULL, gdk_c,
+ &(cardbackBitmaps[i][which]),
+- NULL, card_back_pixmap[which]);
++ NULL,
++ /* XXX Drop const-ness */
++ (gchar **)card_back_pixmap[which]);
+ }
+
+--- src/gui/GuiGame.hpp 2003-03-24 06:58:28.000000000 -0500
++++ src/gui/GuiGame.hpp 2009-04-12 23:25:55.000000000 -0400
+@@ -34,5 +34,5 @@
+ virtual void getPlayers();
+ virtual void setOptions();
+- virtual void updateStatus(char* statusStr);
++ virtual void updateStatus(const char* statusStr);
+
+ void setCardBack(int which);
+@@ -72,5 +72,5 @@
+ void updateStatus();
+ void hideTopCard();
+- char* getPauseText();
++ const char* getPauseText();
+ void setMainLabelColors();
+ void setAuctionLabelColors();
+--- src/gui/callbacks.cpp 2003-03-24 07:08:59.000000000 -0500
++++ src/gui/callbacks.cpp 2009-04-13 01:42:21.000000000 -0400
+@@ -105,5 +105,5 @@
+ gpointer user_data)
+ {
+- LOG("enter on_pcard_clicked with " << (int) user_data << endl);
++ LOG("enter on_pcard_clicked with " << (intptr_t) user_data << endl);
+ HumanGuiPlayer* p = (HumanGuiPlayer*) theGame->getPlayer(Common::SOUTH);
+ if (p == NULL) {
+@@ -111,5 +111,5 @@
+ }
+
+- p->setSelectedCard((int) user_data);
++ p->setSelectedCard((intptr_t) user_data);
+ theGame->addEvent(Game::PAUSE_END);
+ theGame->run();
+@@ -143,5 +143,5 @@
+ {
+ Player* p = theGame->getPlayer(Common::SOUTH);
+- p->assignBid((Common::Bid) ((int) user_data));
++ p->assignBid((Common::Bid) ((intptr_t) user_data));
+
+ theGame->addEvent(Game::AUCTION_CONT);
+@@ -203,7 +203,7 @@
+
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t))) {
+- p->assignBid(Common::LONER, (Card::Suit) (int) user_data);
++ p->assignBid(Common::LONER, (Card::Suit) (intptr_t) user_data);
+ } else {
+- p->assignBid(Common::PICKITUP, (Card::Suit) (int) user_data);
++ p->assignBid(Common::PICKITUP, (Card::Suit) (intptr_t) user_data);
+ }
+
+--- src/gui/main.cpp 2003-03-24 07:19:16.000000000 -0500
++++ src/gui/main.cpp 2009-04-13 01:57:22.000000000 -0400
+@@ -92,5 +92,7 @@
+ gdk_pixmap_colormap_create_from_xpm_d(NULL, gdk_c,
+ &(cardbackSelectBitmaps[i]),
+- NULL, card_back_pixmap[i]);
++ NULL,
++ /* Drop const-ness */
++ (gchar **)card_back_pixmap[i]);
+ gtk_pixmap_set(GTK_PIXMAP(gtk_w), cardbackSelectPixmaps[i],
+ cardbackSelectBitmaps[i]);
+@@ -168,5 +170,7 @@
+ gdk_c = gtk_widget_get_colormap(gtk_w);
+ gdk_p = gdk_pixmap_colormap_create_from_xpm_d(NULL, gdk_c, &gdk_m,
+- NULL, suit_pixmap[s]);
++ NULL,
++ /* Drop const-ness */
++ (gchar **)suit_pixmap[s]);
+
+ gtk_pixmap_set(GTK_PIXMAP(gtk_w), gdk_p, gdk_m);
+--- src/gui/support.cpp 2002-06-27 00:11:51.000000000 -0400
++++ src/gui/support.cpp 2009-04-13 01:55:08.000000000 -0400
+@@ -63,5 +63,5 @@
+
+ /* This is a dummy pixmap we use when a pixmap can't be found. */
+-static char *dummy_pixmap_xpm[] = {
++static const char *dummy_pixmap_xpm[] = {
+ /* columns rows colors chars-per-pixel */
+ "1 1 1 1",
+@@ -113,5 +113,5 @@
+ GtkWidget*
+ create_pixmap_d (GtkWidget *widget,
+- gchar **xpm_d)
++ const gchar **xpm_d)
+ {
+ GdkColormap *colormap;
+@@ -122,5 +122,7 @@
+ colormap = gtk_widget_get_colormap (widget);
+ gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask,
+- NULL, xpm_d);
++ NULL,
++ /* Drop const-ness */
++ (gchar **)xpm_d);
+ if (gdkpixmap == NULL)
+ g_error ("Couldn't create replacement pixmap.");
+--- src/gui/support.hpp 2002-06-27 00:11:51.000000000 -0400
++++ src/gui/support.hpp 2009-04-13 01:54:35.000000000 -0400
+@@ -53,5 +53,5 @@
+ const gchar *filename);
+ GtkWidget* create_pixmap_d (GtkWidget *widget,
+- gchar **xpm_d);
++ const gchar **xpm_d);
+
+ #ifdef __cplusplus
+--- src/gui/HumanGuiPlayer.cpp 2003-03-24 04:28:58.000000000 -0500
++++ src/gui/HumanGuiPlayer.cpp 2009-04-13 02:02:09.000000000 -0400
+@@ -36,9 +36,8 @@
+ Player(myPos), GuiPlayer(myPos), itsState(INIT), itsPartnerLoner(0) {
+
+- char* formatStr = "pcard%d";
+ char pcardStr[100];
+
+ for (int i = 0; i < (Common::CARDS_PER_HAND+1); i++) {
+- sprintf(pcardStr, formatStr, i);
++ sprintf(pcardStr, "pcard%d", i);
+ itsCards[i] = lookup_widget(mainwin, pcardStr);
+
diff --git a/games/euchre/files/patch-src::lib::Options.cpp b/games/euchre/files/patch-src::lib::Options.cpp
index 4cc0e0f9b2fa..9939408eb1d0 100644
--- a/games/euchre/files/patch-src::lib::Options.cpp
+++ b/games/euchre/files/patch-src::lib::Options.cpp
@@ -1,16 +1,18 @@
---- src/lib/Options.cpp.orig Tue Nov 26 19:56:54 2002
-+++ src/lib/Options.cpp Tue Nov 26 19:59:02 2002
-@@ -25,6 +25,9 @@
+--- src/lib/Options.cpp 2003-02-04 22:34:51.000000000 -0500
++++ src/lib/Options.cpp 2009-04-13 01:59:11.000000000 -0400
+@@ -24,7 +24,10 @@
+ #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
- #include <iostream.h>
+-#include <iostream.h>
++#include <iostream>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include "Debug.hpp"
#include "Options.hpp"
-@@ -86,7 +89,19 @@
+@@ -90,7 +93,19 @@
char fullpath[OPTIONS_PATH_SIZE];
snprintf(fullpath, OPTIONS_PATH_SIZE, "%s/%s", dir, OPTIONS_FILE_NAME);
diff --git a/games/euchre/files/std-namespace.h b/games/euchre/files/std-namespace.h
new file mode 100644
index 000000000000..b4381f0f1a7e
--- /dev/null
+++ b/games/euchre/files/std-namespace.h
@@ -0,0 +1,3 @@
+#ifdef __cplusplus
+using namespace std;
+#endif