changeset 1353:c3e3b0ae4d06

Applied DATADIR patch by Vladimir Kushnir
author arpi
date Fri, 20 Jul 2001 00:01:09 +0000
parents 5ac130627602
children e28a160922d4
files configure libvo/font_load.c libvo/font_load.h mplayer.c
diffstat 4 files changed, 35 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Fri Jul 20 00:00:08 2001 +0000
+++ b/configure	Fri Jul 20 00:01:09 2001 +0000
@@ -116,6 +116,8 @@
 params:
         --cc                    use this C compiler to build MPlayer [gcc]
 	--prefix=DIR		use this prefix for installing mplayer [/usr/local]
+	--datadir=DIR           use this prefix for installing machine independent
+				data [/usr/local/share/mplayer] 
 	--enable-debug[=1-3]	compile debugging information into mplayer [disable]
 	--enable-profile	compile profiling information into mplayer [disable]
         --enable-mmx            build with mmx support [autodetect]
@@ -915,6 +917,7 @@
 # check for the parameters.
 
 _prefix="/usr/local"
+_datadir=$_prefix"/share/mplayer"
 
 for ac_option
 do
@@ -1141,6 +1144,9 @@
   --prefix=*)
 	_prefix=`echo $ac_option | cut -d '=' -f 2`
         ;;
+  --datadir=*)
+	_datadir=`echo $ac_option | cut -d '=' -f 2`
+	;;
   --cc=*)
 	;;
   --as=*)
@@ -1249,6 +1255,7 @@
 
 # to screen.
 echo "Install prefix: $_prefix"
+echo "Data directory: $_datadir"
 if [ "$host_arch" = i386 ]; then
     echo "Checking for cpu vendor ... $pvendor ( $pfamily:$pmodel:$pstepping )"
     echo "Checking for cpu type ... $pname"
@@ -1722,6 +1729,9 @@
 
 /* -------- Generated by ./configure ----------- */
 
+/* Common data directory (for fonts, etc) */
+#define DATADIR "$_datadir"
+
 /* Define for using new DivX4Linux library, instead of open-source OpenDivX */
 /* You have to change DECORE_LIBS in config.mak too! */
 #undef NEW_DECORE
--- a/libvo/font_load.c	Fri Jul 20 00:00:08 2001 +0000
+++ b/libvo/font_load.c	Fri Jul 20 00:01:09 2001 +0000
@@ -110,41 +110,40 @@
       }
   }
   
+  if(strcmp(section,"[fpath]")==0){
+      if(pdb==1){
+          desc->fpath=strdup(p[0]);
+          continue;
+      }
+  } else    
+
   if(strcmp(section,"[files]")==0){
       if(pdb==2 && strcmp(p[0],"alpha")==0){
-    	  char *cp,*cp2;
-	  if (!(cp=get_path("font/"))) return NULL;
-	  if (!(cp2=malloc(strlen(cp)+strlen(p[1])+1))) {
-		free(cp);
-		return NULL;
-	  }
-	  sprintf(cp2,"%s%s",cp,p[1]);
-          if(!((desc->pic_a[fontdb]=load_raw(cp2,verbose)))){
+    	  char *cp;
+	  if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) return NULL;
+
+	  snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s",
+		desc->fpath,p[1]);
+          if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){
                 printf("Can't load font bitmap: %s\n",p[1]);
 		free(cp);
-		free(cp2);
                 return NULL;
           }
 	  free(cp);
-	  free(cp2);
           continue;
       }
       if(pdb==2 && strcmp(p[0],"bitmap")==0){
-    	  char *cp,*cp2;
-	  if (!(cp=get_path("font/"))) return NULL;
-	  if (!(cp2=malloc(strlen(cp)+strlen(p[1])+1))) {
-		free(cp);
-		return NULL;
-	  }
-	  sprintf(cp2,"%s%s",cp,p[1]);
-          if(!((desc->pic_b[fontdb]=load_raw(cp2,verbose)))){
+    	  char *cp;
+	  if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) return NULL;
+
+	  snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s",
+		desc->fpath,p[1]);
+          if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){
                 printf("Can't load font bitmap: %s\n",p[1]);
 		free(cp);
-		free(cp2);
                 return NULL;
           }
 	  free(cp);
-	  free(cp2);
           continue;
       }
   } else
--- a/libvo/font_load.h	Fri Jul 20 00:00:08 2001 +0000
+++ b/libvo/font_load.h	Fri Jul 20 00:01:09 2001 +0000
@@ -7,6 +7,7 @@
 
 typedef struct {
     char *name;
+    char *fpath;
     int spacewidth;
     int charspace;
     int height;
--- a/mplayer.c	Fri Jul 20 00:00:08 2001 +0000
+++ b/mplayer.c	Fri Jul 20 00:01:09 2001 +0000
@@ -568,9 +568,11 @@
 
 // check codec.conf
 if(!parse_codec_cfg(get_path("codecs.conf"))){
-    fprintf(stderr,"(copy/link DOCS/codecs.conf to ~/.mplayer/codecs.conf)\n");
+  if(!parse_codec_cfg(DATADIR"/codecs.conf")){
+    printf("(copy/link DOCS/codecs.conf to ~/.mplayer/codecs.conf)\n");
     GUI_MSG( mplCodecConfNotFound )
     exit(1);
+  }
 }
 
 // check font
@@ -580,6 +582,8 @@
   } else {
       // try default:
        vo_font=read_font_desc(get_path("font/font.desc"),font_factor,verbose>1);
+       if(!vo_font)
+       vo_font=read_font_desc(DATADIR"/font/font.desc",font_factor,verbose>1);
   }
 
 // check .sub