Skip to content

Commit

Permalink
tinyx: build.sh cleanup
Browse files Browse the repository at this point in the history
JIRA: RTOS-861
  • Loading branch information
adamgreloch committed Aug 30, 2024
1 parent 7cd0c06 commit 5cfc088
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 242 deletions.
159 changes: 34 additions & 125 deletions tinyx/build.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#!/usr/bin/env bash

# TODO: there's loads of redundancy here. This is intentional for now, as
# I don't know yet how custom some of these builds will be
# Some notes:
# - x libs are mostly built the same way
# - suckless stuff has the same build process
# - xmessage and ico build process is mostly the same, except the rough makefile regex in xmessage

set -e

PREFIX_SHARE="${PREFIX_A}/share/"
Expand Down Expand Up @@ -98,6 +91,7 @@ mark_as_configured() {
md5_checksum "${patch_dir}" > "${built_md5_path}"
}


_build_xorgproto() {
b_log "tinyx: building xorgproto"

Expand Down Expand Up @@ -233,35 +227,6 @@ build_tinyx() {
}


# building ico requires gettext
build_ico() {
b_log "tinyx: building ico"

version="1.0.4"
archive_filename="ico-${version}.tar.gz"
PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/ico/${version}"

b_port_download "https://www.x.org/archive/individual/app/" "${archive_filename}"

if should_reconfigure "ico/${version}"; then
extract_sources

b_port_apply_patches "${PREFIX_PORT_SRC}" "ico/${version}"

if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then
exec_configure
fi
mark_as_configured "ico/${version}"
fi

make -C "${PREFIX_PORT_SRC}"

$STRIP -o "${PREFIX_PROG_STRIPPED}/ico" "${PREFIX_PORT_SRC}/ico"

b_install "${PREFIX_PORTS_INSTALL}/ico" /bin
}


build_x11_app() {
appname="$1"
version="$2"
Expand All @@ -285,84 +250,24 @@ build_x11_app() {
fi

# FIXME: this is brutal, see build_tinyx note
find . -name 'Makefile' -print0 | xargs -0 sed -i 's/ -lXaw7/ -l:libXaw.a/g;s/ -lXt/ -l:libXt.a/g;s/ -lX11/ -l:libXmu.a -l:libXext.a -l:libSM.a -l:libICE.a -l:libXdmcp.a -l:libXpm.a -l:libX11.a/g'
find . -name 'Makefile' -print0 | xargs -0 sed -i 's/ -lXmuu/ -l:libXmuu.a -l:libXcursor.a -l:libXrender.a/g;s/ -lXcursor//g'

mark_as_configured "${appname}/${version}"
fi

make -C "${PREFIX_PORT_SRC}"

$STRIP -o "${PREFIX_PROG_STRIPPED}/${appname}" "${PREFIX_PORT_SRC}/${appname}"

b_install "${PREFIX_PORTS_INSTALL}/${appname}" /bin
}


build_xedit() {
b_log "tinyx: building xedit"

version="1.2.4"
archive_filename="xedit-${version}.tar.gz"
PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/xedit/${version}"

b_port_download "https://www.x.org/archive/individual/app/" "${archive_filename}"

if should_reconfigure "xedit/${version}"; then
extract_sources
sedexpr='s/ -lXaw7/ -l:libXaw.a/g;s/ -lXt/ -l:libXt.a/g;'
sedexpr+='s/ -lX11/ -l:libXmu.a -l:libXext.a -l:libSM.a -l:libICE.a -l:libXdmcp.a -l:libXpm.a -l:libX11.a/g;'
sedexpr+='s/ -lXmuu/ -l:libXmuu.a -l:libXcursor.a -l:libXrender.a/g;s/ -lXcursor//g'

b_port_apply_patches "${PREFIX_PORT_SRC}" "xedit/${version}"
find . -name 'Makefile' -print0 | xargs -0 sed -i "${sedexpr}"

if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then
# exec_configure --with-lispdir="${PREFIX_A}/xedit/lsp" --with-appdefaultdir="$TMP_DIR" --bindir="$TMP_DIR"
exec_configure --with-lispdir="/etc/X11/xedit/lsp" --with-appdefaultdir="/etc/X11/app-defaults" --bindir="$TMP_DIR"
fi

# # FIXME: this is brutal, see build_tinyx note
find . -name 'Makefile' -print0 | xargs -0 sed -i 's/ -lXaw7/ -l:libXaw.a/g;s/ -lXt/ -l:libXt.a/g;s/ -lX11/ -l:libXmu.a -l:libXext.a -l:libSM.a -l:libICE.a -l:libXdmcp.a -l:libXpm.a -l:libX11.a/g'

mark_as_configured "xedit/${version}"
mark_as_configured "${appname}/${version}"
fi

make -C "${PREFIX_PORT_SRC}"
# make -C "${PREFIX_PORT_SRC}" install_sh="" install

$STRIP -o "${PREFIX_PROG_STRIPPED}/xedit" "${PREFIX_PORT_SRC}/xedit"

# TODO: install app-defaults

b_install "${PREFIX_PORTS_INSTALL}/xedit" /bin
}

# requires yacc
build_twm() {
b_log "tinyx: building twm"

version="1.0.12"
archive_filename="twm-${version}.tar.gz"
PREFIX_PORT_SRC="${PREFIX_PORT_BUILD}/twm/${version}"

b_port_download "https://www.x.org/archive/individual/app/" "${archive_filename}"

if should_reconfigure "twm/${version}"; then
extract_sources

b_port_apply_patches "${PREFIX_PORT_SRC}" "twm/${version}"

if [ ! -f "${PREFIX_PORT_SRC}/config.status" ]; then
exec_configure
fi

find . -name 'Makefile' -print0 | xargs -0 sed -i 's/ -lXaw7/ -l:libXaw.a/g;s/ -lXt/ -l:libXt.a/g;s/ -lX11/ -l:libXmu.a -l:libXext.a -l:libSM.a -l:libICE.a -l:libXdmcp.a -l:libXpm.a -l:libX11.a/g'

mark_as_configured "twm/${version}"
binpath="${PREFIX_PORT_SRC}/${appname}"
if [ ! -f "${binpath}" ]; then
binpath="${PREFIX_PORT_SRC}/src/${appname}"
fi
$STRIP -o "${PREFIX_PROG_STRIPPED}/${appname}" "${binpath}"

make -C "${PREFIX_PORT_SRC}"

$STRIP -o "${PREFIX_PROG_STRIPPED}/twm" "${PREFIX_PORT_SRC}/src/twm"

b_install "${PREFIX_PORTS_INSTALL}/twm" /bin
b_install "${PREFIX_PORTS_INSTALL}/${appname}" /bin
}


Expand Down Expand Up @@ -416,28 +321,32 @@ build_micropolis() {
}


# Call ordering is important here
build_tinyxlib
build_a_lib libfontenc 1.1.8
# Build xlib and xserver (call ordering is important here)

# libXfont depends on libfontenc and headers from xorgproto/tinyxlib
build_a_lib libXfont 1.5.4 --disable-freetype
build_tinyxlib
build_a_lib libfontenc 1.1.8
build_a_lib libXfont 1.5.4 --disable-freetype # libXfont depends on libfontenc and headers from xorgproto/tinyxlib

build_tinyx

build_ico
build_suckless st 0.2
build_suckless dwm 5.1
build_x11_app xmessage 1.0.7
build_x11_app xclock 1.1.1 --without-xft --without-xkb
build_x11_app xeyes 1.1.1 --without-xrender
build_xedit
build_twm
build_x11_app xsetroot 1.1.1
# build_x11_app xcalc 1.1.2 # doesn't seem to render correctly, but compiles
build_x11_app xinit 1.3.3
build_x11_app xrdb 1.2.2
build_x11_app xgc 1.0.6
# build_micropolis
# Build window managers

build_suckless dwm 5.1
build_x11_app twm 1.0.12 # requires yacc

# Build client apps

build_suckless st 0.2
build_x11_app ico 1.0.4 # requires gettext
build_x11_app xmessage 1.0.7
build_x11_app xclock 1.1.1 --without-xft --without-xkb
build_x11_app xeyes 1.1.1 --without-xrender
build_x11_app xsetroot 1.1.1
build_x11_app xinit 1.3.3
build_x11_app xrdb 1.2.2
build_x11_app xgc 1.0.6

# build_micropolis # doesn't render correctly
# build_x11_app xcalc 1.1.2 # doesn't seem to render correctly, but compiles

rm -rf "$TMP_DIR"
21 changes: 0 additions & 21 deletions tinyx/patches/dwm/5.1/01-Makefile.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
diff -ruN a/config.h b/config.h
--- a/config.h 2024-08-09 12:42:00.109791945 +0200
+++ b/config.h 2024-08-09 12:41:44.723456850 +0200
@@ -46,12 +46,14 @@

/* commands */
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
-static const char *termcmd[] = { "uxterm", NULL };
+static const char *termcmd[] = { "xmessage", "can we have --terminal emulator--?\nwe have --terminal emulator-- at home\n--terminal emulator-- at home:\n\n(psh) %", NULL };
+static const char *icocmd[] = { "ico", "-display", ":0", "-sleep", "50", NULL };

static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY|ShiftMask, XK_i, spawn, {.v = icocmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
diff -ruN a/config.mk b/config.mk
--- a/config.mk 2024-08-09 12:42:00.109791945 +0200
+++ b/config.mk 2024-08-09 12:41:44.723456850 +0200
Expand Down Expand Up @@ -56,5 +37,3 @@ diff -ruN a/config.mk b/config.mk
# compiler and linker
-CC = cc
+CC ?= cc
Binary files a/dwm and b/dwm differ
Binary files a/dwm.o and b/dwm.o differ
96 changes: 0 additions & 96 deletions tinyx/patches/xedit/1.2.4/01-xedit.patch

This file was deleted.

0 comments on commit 5cfc088

Please sign in to comment.