[Mplayer-dev-eng] Suggestion: system-wide (fonts, configuration)

Vladimir Kushnir vkushnir at Alfacom.net
Tue Jun 26 23:58:23 CEST 2001


Hello,
Since mplayer step by step outgrows merely devopment stage wouldn't it
make some sence to install fonts and configuration files globally (say,
in /usr/local/share/mplayer)? I've written a small patch which lets
mplayer to use this directory (DATADIR) as a fallback if there is no
~/.mplayer/. So far didn't touch installation process (Makefile), though.
Honestly, I don't particularly like what I've done but perhaps somebody will
make it better?

Regards,
Vladimir

-- 
Vladimir Kushnir - vkushnir at Alfacom.net
-------------- next part --------------
*** /usr/local/src/ncvs/MM/mplayer/main/configure	Tue Jun 26 02:16:47 2001
--- main/configure	Tue Jun 26 23:39:41 2001
***************
*** 99,104 ****
--- 99,106 ----
  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 mplayer documentation
+ 				and fonts [/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]
***************
*** 754,759 ****
--- 756,762 ----
  # check for the parameters.
  
  _prefix="/usr/local"
+ _datadir="/usr/local/share/mplayer"
  
  for ac_option
  do
***************
*** 977,982 ****
--- 980,988 ----
    --prefix=*)
  	_prefix=`echo $ac_option | cut -d '=' -f 2`
          ;;
+   --datadir=*)
+ 	_datadir=`echo $ac_option | cut -d '=' -f 2`
+ 	;;
    --cc=*)
  	;;
    --as=*)
***************
*** 1084,1089 ****
--- 1090,1096 ----
  
  # to screen.
  echo "Install prefix: $_prefix"
+ echo "Data directory: $_datadir"
  echo "Checking for cpu vendor ... $pvendor ( $pfamily:$pmodel:$pstepping )"
  echo "Checking for cpu type ... $pname"
  echo "Optimizing to ... $proc"
***************
*** 1095,1100 ****
--- 1102,1108 ----
  echo "Checking for mtrr support ... $_mtrr"
  echo "Screen size ... ${_x}x${_y}"
  echo "Checking for X11 libs ... $_x11libdir"
+ echo "Checking for X11 headers ... $_x11incdir"
  echo "Checking mga_vid device ... $_mga"
  echo "Checking for xmga ... $_xmga" 
  echo "Checking for SDL ... $_sdl"
***************
*** 1115,1120 ****
--- 1123,1130 ----
  echo "Checking for PNG support ... $_png"
  echo "Checking for DirectShow ... $_dshow"
  echo "Checking for fastmemcpy ... $_fastmemcpy"
+ echo "Checking for extra libs ... $_extralibdir"
+ echo "Checking for extra headers ... $_extraincdir"
  # write conf files.
  
  _streamingdef='#undef STREAMING'
***************
*** 1291,1297 ****
  CC=$_cc
  X11DIR=$_x11libdir
  # OPTFLAGS=-O4 $_profile $_debug -march=$proc -mcpu=$proc -pipe -fomit-frame-pointer -ffast-math
! OPTFLAGS=$CFLAGS $_x11incdir $_extraincdir
  # LIBS=-L/usr/lib -L/usr/local/lib $_x11libdir $_gllib $_sdllib $_ggilib $_dgalib $_x11lib $_xvlib
  X_LIBS=$_x11libdir $_extralibdir $_gllib $_sdllib $_ggilib $_dgalib $_x11lib $_xvlib $_vmlib $_svgalib $_libpng $_socklib
  TERMCAP_LIB=$_libtermcap
--- 1301,1307 ----
  CC=$_cc
  X11DIR=$_x11libdir
  # OPTFLAGS=-O4 $_profile $_debug -march=$proc -mcpu=$proc -pipe -fomit-frame-pointer -ffast-math
! OPTFLAGS=$CFLAGS $_x11incdir $_extraincdir -DDATADIR=\"$_datadir\"
  # LIBS=-L/usr/lib -L/usr/local/lib $_x11libdir $_gllib $_sdllib $_ggilib $_dgalib $_x11lib $_xvlib
  X_LIBS=$_x11libdir $_extralibdir $_gllib $_sdllib $_ggilib $_dgalib $_x11lib $_xvlib $_vmlib $_svgalib $_libpng $_socklib
  TERMCAP_LIB=$_libtermcap
***************
*** 1307,1312 ****
--- 1317,1323 ----
  ALSA_LIB = $_alsalib
  ESD_LIB = $_esdlib
  prefix = $_prefix
+ datadir = $_datadir
  ARCH_LIBS = $_archlibs
  STREAM_SRCS = $_streamingsrcs
  
*** /usr/local/src/ncvs/MM/mplayer/main/libvo/font_load.c	Sun Jun  3 01:29:21 2001
--- main/libvo/font_load.c	Tue Jun 26 18:13:31 2001
***************
*** 51,57 ****
  desc=malloc(sizeof(font_desc_t));if(!desc) return NULL;
  memset(desc,0,sizeof(font_desc_t));
  
! f=fopen(fname,"rt");if(!f){ printf("font: can't open file: %s\n",fname); return NULL;}
  
  // set up some defaults, and erase table
  desc->charspace=2;
--- 51,63 ----
  desc=malloc(sizeof(font_desc_t));if(!desc) return NULL;
  memset(desc,0,sizeof(font_desc_t));
  
! f=fopen(fname,"rt");
! if(!f){
!   fname = DATADIR"/font/font.desc";
!   f=fopen(fname,"rt");
!   if(!f){
!   printf("font: can't open file: %s\n",fname); return NULL;}
! }
  
  // set up some defaults, and erase table
  desc->charspace=2;
***************
*** 120,129 ****
--- 126,138 ----
  	  }
  	  sprintf(cp2,"%s%s",cp,p[1]);
            if(!((desc->pic_a[fontdb]=load_raw(cp2,verbose)))){
+ 	    sprintf(cp2,"%s/font/%s",DATADIR,p[1]);
+             if(!((desc->pic_a[fontdb]=load_raw(cp2,verbose)))){	  
                  printf("Can't load font bitmap: %s\n",p[1]);
  		free(cp);
  		free(cp2);
                  return NULL;
+             }
            }
  	  free(cp);
  	  free(cp2);
***************
*** 138,147 ****
--- 147,159 ----
  	  }
  	  sprintf(cp2,"%s%s",cp,p[1]);
            if(!((desc->pic_b[fontdb]=load_raw(cp2,verbose)))){
+             sprintf(cp2,"%s/font/%s",DATADIR,p[1]);
+             if(!((desc->pic_b[fontdb]=load_raw(cp2,verbose)))){
                  printf("Can't load font bitmap: %s\n",p[1]);
  		free(cp);
  		free(cp2);
                  return NULL;
+             }    
            }
  	  free(cp);
  	  free(cp2);
*** /usr/local/src/ncvs/MM/mplayer/main/mplayer.c	Sun Jun 24 08:39:02 2001
--- main/mplayer.c	Tue Jun 26 18:13:31 2001
***************
*** 624,632 ****
--- 624,634 ----
  
  // check codec.conf
  if(!parse_codec_cfg(get_path("codecs.conf"))){
+   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


More information about the MPlayer-dev-eng mailing list