View | Details | Raw Unified | Return to bug 168957 | Differences between
and this patch

Collapse All | Expand All

(-)vegastrike.new/Makefile (-10 / +4 lines)
Lines 6-16 Link Here
6
#
6
#
7
7
8
PORTNAME=	vegastrike
8
PORTNAME=	vegastrike
9
PORTVERSION=	0.5.0
9
PORTVERSION=	0.5.1.r1
10
PORTREVISION=	17
11
CATEGORIES=	games
10
CATEGORIES=	games
12
MASTER_SITES=	SF/${PORTNAME}/OldFiles
11
MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}/0.5.1/
13
DISTNAME=	vegastrike-source-${PORTVERSION}
12
DISTNAME=	vegastrike-src-${PORTVERSION}
14
13
15
MAINTAINER=	amdmi3@FreeBSD.org
14
MAINTAINER=	amdmi3@FreeBSD.org
16
COMMENT=	Opensource 3D space simulator
15
COMMENT=	Opensource 3D space simulator
Lines 30-36 Link Here
30
USE_GNOME=	gtk20
29
USE_GNOME=	gtk20
31
CPPFLAGS+=	-I${LOCALBASE}/include
30
CPPFLAGS+=	-I${LOCALBASE}/include
32
LDFLAGS+=	-L${LOCALBASE}/lib
31
LDFLAGS+=	-L${LOCALBASE}/lib
33
WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
32
WRKSRC=		${WRKDIR}/${PORTNAME}-src-${PORTVERSION}
34
MAKE_JOBS_SAFE=	yes
33
MAKE_JOBS_SAFE=	yes
35
34
36
# cegui and ffmpeg are not used yet
35
# cegui and ffmpeg are not used yet
Lines 56-66 Link Here
56
RUN_DEPENDS+=		${LOCALBASE}/lib/libOgreMain.so:${PORTSDIR}/graphics/ogre3d
55
RUN_DEPENDS+=		${LOCALBASE}/lib/libOgreMain.so:${PORTSDIR}/graphics/ogre3d
57
.endif
56
.endif
58
57
59
.if (${OSVERSION} >= 800501 && ${OSVERSION} < 900000) || ${OSVERSION} >= 900006
60
EXTRA_PATCHES+=	${FILESDIR}/extra-patch-src-cmd-basecomputer.cpp \
61
		${FILESDIR}/extra-patch-src-vsfilesystem.cpp
62
.endif
63
64
post-patch:
58
post-patch:
65
	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g; \
59
	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g; \
66
		s|/usr/X11R6|${LOCALBASE}|g' ${WRKSRC}/configure
60
		s|/usr/X11R6|${LOCALBASE}|g' ${WRKSRC}/configure
(-)vegastrike.new/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (vegastrike-source-0.5.0.tar.bz2) = e4fe2aeeece103d87ae11ca8b27e48b72cc7ed8a0c1bed44e7131afd644fde72
1
SHA256 (vegastrike-src-0.5.1.r1.tar.bz2) = 5ef8bc4906746183f3b13fe7054fa37dee7672cf5749d1044ea511a85d2af125
2
SIZE (vegastrike-source-0.5.0.tar.bz2) = 9093178
2
SIZE (vegastrike-src-0.5.1.r1.tar.bz2) = 10875771
(-)vegastrike.new/files/extra-patch-src-cmd-basecomputer.cpp (-38 lines)
Lines 1-38 Link Here
1
--- src/cmd/basecomputer.cpp.orig	2008-04-24 16:12:27.000000000 +0400
2
+++ src/cmd/basecomputer.cpp	2010-04-03 08:25:45.000000000 +0400
3
@@ -3099,7 +3099,7 @@
4
     // Make the title right.
5
     recalcTitle();
6
 }
7
-#if defined (__FreeBSD__) || defined(__APPLE__)
8
+#if defined(__APPLE__)
9
 static int	nodirs( struct dirent * entry)
10
 #else
11
 static int	nodirs( const struct dirent * entry)
12
@@ -3128,14 +3128,12 @@
13
 	return 0;
14
 }
15
 
