Skip to content

Commit

Permalink
cpl: opbox,tigervnc,suckless func-format
Browse files Browse the repository at this point in the history
  • Loading branch information
huapox committed Sep 25, 2024
1 parent e21a6bd commit fc7e77a
Show file tree
Hide file tree
Showing 3 changed files with 540 additions and 562 deletions.
319 changes: 157 additions & 162 deletions compile/src/openbox/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ FONTCONFIG_INS_PREFIX=$TARGETPATH
# brotli-static \


function pango_meson(){
export CC=xx-clang-wrapper
# Copy the xx-clang wrapper. Openbox compilation uses libtool. During the link
# phase, libtool re-orders all arguments from LDFLAGS. Thus, libraries are no
# longer between the -Wl,--start-group and -Wl,--end-group arguments. The
# wrapper detects this scenario and fixes arguments.
\cp -a "$SCRIPT_DIR"/xx-clang-wrapper /usr/bin/
chmod +x /usr/bin/xx-clang-wrapper
function pango_meson(){
export CC=xx-clang-wrapper
\cp -a "$SCRIPT_DIR"/xx-clang-wrapper /usr/bin/
chmod +x /usr/bin/xx-clang-wrapper

# Create the meson cross compile file.
echo "[binaries]
# Create the meson cross compile file.
echo "[binaries]
pkgconfig = '$(xx-info)-pkg-config'
[properties]
Expand All @@ -104,7 +104,6 @@ endian = 'little'
# The static library is not provided by Alpine repository, so we need to build
# it ourself.
#
function pango(){
# # g++ \
# # glib-dev \
# # glib-static \
Expand All @@ -113,28 +112,28 @@ function pango(){
# fribidi-static \
# harfbuzz-dev \
# harfbuzz-static \

pango_meson #call
mkdir -p /tmp/pango
log "Downloading pango..."
# curl -# -L -f ${PANGO_URL} | tar -xJ --strip 1 -C /tmp/pango
down_catfile ${PANGO_URL} | tar -xJ --strip 1 -C /tmp/pango

log "Configuring pango..."
(
cd /tmp/pango && LDFLAGS= abuild-meson \
-Ddefault_library=static \
-Dintrospection=disabled \
-Dgtk_doc=false \
--cross-file /tmp/meson-cross.txt \
build \
)

log "Compiling pango..."
meson compile -C /tmp/pango/build

log "Installing pango..."
DESTDIR=$(xx-info sysroot) meson install --no-rebuild -C /tmp/pango/build
function pango(){
pango_meson #call
mkdir -p /tmp/pango
log "Downloading pango..."
# curl -# -L -f ${PANGO_URL} | tar -xJ --strip 1 -C /tmp/pango
down_catfile ${PANGO_URL} | tar -xJ --strip 1 -C /tmp/pango

log "Configuring pango..."
(
cd /tmp/pango && LDFLAGS= abuild-meson \
-Ddefault_library=static \
-Dintrospection=disabled \
-Dgtk_doc=false \
--cross-file /tmp/meson-cross.txt \
build \
)

log "Compiling pango..."
meson compile -C /tmp/pango/build

log "Installing pango..."
DESTDIR=$(xx-info sysroot) meson install --no-rebuild -C /tmp/pango/build
}

#
Expand All @@ -143,27 +142,27 @@ DESTDIR=$(xx-info sysroot) meson install --no-rebuild -C /tmp/pango/build
# it ourself.
#
function libxrandr(){
mkdir -p /tmp/libxrandr
log "Downloading libXrandr..."
# curl -# -L -f ${LIBXRANDR_URL} | tar -xJ --strip 1 -C /tmp/libxrandr
down_catfile ${LIBXRANDR_URL} | tar -xJ --strip 1 -C /tmp/libxrandr

log "Configuring libXrandr..."
(
cd /tmp/libxrandr && LDFLAGS= ./configure \
--build=$(TARGETPLATFORM= xx-clang --print-target-triple) \
--host=$(xx-clang --print-target-triple) \
--prefix=/usr \
--disable-shared \
--enable-static \
--enable-malloc0returnsnull \
)

log "Compiling libXrandr..."
make -C /tmp/libxrandr -j$(nproc)

log "Installing libXrandr..."
make DESTDIR=$(xx-info sysroot) -C /tmp/libxrandr install
mkdir -p /tmp/libxrandr
log "Downloading libXrandr..."
# curl -# -L -f ${LIBXRANDR_URL} | tar -xJ --strip 1 -C /tmp/libxrandr
down_catfile ${LIBXRANDR_URL} | tar -xJ --strip 1 -C /tmp/libxrandr

log "Configuring libXrandr..."
(
cd /tmp/libxrandr && LDFLAGS= ./configure \
--build=$(TARGETPLATFORM= xx-clang --print-target-triple) \
--host=$(xx-clang --print-target-triple) \
--prefix=/usr \
--disable-shared \
--enable-static \
--enable-malloc0returnsnull \
)

log "Compiling libXrandr..."
make -C /tmp/libxrandr -j$(nproc)

log "Installing libXrandr..."
make DESTDIR=$(xx-info sysroot) -C /tmp/libxrandr install
}

#
Expand All @@ -176,7 +175,6 @@ make DESTDIR=$(xx-info sysroot) -C /tmp/libxrandr install
# dependent. Thus, we won't generate one, but it's not a problem since
# we have very few fonts installed.
#
function fontconfig_drop1(){
# log "Installing required Alpine packages..."
# repeatd<< @builder;
# xx-apk --no-cache add \
Expand All @@ -194,8 +192,6 @@ function fontconfig_drop1(){
# expat-dev expat-static
#
# apk add expat-static


#
# Install Noto fonts.
# Only the fonts used by JWM are installed.
Expand All @@ -215,130 +211,129 @@ function fontconfig_drop1(){
# dependent. Thus, we won't generate one, but it's not a problem since
# we have very few fonts installed.
#
mkdir -p /tmp/fontconfig
log "Downloading fontconfig..."
down_catfile ${FONTCONFIG_URL} | tar -xz --strip 1 -C /tmp/fontconfig

log "Configuring FONTCONFIG..."
(
cd /tmp/fontconfig && ./configure \
--build=$(TARGETPLATFORM= xx-clang --print-target-triple) \
--host=$(xx-clang --print-target-triple) \
--prefix=/usr \
--with-default-fonts=${FONTCONFIG_INS_PREFIX}/share/fonts \
--with-baseconfigdir=${FONTCONFIG_INS_PREFIX}/share/fontconfig \
--with-configdir=${FONTCONFIG_INS_PREFIX}/share/fontconfig/conf.d \
--with-templatedir=${FONTCONFIG_INS_PREFIX}/share/fontconfig/conf.avail \
--with-cache-dir=/config/xdg/cache/fontconfig \
--disable-shared \
--enable-static \
--disable-docs \
--disable-nls \
--disable-cache-build \
)

log "Compiling FONTCONFIG..."
# make -C /tmp/fontconfig -j$(nproc)
# -lfontconfig -lXft -lX11 -lxcb -lXau -lXrender -lXdmcp -lbrotlidec -lbrotlicommon
flags="-static -lfreetype -lpng -lexpat -lxml2 -lz -lbz2"
make LDFLAGS="$flags" -C /tmp/fontconfig -j$(nproc)

# /tmp/fontconfig-install/usr/share/xml/fontconfig
log "Installing FONTCONFIG..."
make DESTDIR=$FONTCONFIG_DEST_DIR -C /tmp/fontconfig install



# log "Installing fontconfig..."
# cp -av /tmp/fontconfig-install/usr $(xx-info sysroot)
function fontconfig_drop1(){
mkdir -p /tmp/fontconfig
log "Downloading fontconfig..."
down_catfile ${FONTCONFIG_URL} | tar -xz --strip 1 -C /tmp/fontconfig

log "Configuring FONTCONFIG..."
(
cd /tmp/fontconfig && ./configure \
--build=$(TARGETPLATFORM= xx-clang --print-target-triple) \
--host=$(xx-clang --print-target-triple) \
--prefix=/usr \
--with-default-fonts=${FONTCONFIG_INS_PREFIX}/share/fonts \
--with-baseconfigdir=${FONTCONFIG_INS_PREFIX}/share/fontconfig \
--with-configdir=${FONTCONFIG_INS_PREFIX}/share/fontconfig/conf.d \
--with-templatedir=${FONTCONFIG_INS_PREFIX}/share/fontconfig/conf.avail \
--with-cache-dir=/config/xdg/cache/fontconfig \
--disable-shared \
--enable-static \
--disable-docs \
--disable-nls \
--disable-cache-build \
)

log "Compiling FONTCONFIG..."
# make -C /tmp/fontconfig -j$(nproc)
# -lfontconfig -lXft -lX11 -lxcb -lXau -lXrender -lXdmcp -lbrotlidec -lbrotlicommon
flags="-static -lfreetype -lpng -lexpat -lxml2 -lz -lbz2"
make LDFLAGS="$flags" -C /tmp/fontconfig -j$(nproc)

# /tmp/fontconfig-install/usr/share/xml/fontconfig
log "Installing FONTCONFIG..."
make DESTDIR=$FONTCONFIG_DEST_DIR -C /tmp/fontconfig install

# log "Installing fontconfig..."
# cp -av /tmp/fontconfig-install/usr $(xx-info sysroot)
}

#
# Build Openbox.
#
function openbox(){
pango_meson #call
env |egrep "FLAGS|clang"
rm -rf /tmp/openbox; mkdir -p /tmp/openbox
log "Downloading Openbox..."
# curl -# -L -f ${OPENBOX_URL} | tar -xJ --strip 1 -C /tmp/openbox
down_catfile ${OPENBOX_URL} | tar -xJ --strip 1 -C /tmp/openbox

log "Patching Openbox..."
patch -p1 -d /tmp/openbox < "$SCRIPT_DIR"/disable-x-locale.patch
patch -p1 -d /tmp/openbox < "$SCRIPT_DIR"/menu-file-order.patch

# The config.sub provided with Openbox is too old. Get a recent one from
# https://github.com/gcc-mirror/gcc/blob/master/config.sub
cp -v "$SCRIPT_DIR"/config.sub /tmp/openbox

log "Configuring Openbox..."
(
#cd /tmp/openbox && LIBS="$LDFLAGS" ./configure \

# deps:
# pango libxrandr fontconfig
#
cd /tmp/openbox && \
OB_LIBS="-lX11 -lxcb -lXdmcp -lXau -lXext -lXft -lXrandr -lfontconfig -lfreetype \
-lpng -lXrender -lexpat -lxml2 -lz -lbz2 -llzma -lbrotlidec -lbrotlicommon \
-lintl -lfribidi -lharfbuzz -lpangoxft-1.0 -lpangoft2-1.0 -lpango-1.0 \
-lgio-2.0 -lgobject-2.0 -lglib-2.0 -lpcre -lgraphite2 -lffi"
# view libs
grep1=$(echo $OB_LIBS |sed "s^ -l^|lib^g" |sed "s^-lX11^libX11^g"); echo "grep1: $grep1"
find /usr/lib |egrep "$grep1" |grep "\.a$" |sort

OB_LIBS="$OB_LIBS -luuid"
# LDFLAGS=
LDFLAGS="$LDFLAGS -Wl,--start-group $OB_LIBS -Wl,--end-group" LIBS="$LDFLAGS" ./configure \
--build=$(TARGETPLATFORM= xx-clang --print-target-triple) \
--host=$(xx-clang --print-target-triple) \
--prefix=$INS_PREFIX \
--datarootdir=$INS_PREFIX/share \
--disable-shared \
--enable-static \
--disable-nls \
--disable-xcursor \
--disable-librsvg \
--disable-startup-notification \
--disable-session-management \
--disable-xkb \
--disable-xinerama
)

log "Compiling Openbox..."
#sed -i 's|--silent|--verbose|' /tmp/openbox/Makefile
make V=1 -C /tmp/openbox -j$(nproc)
# make LDFLAGS="-static" V=1 -C /tmp/openbox -j$(nproc) ##still dyn

#view
ls -lh /tmp/openbox/openbox/openbox
ldd /tmp/openbox/openbox/openbox

log "Installing Openbox..."
make DESTDIR=$ROOT_DEST_DIR -C /tmp/openbox install

# static-verify
# $RUN xx-verify --static \
# $ROOT_DEST_DIR${INS_PREFIX}/bin/openbox \
# $ROOT_DEST_DIR${INS_PREFIX}/bin/obxprop
# $RUN upx $ROOT_DEST_DIR${INS_PREFIX}/bin/openbox
# $RUN upx $ROOT_DEST_DIR${INS_PREFIX}/bin/obxprop
xx-verify --static $ROOT_DEST_DIR${INS_PREFIX}/bin/openbox
pango_meson #call
env |egrep "FLAGS|clang"
rm -rf /tmp/openbox; mkdir -p /tmp/openbox
log "Downloading Openbox..."
# curl -# -L -f ${OPENBOX_URL} | tar -xJ --strip 1 -C /tmp/openbox
down_catfile ${OPENBOX_URL} | tar -xJ --strip 1 -C /tmp/openbox

log "Patching Openbox..."
patch -p1 -d /tmp/openbox < "$SCRIPT_DIR"/disable-x-locale.patch
patch -p1 -d /tmp/openbox < "$SCRIPT_DIR"/menu-file-order.patch

# The config.sub provided with Openbox is too old. Get a recent one from
# https://github.com/gcc-mirror/gcc/blob/master/config.sub
cp -v "$SCRIPT_DIR"/config.sub /tmp/openbox

log "Configuring Openbox..."
(
#cd /tmp/openbox && LIBS="$LDFLAGS" ./configure \

# deps:
# pango libxrandr fontconfig
#
cd /tmp/openbox && \
OB_LIBS="-lX11 -lxcb -lXdmcp -lXau -lXext -lXft -lXrandr -lfontconfig -lfreetype \
-lpng -lXrender -lexpat -lxml2 -lz -lbz2 -llzma -lbrotlidec -lbrotlicommon \
-lintl -lfribidi -lharfbuzz -lpangoxft-1.0 -lpangoft2-1.0 -lpango-1.0 \
-lgio-2.0 -lgobject-2.0 -lglib-2.0 -lpcre -lgraphite2 -lffi"
# view libs
grep1=$(echo $OB_LIBS |sed "s^ -l^|lib^g" |sed "s^-lX11^libX11^g"); echo "grep1: $grep1"
find /usr/lib |egrep "$grep1" |grep "\.a$" |sort

OB_LIBS="$OB_LIBS -luuid"
# LDFLAGS=
LDFLAGS="$LDFLAGS -Wl,--start-group $OB_LIBS -Wl,--end-group" LIBS="$LDFLAGS" ./configure \
--build=$(TARGETPLATFORM= xx-clang --print-target-triple) \
--host=$(xx-clang --print-target-triple) \
--prefix=$INS_PREFIX \
--datarootdir=$INS_PREFIX/share \
--disable-shared \
--enable-static \
--disable-nls \
--disable-xcursor \
--disable-librsvg \
--disable-startup-notification \
--disable-session-management \
--disable-xkb \
--disable-xinerama
)

log "Compiling Openbox..."
#sed -i 's|--silent|--verbose|' /tmp/openbox/Makefile
make V=1 -C /tmp/openbox -j$(nproc)
# make LDFLAGS="-static" V=1 -C /tmp/openbox -j$(nproc) ##still dyn

#view
ls -lh /tmp/openbox/openbox/openbox
ldd /tmp/openbox/openbox/openbox

log "Installing Openbox..."
make DESTDIR=$ROOT_DEST_DIR -C /tmp/openbox install

# static-verify
# $RUN xx-verify --static \
# $ROOT_DEST_DIR${INS_PREFIX}/bin/openbox \
# $ROOT_DEST_DIR${INS_PREFIX}/bin/obxprop
# $RUN upx $ROOT_DEST_DIR${INS_PREFIX}/bin/openbox
# $RUN upx $ROOT_DEST_DIR${INS_PREFIX}/bin/obxprop
xx-verify --static $ROOT_DEST_DIR${INS_PREFIX}/bin/openbox
}

function apkdeps(){ #avoid mutli-build apk lock
# apk add fribidi-dev fribidi-static ##@each
log "Installing required Alpine packages..."
apk --no-cache add \
# apk add fribidi-dev fribidi-static ##@each
log "Installing required Alpine packages..."
apk --no-cache add \
curl \
build-base \
clang \
meson \
pkgconfig \
patch \
glib-dev
xx-apk --no-cache --no-scripts add \
xx-apk --no-cache --no-scripts add \
g++ \
glib-dev \
glib-static \
Expand Down Expand Up @@ -368,7 +363,7 @@ xx-apk --no-cache --no-scripts add \
xz-dev \
brotli-static

apk add expat-static #fontconfig
apk add expat-static #fontconfig
}

case "$1" in
Expand Down
Loading

0 comments on commit fc7e77a

Please sign in to comment.