This commit is contained in:
miqlas
2018-09-01 18:05:42 +02:00
committed by GitHub
parent 52b5d3735a
commit e2e4b31a9a
4 changed files with 120 additions and 109 deletions

View File

@@ -5,13 +5,13 @@ PROGRAM_NAME=ja2
DATA_PATH=`/bin/finddir B_USER_NONPACKAGED_DATA_DIRECTORY`/$PROGRAM_NAME
FILE=$DATA_PATH/data/binarydata/ja2bin.dat
CONFIG_FILE_PATH=`/bin/finddir B_USER_SETTINGS_DIRECTORY`/$PROGRAM_NAME
CONFIG_FILE=$CONFIG_FILE_PATH/ja2.ini
CONFIG_FILE=$CONFIG_FILE_PATH/ja2.json
# If the file exists...
if [ -f $FILE ];
then
# ...then start the program
open `/bin/finddir B_SYSTEM_APPS_DIRECTORY`/JA2/ja2 $@
`/bin/finddir B_SYSTEM_APPS_DIRECTORY`/JA2/bin/ja2 -datadir $DATA_PATH $@
else
# but if it isn't exist drop a warning
@@ -19,8 +19,9 @@ if [ "$(alert --warning "Please, copy your original JA2 Files to the Data Folder
# then let's create the data Dir and open it
mkdir -p $CONFIG_FILE_PATH
echo "#Tells ja2-stracciatella where the binary datafiles are located" > $CONFIG_FILE
echo "data_dir = $DATA_PATH" >> $CONFIG_FILE
echo "{" >> $CONFIG_FILE
echo "\"data_dir\": \"$DATA_PATH\"" >> $CONFIG_FILE
echo "}" >> $CONFIG_FILE
mkdir -p $DATA_PATH
open $DATA_PATH

View File

@@ -10,7 +10,7 @@ COPYRIGHT="2004 Strategy First Inc."
LICENSE="SFI-SCLA"
REVISION="1"
SOURCE_URI="https://github.com/ja2-stracciatella/ja2-stracciatella/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="20b0a28ce37190f1a24f7c65ecf458e8379bc46ad342a62719e9b5cd241b03ad"
CHECKSUM_SHA256="750c56b7011479dc89ce1f57f3da551d856a75eb87b545bc655dcbb87c42ba43"
SOURCE_DIR="ja2-stracciatella-$portVersion"
PATCHES="ja2_stracciatella-$portVersion.patchset"
ADDITIONAL_FILES="
@@ -27,24 +27,52 @@ PROVIDES="
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libSDL$secondaryArchSuffix
lib:libboost_filesystem$secondaryArchSuffix
lib:libboost_system$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libSDL$secondaryArchSuffix
devel:libboost_filesystem$secondaryArchSuffix
devel:libboost_system$secondaryArchSuffix
devel:libgl$secondaryArchSuffix
devel:libSDL2_2.0$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:python2
cmd:rustc
cmd:sed
cmd:wget
"
defineDebugInfoPackage ja2_stracciatella$secondaryArchSuffix \
$appsDir/JA2/bin/ja2
BUILD()
{
mkdir -p haiku_build && cd haiku_build
cmake .. \
-DSDL2_INCLUDE_DIR="$portPackageLinksDir/devel~libsdl2_2.0/$relativeIncludeDir/SDL2" \
-DLOCAL_GTEST_LIB=OFF \
-DWITH_UNITTESTS=OFF \
-DCMAKE_INSTALL_PREFIX="$appsDir/JA2"
make $jobArgs
}
INSTALL()
{
cd haiku_build
make install
# Preparing the attributes
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3`"
@@ -55,17 +83,6 @@ BUILD()
$portDir/additional-files/ja2_stracciatella.rdef.in \
> ja2_stracciatella.rdef
configure --prefix=$appsDir/JA2
make $jobArgs \
WITH_ZLIB=1 \
WITH_UNITTESTS=0
}
INSTALL()
{
make install
# Installing start-script
cp $portDir/additional-files/ja2_stracciatella.sh \
$appsDir/JA2
@@ -77,7 +94,7 @@ INSTALL()
ja2_stracciatella.rsrc
addResourcesToBinaries ja2_stracciatella.rdef \
$appsDir/JA2/ja2
$appsDir/JA2/bin/ja2
# Creating Deskbar-link
addAppDeskbarSymlink $appsDir/JA2/ja2_stracciatella.sh \
@@ -86,7 +103,7 @@ INSTALL()
# Cleanup
mkdir -p $manDir
mv $appsDir/JA2/share/man/* $manDir
mv $appsDir/JA2/bin/ja2 $appsDir/JA2
rm -rf $appsDir/JA2/share/{applications,icons,man}
rm -rf $appsDir/JA2/bin
mv $appsDir/JA2/share/ja2/* $appsDir/JA2/bin
rm -rf $appsDir/JA2/share
ln -s $appsDir/JA2/lib $appsDir/JA2/bin
}

View File

@@ -1,87 +0,0 @@
From 5893be972ebe1896ae3d5ab9c8882e050b7028e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Wed, 7 Jun 2017 07:54:07 +0200
Subject: [PATCH] PATCH: LC_ALL not defined on Haiku
---
sgp/SGP.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sgp/SGP.cc b/sgp/SGP.cc
index 7b9b710..aa1be0a 100644
--- a/sgp/SGP.cc
+++ b/sgp/SGP.cc
@@ -313,6 +313,12 @@ static BOOLEAN ParseParameters(int argc, char* const argv[],
int main(int argc, char* argv[])
try
{
+
+#if defined(__HAIKU__)
+ /*LC_ALL not defined on Haiku, an JA needs to set it to "C" */
+ setenv("LC_ALL","C",1);
+#endif
+
std::string exeFolder = FileMan::getParentPath(argv[0], true);
#if defined BROKEN_SWPRINTF
--
2.12.2
From d612275101c558e8380c57e2029fac9b835f7e47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Wed, 7 Jun 2017 07:57:36 +0200
Subject: [PATCH] PATCH: dirent dirty fix
---
sgp/FileMan.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sgp/FileMan.cc b/sgp/FileMan.cc
index 0b607c2..3260d19 100644
--- a/sgp/FileMan.cc
+++ b/sgp/FileMan.cc
@@ -539,6 +539,8 @@ bool FileMan::findObjectCaseInsensitive(const char *directory, const char *name,
}
}
}
+#ifndef __HAIKU__
+/* FIXME: dirty hack to eliminate dirent stuff*/
else
{
// name contains only file, no directories
@@ -561,6 +563,7 @@ bool FileMan::findObjectCaseInsensitive(const char *directory, const char *name,
closedir(d);
}
}
+#endif /*__HAIKU__*/
// LOG_INFO("XXXXX Looking for %s/[ %s ] : %s\n", directory, name, result ? "success" : "failure");
return result;
--
2.12.2
From 2c6099a9cbea2d6341565bf220e62c5028939a7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Wed, 7 Jun 2017 17:57:57 +0200
Subject: [PATCH] Patch: Haiku config file location
---
sgp/FileMan.cc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sgp/FileMan.cc b/sgp/FileMan.cc
index 3260d19..f21c8c0 100644
--- a/sgp/FileMan.cc
+++ b/sgp/FileMan.cc
@@ -111,6 +111,8 @@ std::string FileMan::findConfigFolderAndSwitchIntoIt()
#ifdef _WIN32
std::string configFolderPath = FileMan::joinPaths(home, "JA2");
+#elif defined(__HAIKU__)
+ std::string configFolderPath = FileMan::joinPaths(home, "config/settings/ja2");
#else
std::string configFolderPath = FileMan::joinPaths(home, ".ja2");
#endif
--
2.12.2

View File

@@ -0,0 +1,80 @@
From 5893be972ebe1896ae3d5ab9c8882e050b7028e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Wed, 7 Jun 2017 07:54:07 +0200
Subject: [PATCH] PATCH: LC_ALL not defined on Haiku
diff --git a/src/sgp/SGP.cc b/src/sgp/SGP.cc
index 033105e..4ce6808 100644
--- a/src/sgp/SGP.cc
+++ b/src/sgp/SGP.cc
@@ -265,6 +265,12 @@ ContentManager *GCM = NULL;
int main(int argc, char* argv[])
{
+
+#if defined(__HAIKU__)
+ /*LC_ALL not defined on Haiku, an JA needs to set it to "C" */
+ setenv("LC_ALL","C",1);
+#endif
+
std::string exeFolder = FileMan::getParentPath(argv[0], true);
#if defined BROKEN_SWPRINTF
--
2.16.4
From d612275101c558e8380c57e2029fac9b835f7e47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Wed, 7 Jun 2017 07:57:36 +0200
Subject: [PATCH] PATCH: dirent dirty fix
diff --git a/src/sgp/FileMan.cc b/src/sgp/FileMan.cc
index a304a98..b6672fe 100644
--- a/src/sgp/FileMan.cc
+++ b/src/sgp/FileMan.cc
@@ -540,6 +540,8 @@ bool FileMan::findObjectCaseInsensitive(const char *directory, const char *name,
}
}
}
+#ifndef __HAIKU__
+/* FIXME: dirty hack to eliminate dirent stuff*/
else
{
// name contains only file, no directories
@@ -562,6 +564,7 @@ bool FileMan::findObjectCaseInsensitive(const char *directory, const char *name,
closedir(d);
}
}
+#endif /*__HAIKU__*/
// SLOGI(DEBUG_TAG_FILEMAN,"Looking for %s/[ %s ] : %s", directory, name, result ? "success" : "failure");
return result;
--
2.16.4
From 2c6099a9cbea2d6341565bf220e62c5028939a7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Wed, 7 Jun 2017 17:57:57 +0200
Subject: [PATCH] Patch: Haiku config file location
diff --git a/rust/src/stracciatella.rs b/rust/src/stracciatella.rs
index 582600e..6e7915e 100644
--- a/rust/src/stracciatella.rs
+++ b/rust/src/stracciatella.rs
@@ -366,7 +366,7 @@ pub fn find_stracciatella_home() -> Result<PathBuf, String> {
match env::home_dir() {
Some(mut path) => {
- path.push(".ja2");
+ path.push("config/settings/ja2");
return Ok(path);
},
None => Err(String::from("Could not find home directory")),
--
2.16.4