16
-static int datesort ( const void *v1, const void *v2 ) {
17
-	const struct dirent *d1=*(const struct dirent**)v1;
18
-	const struct dirent *d2=*(const struct dirent**)v2;
19
+static int datesort ( const struct dirent **d1, const struct dirent **d2 ) {
20
 	struct stat s1, s2;
21
-	std::string tmp=VSFileSystem::homedir+"/save/"+d1->d_name;
22
+	std::string tmp=VSFileSystem::homedir+"/save/"+(*d1)->d_name;
23
 	if (stat(tmp.c_str(), &s1))
24
 		return 0;
25
-	tmp=VSFileSystem::homedir+"/save/"+d2->d_name;
26
+	tmp=VSFileSystem::homedir+"/save/"+(*d2)->d_name;
27
 	if (stat(tmp.c_str(), &s2))
28
 		return 0;
29
 	
30
@@ -3160,7 +3158,7 @@
31
 		const int playerNum=UnitUtil::isPlayerStarship(playerUnit);
32
 		struct dirent ** dirlist;
33
 		std::string savedir = VSFileSystem::homedir+"/save/";
34
-		int ret = scandir (savedir.c_str(),&dirlist,nodirs,(scancompare)&datesort);
35
+		int ret = scandir (savedir.c_str(),&dirlist,nodirs,datesort);
36
 		while( ret-->0) {
37
 			picker->addCell(new SimplePickerCell(dirlist[ret]->d_name));
38
 		}		
(-)vegastrike.new/files/extra-patch-src-vsfilesystem.cpp (-29 lines)
Lines 1-29 Link Here
1
--- src/vsfilesystem.cpp.orig	2008-04-24 16:12:39.000000000 +0400
2
+++ src/vsfilesystem.cpp	2010-04-04 05:19:55.000000000 +0400
3
@@ -77,7 +77,7 @@
4
 
5
 string selectcurrentdir;
6
 
7
-#if defined (__FreeBSD__) || defined(__APPLE__)
8
+#if defined(__APPLE__)
9
 int	selectdirs( struct dirent * entry)
10
 #else
11
 int	selectdirs( const struct dirent * entry)
12
@@ -106,7 +106,7 @@
13
 	return 0;
14
 }
15
 
16
-#if defined (__FreeBSD__) || defined(__APPLE__)
17
+#if defined(__APPLE__)
18
 int	selectpk3s( struct dirent * entry)
19
 #else
20
 int	selectpk3s( const struct dirent * entry)
21
@@ -118,7 +118,7 @@
22
 	return 0;
23
 }
24
 
25
-#if defined (__FreeBSD__) || defined(__APPLE__)
26
+#if defined(__APPLE__)
27
 int	selectbigpk3s( struct dirent * entry)
28
 #else
29
 int	selectbigpk3s( const struct dirent * entry)
(-)vegastrike.new/files/patch-objconv-basemaker-base_maker_texture.cpp (-20 lines)
Lines 1-20 Link Here
1
--- objconv/basemaker/base_maker_texture.cpp.orig	2008-04-24 14:12:53.000000000 +0200
2
+++ objconv/basemaker/base_maker_texture.cpp	2010-04-01 06:40:29.000000000 +0200
3
@@ -73,7 +73,7 @@
4
 		png_set_palette_to_rgb(png_ptr);
5
 
6
 	if (ctype == PNG_COLOR_TYPE_GRAY && data->bpp < 8)
7
-		png_set_gray_1_2_4_to_8(png_ptr);
8
+		png_set_expand_gray_1_2_4_to_8(png_ptr);
9
 
10
 	png_set_expand (png_ptr);
11
 	png_read_update_info (png_ptr,info_ptr);
12
@@ -211,7 +211,7 @@
13
 		unsigned char sig[8];
14
 		fread(sig, sizeof(char), 8, fp);
15
 		fseek(fp,0,SEEK_SET);
16
-		if (png_check_sig(sig, 8)) {
17
+		if (!png_sig_cmp(sig, 0, 8)) {
18
 			return FORMAT_PNG;
19
 		}
20
 	}
(-)vegastrike.new/files/patch-setup-src-c-setup.cpp (-173 lines)
Lines 1-173 Link Here
1
--- setup/src/c/setup.cpp.orig	2008-04-24 16:16:49.000000000 +0400
2
+++ setup/src/c/setup.cpp	2008-05-08 16:55:40.000000000 +0400
3
@@ -25,6 +25,7 @@
4
 #include <stdio.h>
5
 #include <unistd.h>
6
 #include <pwd.h>
7
+#include <sys/stat.h>
8
 #include <sys/types.h>
9
 
10
 #endif
11
@@ -33,6 +34,57 @@
12
 using std::string;
13
 using std::vector;
14
 char origpath[65536];
