diff options
-rw-r--r-- | main.c | 24 | ||||
-rwxr-xr-x | scripts/portable_build.sh | 2 | ||||
-rwxr-xr-x | scripts/portable_postbuild.sh | 8 |
3 files changed, 24 insertions, 10 deletions
@@ -591,6 +591,15 @@ restore_resume_state (void) { int main (int argc, char *argv[]) { +#if PORTABLE + strcpy (dbinstalldir, argv[0]); + char *e = dbinstalldir + strlen (dbinstalldir); + while (e >= dbinstalldir && *e != '/') { + e--; + } + *e = 0; +#endif + #ifdef __linux__ signal (SIGSEGV, sigsegv_handler); #endif @@ -598,7 +607,13 @@ main (int argc, char *argv[]) { setlocale (LC_NUMERIC, "C"); #ifdef ENABLE_NLS // fprintf (stderr, "enabling gettext support: package=" PACKAGE ", dir=" LOCALEDIR "...\n"); +#if PORTABLE + char localedir[PATH_MAX]; + snprintf (localedir, sizeof (localedir), "%s/locale", dbinstalldir); + bindtextdomain (PACKAGE, localedir); +#else bindtextdomain (PACKAGE, LOCALEDIR); +#endif bind_textdomain_codeset (PACKAGE, "UTF-8"); textdomain (PACKAGE); #endif @@ -618,15 +633,6 @@ main (int argc, char *argv[]) { prctl (PR_SET_NAME, "deadbeef-main", 0, 0, 0, 0); #endif -#if PORTABLE - strcpy (dbinstalldir, argv[0]); - char *e = dbinstalldir + strlen (dbinstalldir); - while (e >= dbinstalldir && *e != '/') { - e--; - } - *e = 0; -#endif - #if PORTABLE_FULL if (snprintf (confdir, sizeof (confdir), "%s/config", dbinstalldir) > sizeof (confdir)) { fprintf (stderr, "fatal: too long install path %s\n", dbinstalldir); diff --git a/scripts/portable_build.sh b/scripts/portable_build.sh index c3e396fc..45218e31 100755 --- a/scripts/portable_build.sh +++ b/scripts/portable_build.sh @@ -7,7 +7,7 @@ export APBUILD_STATIC_LIBGCC=1 export CC=$ORIGIN/tools/apbuild/apgcc export CXX=$ORIGIN/tools/apbuild/apgcc -./configure --enable-staticlink --enable-portable --disable-nls --disable-artwork-imlib2 +./configure --enable-staticlink --enable-portable --disable-artwork-imlib2 sed -i 's/-lstdc++ -lm -lgcc_s -lc -lgcc_s/-lm -lc/g' libtool make clean make -j9 diff --git a/scripts/portable_postbuild.sh b/scripts/portable_postbuild.sh index 0ed1a186..76268386 100755 --- a/scripts/portable_postbuild.sh +++ b/scripts/portable_postbuild.sh @@ -64,6 +64,14 @@ done # icon cp ./icons/32x32/deadbeef.png $OUTDIR/ +# translations +mkdir -p $OUTDIR/locale +for i in po/*.gmo ; do + base=`basename po/$i .gmo` + mkdir -p $OUTDIR/locale/$base/LC_MESSAGES + cp $i $OUTDIR/locale/$base/LC_MESSAGES/deadbeef.mo +done + # strip if [ $OSTYPE != 'Darwin' ];then strip --strip-unneeded $OUTDIR/deadbeef |