Mostrando entradas con la etiqueta chapuza. Mostrar todas las entradas
Mostrando entradas con la etiqueta chapuza. Mostrar todas las entradas

domingo, 3 de octubre de 2010

El soporte para la Intel 855GM va a peor en Ubuntu

Mi portátil empezó su singladura en Ubuntu en 8.04. Todo se instaló sin problemas.
La actualización a 8.10 transcurrió sin novedad. Tras modernizarme a 9.10, la aceleración de vídeo dejó de funcionar.

Acabo de actualizar a 10.04, y el soporte para mi tarjeta gráfica ha ido todavía, a peor: ni siquiera arranca.

Sí, hay ñapas para sobrevivir a ambos fallos, pero la gente instala Ubuntu por su facilidad de uso, es muy  raro que se lean las "Release Notes" (yo, desde luego, las leo sólo cuando todo falla).

Está claro que la prioridad de los programadores de Intel es sabotear tarjetas antiguas.

sábado, 11 de septiembre de 2010

Ojo con el punto y la coma

Los anglosajones usan el punto para separar decimales. Los españoles usamos la coma.
De vez en cuando, hay algún programa (suelen ser los que importan datos en CSV) que pide ir al Panel de Control y cambiar el separador de decimales de coma a punto.

Ojo, porque este acto, en apariencia inocente, confunde de mala manera a algunos programas escritos chapuceramente. Por ejemplo, al Administrador de Tareas de Vista:

A la izquierda el separador de decimales es coma, y a la derecha es punto
O igual es que así los programas consumen mil veces menos memoria ...

lunes, 23 de marzo de 2009

gd-2.0.36

Como parte de nuestra búsqueda de la brevedad y la bondad, vamos a aligerar un poco a libGD.

El paquete oficial de Cygwin tiene como dependencias a:
cygwin libXpm4 libfontconfig1 libjpeg62 libpng12

El problema es que libXpm4 tiene como dependencias al megapaquetón libX11_6, sólo para usar las funciones que manejan los bitmaps XPM, así que se puede sustituir por libXpm-noX.

Quitar libfontconfig1, es fácil: al compilar el fuente de libGD, tenemos una opción durante la configuración.

libiconv sólo se usa para convertir de una oscura codificación de japonés a Unicode. Así que fuera, mejor usar Unicode directamente para los (ejem, escasos) textos en japonés que yo maneje.

Otro ahorro es quitar la tipografía de tamaño fijo.

Así que vamos poco a poco editando los fuentes e intentando compilarlos, y cuando ya ya funciona, guardamos los cambios en un parche:

diff -u Makefile.am.org Makefile.am > ../patches/libgd.trim.1.diff
diff -u configure.ac.org configure.ac >> ../patches/libgd.trim.1.diff
diff -u config/gdlib-config.in.org config/gdlib-config.in >> ../patches/libgd.trim.1.diff
diff -u gdft.c.org gdft.c >> ../patches/libgd.trim.1.diff
diff -u gddemo.c.org gddemo.c >> ../patches/libgd.trim.1.diff


El parche es una chapucilla: lo elegante sería un parche por cambio, y enviarlos a libGD.

El parche es éste:

--- Makefile.am.org 2007-11-27 09:30:34.000000000 +0100
+++ Makefile.am 2009-03-19 11:30:01.260819300 +0100
@@ -13,17 +13,19 @@

EXTRA_DIST = README-JPEG.TXT README.TXT configure.pl bdftogd demoin.png err.out index.html install-item makefile.sample readme.jpn entities.html entities.tcl

-include_HEADERS = gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h entities.h
+include_FIXFONTS = gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h
+
+include_HEADERS = gd.h gdfx.h gd_io.h gdcache.h entities.h

lib_LTLIBRARIES = libgd.la

-libgd_la_SOURCES = gd.c gdfx.c gd_security.c gd_gd.c gd_gd2.c gd_io.c gd_io_dp.c gd_gif_in.c gd_gif_out.c gd_io_file.c gd_io_ss.c gd_jpeg.c gd_png.c gd_ss.c gd_topal.c gd_wbmp.c gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c gdft.c gdhelpers.c gdhelpers.h gdkanji.c gdtables.c gdxpm.c jisx0208.h wbmp.c wbmp.h
+libgd_la_FIXFONTSOURCES = gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c

-libgd_la_LDFLAGS = -version-info 2:0:0 $(XTRA_LDFLAGS)
+libgd_la_SOURCES = gd.c gdfx.c gd_security.c gd_gd.c gd_gd2.c gd_io.c gd_io_dp.c gd_gif_in.c gd_gif_out.c gd_io_file.c gd_io_ss.c gd_jpeg.c gd_png.c gd_ss.c gd_topal.c gd_wbmp.c gdcache.c gdft.c gdhelpers.c gdhelpers.h gdtables.c gdxpm.c jisx0208.h wbmp.c wbmp.h

