pipepanic: move from games-kids to games-puzzle; minor changes. (#606)

* Move pipepanic from games-kids to games-puzzle to follow Gentoo.
* Put pipepanic.rdef in additional-files instead of the patch file.
* Call addResourcesToBinaries instead of rc and xres.
* Reorder sections, fix COPYRIGHT, enable x86_64, drop cmd:xres from
  BUILD_REQUIRES, add cmd:{sdl_config,install,cut} to BUILD_PREREQ.
* Install README and do some polishing in BUILD and INSTALL.
This commit is contained in:
fbrosson
2016-05-24 21:57:57 +00:00
parent 5409cad381
commit 0c1be5b940
4 changed files with 101 additions and 87 deletions

View File

@@ -1,154 +0,0 @@
diff --git a/main.c b/main.c
index 6cf114c..960f57a 100644
--- a/main.c
+++ b/main.c
@@ -16,6 +16,14 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Includes */
+// chdir()
+#include <unistd.h>
+#include <libgen.h>
+
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
+
#include <SDL/SDL_main.h>
#include <SDL/SDL.h>
#include <string.h>
@@ -44,6 +52,10 @@ SDL_Surface *temp;
SDL_Event event;
char *current_dir;
char *user_home_dir;
+#ifdef __HAIKU__
+char user_settings_dir[256];
+#endif
+char save_file[256];
int quit = 0;
int game_mode = GAMEON;
int previous_game_mode = 0;
@@ -102,6 +114,9 @@ extern "C"
int main(int argc, char *argv[]) {
int count, count2;
+ // For tracker (Thanks PulkoMandy)
+ chdir(dirname(argv[0]));
+
/* Initialise the highscoreboard array because there may not yet
be a saved highscore[board]/rc file */
for (count = 0; count < 5; count++) {
@@ -114,7 +129,16 @@ int main(int argc, char *argv[]) {
current_dir = getenv("PWD");
user_home_dir = getenv("HOME");
-
+
+ #ifdef __HAIKU__
+ find_directory(B_USER_SETTINGS_DIRECTORY, NULL, true,
+ user_settings_dir, sizeof(user_settings_dir));
+ snprintf(save_file, sizeof(save_file),
+ "%s/" RESOURCEFILE, user_settings_dir);
+ #else
+ snprintf(save_file, sizeof(save_file),
+ "%s/" RESOURCEFILE, user_home_dir);
+ #endif
#ifdef DEBUG
printf("PWD=%s\n", current_dir);
printf("HOME=%s\n", user_home_dir);
@@ -1567,16 +1591,12 @@ void read_rc_file(void) {
FILE* file;
int result, value, count;
- strcpy(buffer, user_home_dir);
- strcat(buffer, "/");
- strcat(buffer, RESOURCEFILE);
-
#ifdef DEBUG
- printf("%s\n", buffer);
+ printf("%s\n", save_file);
#endif
- if ((file = fopen(buffer,"r")) == NULL) {
- printf("%s: Cannot read from file %s\n", __func__, buffer);
+ if ((file = fopen(save_file,"r")) == NULL) {
+ printf("%s: Cannot read from file %s\n", __func__, save_file);
return;
}
@@ -1638,20 +1658,15 @@ void read_rc_file(void) {
***************************************************************************/
void save_rc_file(void) {
- char buffer[256];
FILE* file;
int count;
- strcpy(buffer, user_home_dir);
- strcat(buffer, "/");
- strcat(buffer, RESOURCEFILE);
-
#ifdef DEBUG
- printf("%s\n", buffer);
+ printf("%s\n", save_file);
#endif
- if ((file = fopen(buffer,"w")) == NULL) {
- printf("%s: Cannot write to file %s\n", __func__, buffer);
+ if ((file = fopen(save_file,"w")) == NULL) {
+ printf("%s: Cannot write to file %s\n", __func__, save_file);
return;
}
diff --git a/main.h b/main.h
index 664b75b..178f665 100644
--- a/main.h
+++ b/main.h
@@ -27,7 +27,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define TILES48BMP "tiles48.bmp"
#define ASCII15BMP "ascii15.bmp"
#define ASCII30BMP "ascii30.bmp"
+#ifdef __HAIKU__
+#define RESOURCEFILE "pipepanic"
+#else
#define RESOURCEFILE ".pipepanicrc"
+#endif
#define MAGENTA 0xff, 0x00, 0xff
#define YELLOW 0xff, 0xcc, 0x66
diff --git a/pipepanic.rdef b/pipepanic.rdef
new file mode 100644
index 0000000..096d98d
--- /dev/null
+++ b/pipepanic.rdef
@@ -0,0 +1,30 @@
+resource app_signature "application/x-vnd.Thnor-Pipepanic";
+
+resource app_version {
+ major = 0,
+ middle = 1,
+ minor = 3,
+
+ variety = B_APPV_FINAL,
+ internal = 0,
+
+ short_info = "A pipe connecting game",
+ long_info = "A pipe connecting game"
+};
+
+resource app_flags B_SINGLE_LAUNCH;
+
+resource vector_icon {
+ $"6E636966070500020006030000003ABFAEBABFAE0000004B750A49FE3D1BFF00"
+ $"0082FF8C8CE0FF0000020006030000003ABFAEBABFAE0000004D228549FE3D1B"
+ $"197F008200FF00E0657F00020006030000003A2000BA20000000004AB0004A00"
+ $"00000000FF807272FFFB0000FF020006030000003A2000BA20000000004AB000"
+ $"4A000000CCBC3E7EFFEB4EFBCCBC3E020016030000003A123DBA123D00000048"
+ $"A6E149FEE1004883FFFD4804228D070A042635264B2F4B2F350A044B354B4B54"
+ $"4B54350A093C353CC41042C42042484A484A38423842BB5C3CBB5C0A04383538"
+ $"4B3C4B3C350A042F382F48384838380A042F382F49304930380A142F35263526"
+ $"4B2F4B2F483848384B424B42484B484B4B544B54354B354B3842384235383538"
+ $"382F380B0A0601062027280A0001061001178402040A010100000A020101000A"
+ $"030102000A040103000A050104000A000105000A0001052028200A0001052033"
+ $"200A000105203B1F"
+};

View File

@@ -1,51 +0,0 @@
SUMMARY="A pipe connecting game"
DESCRIPTION="Pipepanic is a pipe connecting game using libSDL. Connect as many \
different shaped pipes together as possible within the time given.
"
HOMEPAGE="http://www.users.waitrose.com/~thunor/pipepanic/"
SOURCE_URI="http://www.users.waitrose.com/~thunor/pipepanic/dload/pipepanic-0.1.3-source.tar.gz"
CHECKSUM_SHA256="4b02249c92228b03f4cc3c1d999cacf3fe52c16df53c6bf76fc6c1e2caa74318"
SOURCE_DIR="pipepanic-0.1.3-source"
LICENSE="GNU GPL v2"
COPYRIGHT="2005-2013 Thunor"
REVISION="3"
ARCHITECTURES="x86_gcc2 x86"
PROVIDES="
pipepanic = $portVersion
app:Pipepanic = $portVersion
"
REQUIRES="
haiku
lib:libsdl
"
BUILD_REQUIRES="
haiku_devel
devel:libsdl
cmd:xres
"
BUILD_PREREQUIRES="
cmd:gcc
cmd:make
"
USER_SETTINGS_FILES="
settings/pipepanic
"
PATCHES="
pipepanic-0.1.3.patch
"
BUILD()
{
make
rc -o pipepanic.rsrc pipepanic.rdef
xres -o pipepanic pipepanic.rsrc
}
INSTALL()
{
mkdir -p $appsDir/Pipepanic
mv pipepanic $appsDir/Pipepanic/Pipepanic
cp ascii15.bmp ascii30.bmp digits24.bmp digits48.bmp tiles24.bmp tiles48.bmp $appsDir/Pipepanic/
addAppDeskbarSymlink $appsDir/Pipepanic/Pipepanic
}