15
+
16
+static void changeToProgramDirectory(char *argv0) {
17
+    int ret = -1; /* Should it use argv[0] directly? */
18
+    char *program = argv0;
19
+#ifndef _WIN32
20
+    char buf[65536];
21
+    {
22
+	char linkname[128]; /* /proc/<pid>/exe */
23
+	linkname[0]='\0';
24
+	pid_t pid;
25
+	
26
+	/* Get our PID and build the name of the link in /proc */
27
+	pid = getpid();
28
+	
29
+	sprintf(linkname, "/proc/%d/exe", pid);
30
+	ret = readlink(linkname, buf, 65535);
31
+	if (ret <= 0) {
32
+		sprintf(linkname, "/proc/%d/file", pid);
33
+		ret = readlink(linkname, buf, 65535);
34
+	}
35
+	if (ret <= 0) {
36
+		ret = readlink(program, buf, 65535);
37
+	}
38
+	if (ret > 0) {
39
+		buf[ret]='\0';
40
+		/* Ensure proper NUL termination */
41
+		program = buf;
42
+	}
43
+    }
44
+#endif
45
+
46
+    char *parentdir;
47
+    int pathlen=strlen(program);
48
+    parentdir=new char[pathlen+1];
49
+    char *c;
50
+    strncpy ( parentdir, program, pathlen+1 );
51
+    c = (char*) parentdir;
52
+    while (*c != '\0')     /* go to end */
53
+      c++;
54
+    
55
+    while ((*c != '/')&&(*c != '\\')&&c>parentdir)      /* back up to parent */
56
+      c--;
57
+    
58
+    *c = '\0';             /* cut off last part (binary name) */
59
+    if (strlen (parentdir)>0) {
60
+      chdir (parentdir);/* chdir to the binary app's parent */
61
+    }
62
+    delete []parentdir;
63
+}
64
+
65
+
66
 #if defined(_WINDOWS)&&defined(_WIN32)
67
 typedef char FileNameCharType [65536];