-libgd_la_LIBADD = $(LTLIBICONV)
+libgd_la_LDFLAGS = -version-info 2:0:0 $(XTRA_LDFLAGS)

-LDADD = ./libgd.la $(LIBICONV)
+LDADD = ./libgd.la

dist-zip: distdir
zip -qr $(distdir).zip $(distdir)
--- configure.ac.org 2009-03-17 16:42:29.526062500 +0100
+++ configure.ac 2009-03-18 16:44:50.994075200 +0100
@@ -61,19 +61,6 @@
AC_HEADER_STDC
AC_CHECK_HEADERS([errno.h limits.h stddef.h stdlib.h string.h unistd.h])

-AM_ICONV
-# if test -n "$LIBICONV" ; then
-# LIBS="$LIBS $LIBICONV"
-# fi
-
-AC_CHECK_HEADERS(iconv.h,
- [AC_MSG_CHECKING(whether iconv.h defines iconv_t)
- AC_EGREP_HEADER([typedef.*iconv_t],iconv.h,
- [AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_ICONV_T_DEF, 1,
- [Define if defines iconv_t.])],
- AC_MSG_RESULT(no))])
-
# Checks for typedefs, structures, and compiler characteristics.
#AC_C_CONST
#AC_TYPE_SIZE_T
@@ -524,10 +511,9 @@

if test "$withval" != no; then
AC_CHECK_LIB(Xpm,XpmReadFileToXpmImage,
- [LIBS="-lXpm -lX11 $LIBS"
+ [LIBS="-lXpm $LIBS"
FEATURES="GD_XPM $FEATURES"
- AC_DEFINE(HAVE_LIBXPM, 1, [ Define if you have the Xpm library. ])],,
- [-lX11])
+ AC_DEFINE(HAVE_LIBXPM, 1, [ Define if you have the Xpm library. ])])
else
ac_cv_lib_Xpm_XpmReadFileToXpmImage=no
fi
--- config/gdlib-config.in.org 2009-03-19 16:12:36.221283200 +0100
+++ config/gdlib-config.in 2009-03-19 16:12:06.709311200 +0100
@@ -71,7 +71,7 @@
echo @LDFLAGS@
;;
--libs)
- echo @LIBS@ @LIBICONV@
+ echo @LIBS@
;;
--cflags|--includes)
echo -I@includedir@
@@ -84,7 +84,7 @@
echo "includedir: $includedir"
echo "cflags: -I@includedir@"
echo "ldflags: @LDFLAGS@"
- echo "libs: @LIBS@ @LIBICONV@"
+ echo "libs: @LIBS@"
echo "libdir: $libdir"
echo "features: @FEATURES@"
;;
--- gdft.c.org 2009-03-20 10:08:09.643623800 +0100
+++ gdft.c 2009-03-20 10:07:19.824264500 +0100
@@ -1081,26 +1081,7 @@
return "No character set found";
}

-#ifndef JISX0208
- if (encoding == gdFTEX_Shift_JIS)
- {
-#endif
- if ((tmpstr = (char *) gdMalloc (BUFSIZ)))
- {
- any2eucjp (tmpstr, string, BUFSIZ);
- next = tmpstr;
- }
- else
- {
next = string;
- }
-#ifndef JISX0208
- }
- else
- {
- next = string;
- }
-#endif

#if 0
fprintf(stderr,"dpi=%d,%d metric_res=%d ptsize=%g\n",hdpi,vdpi,METRIC_RES,ptsize);
--- gddemo.c.org 2009-03-20 10:36:35.767539000 +0100
+++ gddemo.c 2009-03-20 10:38:27.198319800 +0100
@@ -38,7 +38,9 @@
int i;

/* gd fonts for font test */
+#ifdef CONFIG_FIXFONT
gdFontPtr fonts[5];
+#endif
int y;

/* Create output image, in true color. */
@@ -136,6 +138,7 @@
/* Draw the styled, brushed line */
gdImageLine (im_out, 0, 255, 255, 0, gdStyledBrushed);
}
+#ifdef CONFIG_FIXFONT
/* Text (non-truetype; see gdtestft for a freetype demo) */
fonts[0] = gdFontGetTiny ();
fonts[1] = gdFontGetSmall ();
@@ -156,6 +159,7 @@
(unsigned char *) "hi", red);
y += fonts[i]->h;
}
+#endif
/* Random antialiased lines; coordinates all over the image,
but the output will respect a small clipping rectangle */
gdImageSetClip (im_out, 0, gdImageSY (im_out) - 100,


Los comandos para configurar y compilar quedan así:
LC_ALL=C autoreconf -i
CC=gcc-4 TMPDIR=/tmp CFLAGS="-march=core2 -DXPM_NO_X" ./configure --x-includes=/usr/include/noX --x-libraries=/usr/lib/noX --with-xpm --without-x --without-fontconfig
LC_ALL=C TMPDIR=/tmp make