add build script
This commit is contained in:
parent
3809cab959
commit
ca52c5986e
2
Makefile
2
Makefile
|
@ -33,7 +33,7 @@ clean:
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p spmenu-$(VERSION)
|
mkdir -p spmenu-$(VERSION)
|
||||||
cp -rf LICENSE Makefile *.h *.mk *.c scripts/ docs/ libs/ PKGBUILD spmenu-$(VERSION)
|
cp -rf LICENSE Makefile *.h *.mk *.c scripts/ docs/ libs/ PKGBUILD build.sh spmenu-$(VERSION)
|
||||||
[ -f spmenu.1 ] && cp spmenu.1 spmenu-$(VERSION) || :
|
[ -f spmenu.1 ] && cp spmenu.1 spmenu-$(VERSION) || :
|
||||||
tar -cf spmenu-$(VERSION).tar spmenu-$(VERSION)
|
tar -cf spmenu-$(VERSION).tar spmenu-$(VERSION)
|
||||||
gzip spmenu-$(VERSION).tar
|
gzip spmenu-$(VERSION).tar
|
||||||
|
|
134
build.sh
Executable file
134
build.sh
Executable file
|
@ -0,0 +1,134 @@
|
||||||
|
#!/bin/bash
|
||||||
|
[ -z "$CC" ] && CC=gcc
|
||||||
|
[ -z "$PREFIX" ] && PREFIX="/usr"
|
||||||
|
[ -z "$INCDIR" ] && INCDIR="/usr/include"
|
||||||
|
[ -z "$OPT" ] && OPT="-O2"
|
||||||
|
|
||||||
|
check_dist() {
|
||||||
|
[ -f "/etc/pacman.conf" ] && printf "hint: detected Pacman. if you want you can run 'makepkg' with proper arguments to install it using pacman.\n" && pacman=true
|
||||||
|
[ -f "/System/Library/CoreServices/SystemVersion.plist" ] && printf "hint: detected a Mac. Please report any issues you find as it is untested.\n" && mac=true
|
||||||
|
uname -a | grep -q OpenBSD && printf "hint: detected OpenBSD. Please report any issues you find as it is untested.\n" && openbsd=true
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
[ ! -x "$(command -v ldconfig)" ] && printf "ldconfig not found in %s. Please make sure your system is set up properly." "\$PATH" && exit 1
|
||||||
|
[ ! -x "$(command -v make)" ] && printf "make not found in %s. Please make sure your system is set up properly." "\$PATH" && exit 1
|
||||||
|
[ ! -x "$(command -v $CC)" ] && printf "%s not found in %s. Please make sure your system is set up properly." "$CC" "\$PATH"
|
||||||
|
[ -n "$(ldconfig -p | grep Imlib2)" ] && printf "Imlib2 found\n" && imlib2=true || imlib2=false
|
||||||
|
[ -n "$(ldconfig -p | grep libXft)" ] && printf "libXft found\n" && xft=true || xft=false
|
||||||
|
[ -n "$(ldconfig -p | grep libX11)" ] && printf "libX11 found\n" && x11=true || x11=false
|
||||||
|
[ -n "$(ldconfig -p | grep libXrender)" ] && printf "libXrender found\n" && xrender=true || xrender=false
|
||||||
|
[ -n "$(ldconfig -p | grep libpango)" ] && printf "libpango found\n" && pango=true || pango=false
|
||||||
|
[ -n "$(ldconfig -p | grep libpangoxft)" ] && printf "libpangoxft found\n" && pangoxft=true || pangoxft=false
|
||||||
|
[ -n "$(ldconfig -p | grep libxcb-xinerama)" ] && printf "libxcb-xinerama found\n" && xinerama=true || xinerama=false
|
||||||
|
[ -n "$(ldconfig -p | grep libgnutls-openssl)" ] && printf "openssl found\n" && openssl=true || openssl=false
|
||||||
|
[ -n "$(ldconfig -p | grep fribidi)" ] && printf "fribidi found\n" && fribidi=true || fribidi=false
|
||||||
|
[ -n "$(ldconfig -p | grep freetype)" ] && printf "freetype found\n" && freetype=true || freetype=false
|
||||||
|
}
|
||||||
|
|
||||||
|
loadconf() {
|
||||||
|
[ -x "buildconf" ] && source buildconf
|
||||||
|
|
||||||
|
# mandatory deps
|
||||||
|
[ "$freetype" = "false" ] && printf "Freetype not found. Install it.\n" && exit 1
|
||||||
|
[ "$openssl" = "false" ] && printf "OpenSSL not found. Install it.\n" && exit 1
|
||||||
|
[ "$xrender" = "false" ] && printf "libXrender not found. Install it.\n" && exit 1
|
||||||
|
[ "$x11" = "false" ] && printf "libX11 not found. Install it.\n" && exit 1
|
||||||
|
[ "$xft" = "false" ] && printf "libXft not found. Install it.\n" && exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
build() {
|
||||||
|
# to be overriden
|
||||||
|
FREETYPEINC="$INCDIR/freetype2"
|
||||||
|
X11INC="/usr/X11R6/include"
|
||||||
|
X11LIB="/usr/X11R6/lib"
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
if [ "$mac" = "true" ]; then
|
||||||
|
INCDIR="/usr/local/include"
|
||||||
|
FREETYPEINC="$INCDIR/freetype2"
|
||||||
|
X11INC="/opt/X11/include"
|
||||||
|
X11LIB="/opt/X11/lib"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# openbsd
|
||||||
|
if [ "$openbsd" = "true" ]; then
|
||||||
|
INCDIR="$X11INC"
|
||||||
|
FREETYPEINC="$INCDIR/freetype2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# xinerama
|
||||||
|
if [ "$xinerama" = "true" ]; then
|
||||||
|
xineramalib="-lXinerama"
|
||||||
|
xineramatoggle="-DXINERAMA"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# imlib2
|
||||||
|
if [ "$imlib2" = "true" ]; then
|
||||||
|
imlib2libs="-lImlib2"
|
||||||
|
imlib2toggle="-DIMAGE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# pango
|
||||||
|
if [ "$pango" = "true" ] && [ "$pangoxft" = "true" ]; then
|
||||||
|
pangoconf="pango"
|
||||||
|
pangoxftconf="pangoxft"
|
||||||
|
pangotoggle="-DPANGO"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# fribidi
|
||||||
|
if [ "$fribidi" = "true" ]; then
|
||||||
|
bdlibs="-lfribidi"
|
||||||
|
bdinc="$INCDIR/fribidi"
|
||||||
|
bdtoggle="-DRTL"
|
||||||
|
fi
|
||||||
|
|
||||||
|
make clean
|
||||||
|
[ "$GEN_MANUAL" != "false" ] && make man
|
||||||
|
make \
|
||||||
|
CC="$CC" \
|
||||||
|
PREFIX="$PREFIX" \
|
||||||
|
OPT="$OPT" \
|
||||||
|
INCDIR="$INCDIR" \
|
||||||
|
XINERAMALIBS="$xineramalib" \
|
||||||
|
XINERAMATOGGLE="$xineramatoggle" \
|
||||||
|
IMLIB2LIBS="$imlib2libs" \
|
||||||
|
IMLIB2TOGGLE="$imlib2toggle" \
|
||||||
|
PANGOCONF="$pangoconf" \
|
||||||
|
PANGOXFTCONF="$pangoxftconf" \
|
||||||
|
PANGOTOGGLE="$pangotoggle" \
|
||||||
|
BDLIBS="$bdlibs" \
|
||||||
|
BDINC="$bdinc" \
|
||||||
|
BDTOGGLE="$bdtoggle" \
|
||||||
|
FREETYPEINC="$freetypeinc" \
|
||||||
|
X11LIB="$X11LIB" \
|
||||||
|
X11INC="$X11INC"
|
||||||
|
}
|
||||||
|
|
||||||
|
install() {
|
||||||
|
[ "$(id -u)" != "0" ] && printf "You must run this as root in order to install.\n" && exit 1
|
||||||
|
make install \
|
||||||
|
CC="$CC" \
|
||||||
|
PREFIX="$PREFIX" \
|
||||||
|
OPT="$OPT" \
|
||||||
|
INCDIR="$INCDIR" \
|
||||||
|
XINERAMALIBS="$xineramalib" \
|
||||||
|
XINERAMATOGGLE="$xineramatoggle" \
|
||||||
|
IMLIB2LIBS="$imlib2libs" \
|
||||||
|
IMLIB2TOGGLE="$imlib2toggle" \
|
||||||
|
PANGOCONF="$pangoconf" \
|
||||||
|
PANGOXFTCONF="$pangoxftconf" \
|
||||||
|
PANGOTOGGLE="$pangotoggle" \
|
||||||
|
BDLIBS="$bdlibs" \
|
||||||
|
BDINC="$bdinc" \
|
||||||
|
BDTOGGLE="$bdtoggle" \
|
||||||
|
FREETYPEINC="$freetypeinc" \
|
||||||
|
X11LIB="$X11LIB" \
|
||||||
|
X11INC="$X11INC"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_dist
|
||||||
|
check
|
||||||
|
loadconf
|
||||||
|
build
|
||||||
|
[ "$INSTALL" != "false" ] && install
|
9
host.mk
9
host.mk
|
@ -10,6 +10,7 @@ OPT = -O2
|
||||||
# paths
|
# paths
|
||||||
PREFIX = /usr
|
PREFIX = /usr
|
||||||
MANPREFIX = ${PREFIX}/share/man
|
MANPREFIX = ${PREFIX}/share/man
|
||||||
|
INCDIR = /usr/include
|
||||||
|
|
||||||
# library paths
|
# library paths
|
||||||
#
|
#
|
||||||
|
@ -20,7 +21,7 @@ X11LIB = /usr/X11R6/lib
|
||||||
|
|
||||||
# freetype
|
# freetype
|
||||||
FREETYPELIBS = -lfontconfig -lXft
|
FREETYPELIBS = -lfontconfig -lXft
|
||||||
FREETYPEINC = /usr/include/freetype2
|
FREETYPEINC = $(INCDIR)/freetype2
|
||||||
|
|
||||||
# xft
|
# xft
|
||||||
XFTCONF = xft
|
XFTCONF = xft
|
||||||
|
@ -35,10 +36,12 @@ IMLIB2LIBS = -lImlib2
|
||||||
OPENSSLCONF = openssl
|
OPENSSLCONF = openssl
|
||||||
|
|
||||||
# OpenBSD (uncomment)
|
# OpenBSD (uncomment)
|
||||||
#FREETYPEINC = $(X11INC)/freetype2
|
#INCDIR = $(X11INC)
|
||||||
|
#FREETYPEINC = $(INCDIR)/freetype2
|
||||||
|
|
||||||
# macOS with XQuartz (uncomment)
|
# macOS with XQuartz (uncomment)
|
||||||
#FREETYPEINC = /usr/local/include/freetype2
|
#INCDIR = /usr/local/include
|
||||||
|
#FREETYPEINC = $(INCDIR)/freetype2
|
||||||
#X11INC = /opt/X11/include
|
#X11INC = /opt/X11/include
|
||||||
#X11LIB = /opt/X11/lib
|
#X11LIB = /opt/X11/lib
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ XINERAMATOGGLE = -DXINERAMA
|
||||||
# Right to left language support
|
# Right to left language support
|
||||||
# Comment these lines if you don't need it.
|
# Comment these lines if you don't need it.
|
||||||
BDLIBS = -lfribidi
|
BDLIBS = -lfribidi
|
||||||
BDINC = /usr/include/fribidi
|
BDINC = $(INCDIR)/fribidi
|
||||||
BDTOGGLE = -DRTL
|
BDTOGGLE = -DRTL
|
||||||
|
|
||||||
# Pango
|
# Pango
|
||||||
|
|
Loading…
Reference in a new issue