diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2023-08-03 14:17:54 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2023-08-03 14:17:54 +0200 |
commit | 71a83bc212da6a1d8322a640503e35e1060373a0 (patch) | |
tree | d7afb8f4b9f721391ef57b697ec4915908844aa5 | |
parent | 8cada4e1eda626fb81b3f3b7fd728b40f69c4bec (diff) | |
download | i486tcc-linux-71a83bc212da6a1d8322a640503e35e1060373a0.tar.gz i486tcc-linux-71a83bc212da6a1d8322a640503e35e1060373a0.tar.bz2 |
added the meh image viewer (without external library dependencies)
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | configs/versions | 1 | ||||
-rw-r--r-- | patches/meh-tcc.patch | 110 | ||||
-rwxr-xr-x | scripts/build.sh | 15 | ||||
-rwxr-xr-x | scripts/download.sh | 7 |
5 files changed, 136 insertions, 1 deletions
@@ -513,7 +513,9 @@ Call Trace: - can we do a crunch binary for X apps, they get 400k when linked statically with X libraries1 - depth 16 -> 24 on Xfbdev? - +- meh segfaults with the test.qoi image from the meh branch in qemu, works + on the host + tools ----- diff --git a/configs/versions b/configs/versions index 7139308..f48822c 100644 --- a/configs/versions +++ b/configs/versions @@ -28,6 +28,7 @@ FONT_MISC_MISC_VERSION="1.1.3" RXVT_VERSION="2.6.4" XHOST_VERSION="1.0.8" XAUTH_VERSION="1.0.9" +MEH_VERSION="041539e" LUA_VERSION="5.1.5" NOTION_VERSION="435631f" WORDGRINDER_VERSION="0.8" diff --git a/patches/meh-tcc.patch b/patches/meh-tcc.patch new file mode 100644 index 0000000..30448c5 --- /dev/null +++ b/patches/meh-tcc.patch @@ -0,0 +1,110 @@ +diff -rauN meh/Makefile meh-tcc-patch/Makefile +--- meh/Makefile 2023-08-03 13:53:51.000000000 +0200 ++++ meh-tcc-patch/Makefile 2023-08-03 14:01:09.239337827 +0200 +@@ -31,7 +31,7 @@ + -include $(DEPFILES) + + %.o: %.c Makefile +- $(CC) $(CFLAGS) -MMD -MP -MT "$*.d" -c -o $@ $< ++ $(CC) $(CFLAGS) -c -o $@ $< + + install: + install -Dm 755 meh $(DESTDIR)$(BINDIR)/meh +diff -rauN meh/src/gif.c meh-tcc-patch/src/gif.c +--- meh/src/gif.c 2023-08-03 13:53:51.000000000 +0200 ++++ meh-tcc-patch/src/gif.c 2023-08-03 14:03:39.889558784 +0200 +@@ -1,3 +1,4 @@ ++#ifdef HAVE_GIFLIB + + #include <stdio.h> + #include <stdlib.h> +@@ -124,3 +125,4 @@ + gif_close + }; + ++#endif +diff -rauN meh/src/imagemagick.c meh-tcc-patch/src/imagemagick.c +--- meh/src/imagemagick.c 2023-08-03 13:53:51.000000000 +0200 ++++ meh-tcc-patch/src/imagemagick.c 2023-08-03 14:08:50.440014266 +0200 +@@ -1,3 +1,4 @@ ++#ifdef HAVE_IMAGEMAGICK + + #define _GNU_SOURCE + +@@ -69,3 +70,4 @@ + NULL + }; + ++#endif +diff -rauN meh/src/jpeg.c meh-tcc-patch/src/jpeg.c +--- meh/src/jpeg.c 2023-08-03 13:53:51.000000000 +0200 ++++ meh-tcc-patch/src/jpeg.c 2023-08-03 14:04:03.379593237 +0200 +@@ -1,3 +1,4 @@ ++#ifdef HAVE_LIBJPEG + + #include <stdio.h> + #include <stdlib.h> +@@ -162,3 +163,4 @@ + jpeg_close + }; + ++#endif +diff -rauN meh/src/main.c meh-tcc-patch/src/main.c +--- meh/src/main.c 2023-08-03 13:53:51.000000000 +0200 ++++ meh-tcc-patch/src/main.c 2023-08-03 14:09:12.060045975 +0200 +@@ -17,13 +17,21 @@ + + /* Supported Formats */ + static struct imageformat *formats[] = { ++#ifdef HAVE_LIBJPEG + &libjpeg, ++#endif + &bmp, ++#ifdef HAVE_LIBPNG + &libpng, ++#endif + &netpbm, ++#ifdef HAVE_GIFLIB + &giflib, /* HACK! make gif last (uses read()) */ ++#endif + &qoi, ++#ifdef HAVE_IMAGEMAGICK + &imagemagick, ++#endif + NULL + }; + +diff -rauN meh/src/meh.h meh-tcc-patch/src/meh.h +--- meh/src/meh.h 2023-08-03 13:53:51.000000000 +0200 ++++ meh-tcc-patch/src/meh.h 2023-08-03 14:07:02.309855672 +0200 +@@ -66,9 +66,15 @@ + #endif + + /* Supported Formats */ ++#ifdef HAVE_LIBJPEG + extern struct imageformat libjpeg; ++#endif ++#ifdef HAVE_GIFLIB + extern struct imageformat giflib; ++#endif ++#ifdef HAVE_LIBPNG + extern struct imageformat libpng; ++#endif + extern struct imageformat bmp; + extern struct imageformat netpbm; + extern struct imageformat imagemagick; +diff -rauN meh/src/png.c meh-tcc-patch/src/png.c +--- meh/src/png.c 2023-08-03 13:53:51.000000000 +0200 ++++ meh-tcc-patch/src/png.c 2023-08-03 14:04:22.809621735 +0200 +@@ -1,3 +1,5 @@ ++#ifdef HAVE_LIBPNG ++ + #include <stdlib.h> + #include <png.h> + +@@ -127,4 +129,4 @@ + png_close + }; + +- ++#endif diff --git a/scripts/build.sh b/scripts/build.sh index f934722..18e20a0 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -537,6 +537,21 @@ else echo "stage1 xhost exists" fi +if [ ! -f "${BASE}/build/stage1/bin/meh" ]; then + rm -rf "meh-${MEH_VERSION}" + tar xf "${BASE}/downloads/meh-${MEH_VERSION}.tar.gz" + cd "meh-${MEH_VERSION}" + patch -Np1 < "${BASE}/patches/meh-tcc.patch" + make -j$CPUS CC="${BASE}/build/stage1/bin/i386-tcc" \ + CFLAGS="-Os -I${BASE}/build/stage1/include" \ + LDFLAGS="-static" \ + LIBS="${BASE}/build/stage1/lib/libXext.a ${BASE}/build/stage1/lib/libX11.a" + make -j$CPUS DESTDIR="${BASE}/build/stage1" PREFIX="" install + cd .. +else + echo "stage1 meh exists" +fi + if [ ! -f "${BASE}/build/stage1/bin/lua" ]; then rm -rf "lua-${LUA_VERSION}" tar xf "${BASE}/downloads/lua-${LUA_VERSION}.tar.gz" diff --git a/scripts/download.sh b/scripts/download.sh index 49d43ca..e288445 100755 --- a/scripts/download.sh +++ b/scripts/download.sh @@ -158,6 +158,13 @@ if [ ! -f "${BASE}/downloads/xauth-${XAUTH_VERSION}.tar.gz" ]; then "https://www.x.org/archive//individual/app/xauth-${XAUTH_VERSION}.tar.gz" fi +if [ ! -f "${BASE}/downloads/meh-${MEH_VERSION}.tar.gz" ]; then + git clone https://github.com/andreasbaumann/meh.git "meh-${MEH_VERSION}" + git -C "meh-${MEH_VERSION}" checkout "${MEH_VERSION}" + tar zcf "${BASE}/downloads/meh-${MEH_VERSION}.tar.gz" "meh-${MEH_VERSION}" + rm -rf "meh-${MEH_VERSION}" +fi + if [ ! -f "${BASE}/downloads/bdftopcf-${BDFTOPCF_VERSION}.tar.gz" ]; then wget -O "${BASE}/downloads/bdftopcf-${BDFTOPCF_VERSION}.tar.gz" \ "https://www.x.org/archive/individual/app/bdftopcf-${BDFTOPCF_VERSION}.tar.gz" |