68
 int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd) {
69
@@ -44,20 +96,21 @@
70
 #else
71
 int main(int argc, char *argv[]) {
72
 #endif
73
-#if 1
74
-//def _WIN32
75
+
76
+	if (argc>1) {
77
+		if (strcmp(argv[1], "--target")==0 && argc>2) {
78
+			chdir(argv[2]);
79
+		} else {
80
+			fprintf(stderr,"Usage: vssetup [--target DATADIR]\n");
81
+			return 1;
82
+		}
83
+	}
84
 	getcwd (origpath,65535);
85
 	origpath[65535]=0;
86
-        int i;
87
-	for (i=strlen(argv[0]);argv[0][i]!='\\'&&argv[0][i]!='/'&&i>=0;i--) {
88
-	}
89
-	argv[0][i+1]='\0';
90
-	if (i>=0) {
91
-		chdir(argv[0]);
92
-	}
93
-#endif
94
 	
95
-	{	
96
+	changeToProgramDirectory(argv[0]);
97
+	
98
+	{
99
 		vector<string>	data_paths;
100
 #ifdef DATA_DIR
101
 		data_paths.push_back( DATA_DIR);
102
@@ -69,6 +122,7 @@
103
 		data_paths.push_back( string(origpath)+"/data4.x");
104
 		data_paths.push_back( string(origpath)+"/data");
105
 		data_paths.push_back( string(origpath)+"/../data");
106
+		data_paths.push_back( string(origpath)+"/../Resources");
107
 		getcwd (origpath,65535);
108
 		origpath[65535]=0;
109
 		data_paths.push_back( ".");
110
@@ -79,6 +133,8 @@
111
 		data_paths.push_back( "../../data");
112
 		data_paths.push_back( "../Resources");
113
 		data_paths.push_back( "../Resources/data");
114
+		data_paths.push_back( "../Resources/data4.x");
115
+/*
116
 		data_paths.push_back( "/usr/share/local/vegastrike/data");
117
 		data_paths.push_back( "/usr/local/share/vegastrike/data");
118
 		data_paths.push_back( "/usr/local/vegastrike/data");
119
@@ -86,7 +142,6 @@
120
 		data_paths.push_back( "/usr/local/games/vegastrike/data");
121
 		data_paths.push_back( "/usr/games/vegastrike/data");
122
 		data_paths.push_back( "/opt/share/vegastrike/data");
123
-		data_paths.push_back( "../Resources/data4.x");
124
 		data_paths.push_back( "/usr/share/local/vegastrike/data4.x");
125
 		data_paths.push_back( "/usr/local/share/vegastrike/data4.x");
126
 		data_paths.push_back( "/usr/local/vegastrike/data4.x");
127
@@ -94,7 +149,7 @@
128
 		data_paths.push_back( "/usr/local/games/vegastrike/data4.x");
129
 		data_paths.push_back( "/usr/games/vegastrike/data4.x");
130
 		data_paths.push_back( "/opt/share/vegastrike/data4.x");
131
-		
132
+*/		
133
 		// Win32 data should be "."
134
 		char tmppath[16384];
135
 		for( vector<string>::iterator vsit=data_paths.begin(); vsit!=data_paths.end(); vsit++)
136
@@ -118,8 +173,8 @@
137
 #ifndef _WIN32
138
 	struct passwd *pwent;
139
 	pwent = getpwuid (getuid());
140
-        string HOMESUBDIR=".vegastrike";
141
 	
142
+	string HOMESUBDIR;
143
 	FILE *version=fopen("Version.txt","r");
144
 	if (!version)
145
 		version=fopen("../Version.txt","r");
146
@@ -135,13 +190,23 @@
147
 		if (hsd.length()) {
148
 			HOMESUBDIR=hsd;
149
 			//fprintf (STD_OUT,"Using %s as the home directory\n",hsd.c_str());
150
-		}			
151
+		}
152
+	}
153
+	if (HOMESUBDIR.empty()) {
154
+		fprintf(stderr,"Error: Failed to find Version.txt anywhere.\n");
155
+		return 1;
156
 	}
157
 	chdir (pwent->pw_dir);
158
-	chdir (HOMESUBDIR.c_str());
159
+
160
+	mkdir(HOMESUBDIR.c_str()
161
+#ifndef _WIN32
162
+		, 0755
163
 #endif
164
-#ifdef GTK
165
-#endif    //GTK
166
+		);
167
+
168
+#endif
169
+	chdir (HOMESUBDIR.c_str());
170
+	
171
 	Start(&argc,&argv);
172
 #if defined(_WINDOWS)&&defined(_WIN32)
173
 	delete []argv0;
(-)vegastrike.new/files/patch-setup-src-include-file.cpp (-71 lines)
Lines 1-71 Link Here
1
--- setup/src/include/file.cpp.orig	2008-04-24 16:16:50.000000000 +0400
2
+++ setup/src/include/file.cpp	2008-05-09 04:41:07.000000000 +0400
3
@@ -15,6 +15,8 @@
4
  *                                                                         *
5
  **************************************************************************/
6
 #include <string>
7
+#include <sys/stat.h>
8
+
9
 using std::string;
10
 #include "file.h"
11
 extern char origpath[65536];
12
@@ -98,6 +100,17 @@
13
 string mangle_config (string config) {
14
 	return string(origpath)+string("/")+config;
15
 }
16
+
17
+bool useGameConfig(void) {
18
+	struct stat st1,st2;
19
+	if (stat(CONFIG.config_file, &st1)==0 && stat(mangle_config(CONFIG.config_file).c_str(), &st2)==0) {
20
+		if (st2.st_mtime > st1.st_mtime) {
21
+			return true;
22
+		}
23
+	}
24
+	return false;
25
+}
26
+
27
 void LoadConfig(void) {
28
 	FILE *fp;
29
 	char line[MAX_READ+1];
30
@@ -108,8 +121,7 @@
31
 	G_CURRENT = &GROUPS;
32
 	C_CURRENT = &CATS;
33
 
34
-
35
-	if ((fp = fopen(CONFIG.config_file, "r")) == NULL) {
36
+	if (useGameConfig() || (fp = fopen(CONFIG.config_file, "r")) == NULL) {
37
 		origconfig=true;
38
 		if ((fp = fopen(mangle_config(CONFIG.config_file).c_str(), "r")) == NULL) {
39
 			fprintf (stderr, "Unable to read from %s\n", CONFIG_FILE );
40
@@ -185,7 +197,8 @@
41
 	char *p, *parm, *n_parm, *start_write, *end_write;
42
 	int commenting = 0;		// 0 if scanning, 1 if adding comments, 2 if removing comments
43
 	int skip;
44
-	if ((rp = fopen(CONFIG.config_file, "r")) == NULL) {
45
+	
46
+	if (useGameConfig() || (rp = fopen(CONFIG.config_file, "r")) == NULL) {
47
 		if ((rp = fopen(mangle_config(CONFIG.config_file).c_str(), "r")) == NULL) {
48
 			fprintf (stderr, "Unable to read from %s\n", CONFIG_FILE );
49
 			exit(-1);
50
@@ -288,11 +301,20 @@
51
 		}
52
 	}
53
 	string tmp1 = CONFIG.config_file;
54
+/*
55
 	if(origconfig) {
56
 		tmp1 = mangle_config (CONFIG.config_file);
57
 	}
58
+*/
59
 	if ((wp = fopen(tmp1.c_str(), "w")) == NULL) {
60
-		fprintf (stderr, "Unable to write  to %s\n", CONFIG.config_file );
61
+		tmp1 = mangle_config (CONFIG.config_file);
62
+		if ((wp = fopen(tmp1.c_str(), "w")) == NULL) {
63
+			tmp1 = CONFIG.config_file;
64
+			if ((wp = fopen(tmp1.c_str(), "w")) == NULL) {
65
+				fprintf (stderr, "Unable to write  to %s\n", CONFIG.config_file );
66
+				exit(1);
67
+			}
68
+		}
69
 	}
70
 	while ((p = fgets(line, MAX_READ, rp)) != NULL) {
71
 		fprintf(wp, line);
(-)vegastrike.new/files/patch-src-cmd-ai-docking.cpp (-9 lines)
Lines 1-9 Link Here
1
--- src/cmd/ai/docking.cpp.orig	2008-04-24 16:12:16.000000000 +0400
2
+++ src/cmd/ai/docking.cpp	2008-05-05 23:55:37.000000000 +0400
3
@@ -1,5 +1,5 @@
4
-#include <string>
5
 #include "python/python_compile.h"
6
+#include <string>
7
 #include "docking.h"
8
 #include "xml_support.h"
9
 #include "config_xml.h"
(-)vegastrike.new/files/patch-src-cmd-collide2-opcodetypes.h (-18 lines)
Lines 1-18 Link Here
1
--- src/cmd/collide2/opcodetypes.h.orig	2008-04-24 16:12:20.000000000 +0400
2
+++ src/cmd/collide2/opcodetypes.h	2008-05-05 23:57:08.000000000 +0400
3
@@ -198,13 +198,13 @@
4
 #include <wctype.h>
5
 #endif
6
 #if !defined(CS_HAVE_WCHAR_T) && !defined(_WCHAR_T_DEFINED)
7
-typedef uint16 wchar_t;
8
+//typedef uint16 wchar_t;
9
 #define _WCHAR_T_DEFINED
10
 #define CS_WCHAR_T_SIZE 2
11
 #endif
12
 #if !defined(CS_HAVE_WINT_T) && !defined(_WCTYPE_T_DEFINED) && \
13
     !defined(_WINT_T)
14
-typedef wchar_t wint_t;
15
+//typedef wchar_t wint_t;
16
 #define _WCTYPE_T_DEFINED
17
 #define _WINT_T
18
 #endif
(-)vegastrike.new/files/patch-src-gfx-vsimage.cpp (-20 lines)
Lines 1-20 Link Here
1
--- src/gfx/vsimage.cpp.orig	2008-04-24 14:12:37.000000000 +0200
2
+++ src/gfx/vsimage.cpp	2010-03-31 16:39:55.000000000 +0200
3
@@ -147,7 +147,7 @@
4
 	unsigned char sig[8];
5
 	file->Begin();
6
 	file->Read(sig, 8);
7
-	if (!png_check_sig(sig, 8))
8
+	if (png_sig_cmp(sig, 0, 8))
9
 		ret = BadFormat;
10
 	
11
 	return ret;
12
@@ -349,7 +349,7 @@
13
 		png_set_palette_to_rgb(png_ptr);
14
 		   
15
 	if (this->img_color_type == PNG_COLOR_TYPE_GRAY && this->img_depth < 8)
16
-		png_set_gray_1_2_4_to_8(png_ptr);
17
+		png_set_expand_gray_1_2_4_to_8(png_ptr);
18
 
19
 	png_set_expand (png_ptr);
20
 	png_read_update_info (png_ptr,info_ptr);
(-)vegastrike.new/files/patch-src-python-universe_util_export.cpp (-26 lines)
Lines 1-26 Link Here
1
--- src/python/universe_util_export.cpp.orig	2008-04-24 16:11:53.000000000 +0400
2
+++ src/python/universe_util_export.cpp	2008-05-05 23:56:04.000000000 +0400
3
@@ -3,17 +3,18 @@
4
 /* ToDo: Fix so Boost 1.28 is supported */
5
 #if BOOST_VERSION != 102800
6
 
7
-#include "cmd/container.h"
8
-#include <string>
9
-#include "init.h"
10
-#include "gfx/vec.h"
11
-#include "cmd/unit_generic.h"
12
 #include "python_class.h"
13
 #if BOOST_VERSION != 102800
14
 #include <boost/python.hpp>
15
 #else
16
 #include <boost/python/objects.hpp>
17
 #endif
18
+
19
+#include "cmd/container.h"
20
+#include <string>
21
+#include "init.h"
22
+#include "gfx/vec.h"
23
+#include "cmd/unit_generic.h"
24
 #include "universe_util.h"
25
 #include "cmd/unit_util.h"
26
 #include "faction_generic.h"

Return to bug 168957