Browse Source

Fix build script to properly handle DESTDIR and PREFIX options.

sisyphus
Dustin Falgout 8 years ago
parent
commit
f9706cb3b9
  1. 35
      Makefile
  2. 31
      build/utils.sh
  3. 4
      web-greeter/whither.yml

35
Makefile

@ -3,6 +3,7 @@
DO := ./build/utils.sh
SET_CONFIG := $(DO) set-config
DESTDIR ?= /
PREFIX ?= /usr
MAYBE_SUDO_DO := $(DO)
define colorecho
@ -11,11 +12,6 @@ define colorecho
@tput sgr0 || true
endef
ifeq ($(MAKECMDGOALS),build_dev)
debug_mode := True
decorated := True
stays_on_top := False
endif
ifeq ($(DESTDIR),/)
MAYBE_SUDO_DO := sudo $(DO)
@ -24,18 +20,25 @@ endif
# Configuration: Use values from command line if provided, default values otherwise.
at_spi_service ?= True
background_images_dir ?= $(abspath $(DESTDIR)/usr/share/backgrounds)
config_dir ?= $(abspath $(DESTDIR)/etc/lightdm)
debug_mode ?= False
decorated ?= False
greeters_dir ?= $(abspath $(DESTDIR)/usr/share/xgreeters)
locale_dir ?= $(abspath $(DESTDIR)/usr/share/locale)
themes_dir ?= $(abspath $(DESTDIR)/usr/share/web-greeter/themes)
background_images_dir ?= $(abspath $(PREFIX)/share/backgrounds)
config_dir ?= $(abspath /etc/lightdm)
debug_mode := False
decorated := False
greeters_dir ?= $(abspath $(PREFIX)/share/xgreeters)
locale_dir ?= $(abspath $(PREFIX)/share/locale)
themes_dir ?= $(abspath $(PREFIX)/share/web-greeter/themes)
logo_image ?= $(themes_dir)/default/img/antergos-logo-user.png
stays_on_top ?= True
stays_on_top := True
user_image ?= $(themes_dir)/default/img/antergos.png
ifeq ($(MAKECMDGOALS),build_dev)
debug_mode := True
decorated := True
stays_on_top := False
endif
_apply_config:
@$(SET_CONFIG) at_spi_service $(at_spi_service)
@$(SET_CONFIG) background_images_dir $(background_images_dir)
@ -55,7 +58,7 @@ _build_init: clean
all: install
build: _build_init _apply_config
$(DO) build
$(DO) build $(PREFIX)
build_dev: install
$(MAYBE_SUDO_DO) install-dev
@ -64,8 +67,8 @@ clean:
$(DO) clean
install: build
./build/utils.sh prepare-install
$(MAYBE_SUDO_DO) install $(DESTDIR)
./build/utils.sh prepare-install $(PREFIX)
$(MAYBE_SUDO_DO) install $(DESTDIR) $(PREFIX)
$(call colorecho, SUCCESS!)

31
build/utils.sh

@ -5,6 +5,7 @@ REPO_DIR="$(dirname "${BUILD_DIR}")"
INSTALL_ROOT="${BUILD_DIR}/install_root"
PKGNAME='web-greeter'
DESTDIR=''
PREFIX=''
_handle_error() {
@ -38,10 +39,10 @@ do_build() {
&& mv greeter.py __main__.py \
&& zip -rq ../"${PKGNAME}.zip" . -x '**__pycache__**' 'resources/*' \
&& cd - >/dev/null \
&& mkdir -p "${INSTALL_ROOT}"/usr/{bin,share} \
&& echo '#!/bin/python3' >> "${INSTALL_ROOT}/usr/bin/web-greeter" \
&& cat web-greeter.zip >> "${INSTALL_ROOT}/usr/bin/web-greeter" \
&& chmod +x "${INSTALL_ROOT}/usr/bin/web-greeter")
&& mkdir -p "${INSTALL_ROOT}${PREFIX}"/{bin,share} \
&& echo '#!/bin/python3' >> "${INSTALL_ROOT}${PREFIX}/bin/web-greeter" \
&& cat web-greeter.zip >> "${INSTALL_ROOT}${PREFIX}/bin/web-greeter" \
&& chmod +x "${INSTALL_ROOT}${PREFIX}/bin/web-greeter")
}
do_install() {
@ -53,13 +54,6 @@ do_install_dev() {
cp -RH "${REPO_DIR}/whither/whither" /usr/lib/python3.6/site-packages/
}
do_success() {
NO_COLOR=\x1b[0m
SUCCESS_COLOR=\x1b[32;01m
SUCCESS="${SUCCESS_COLOR}[SUCCESS!]${NO_COLOR}"
echo "${SUCCESS}"
}
generate_pot_file() {
REPO_ROOT="$(dirname "${REPO_DIR}")"
xgettext --from-code UTF-8 -o "${REPO_ROOT}/po/lightdm-webkit2-greeter.pot" -d lightdm-webkit2-greeter "${REPO_ROOT}"/src/*.c
@ -74,25 +68,25 @@ init_build_dir() {
prepare_install() {
cd "${BUILD_DIR}"
mkdir -p \
"${INSTALL_ROOT}"/usr/share/{man/man1,metainfo,web-greeter,xgreeters} \
"${INSTALL_ROOT}${PREFIX}"/share/{man/man1,metainfo,web-greeter,xgreeters} \
"${INSTALL_ROOT}/etc/lightdm"
# Themes
(cp -R "${REPO_DIR}/themes" "${INSTALL_ROOT}/usr/share/web-greeter" \
&& cd "${INSTALL_ROOT}/usr/share/web-greeter" \
(cp -R "${REPO_DIR}/themes" "${INSTALL_ROOT}${PREFIX}/share/web-greeter" \
&& cd "${INSTALL_ROOT}${PREFIX}/share/web-greeter" \
&& mv themes/_vendor .)
# Man Page
cp "${BUILD_DIR}/dist/${PKGNAME}.1" "${INSTALL_ROOT}/usr/share/man/man1"
cp "${BUILD_DIR}/dist/${PKGNAME}.1" "${INSTALL_ROOT}${PREFIX}/share/man/man1"
# Greeter Config
cp "${BUILD_DIR}/dist/${PKGNAME}.yml" "${INSTALL_ROOT}/etc/lightdm"
# AppData File
cp "${BUILD_DIR}/dist/com.antergos.${PKGNAME}.appdata.xml" "${INSTALL_ROOT}/usr/share/metainfo"
cp "${BUILD_DIR}/dist/com.antergos.${PKGNAME}.appdata.xml" "${INSTALL_ROOT}${PREFIX}/share/metainfo"
# Desktop File
cp "${BUILD_DIR}/dist/com.antergos.${PKGNAME}.desktop" "${INSTALL_ROOT}/usr/share/xgreeters"
cp "${BUILD_DIR}/dist/com.antergos.${PKGNAME}.desktop" "${INSTALL_ROOT}${PREFIX}/share/xgreeters"
}
set_config() {
@ -119,6 +113,7 @@ case "$1" in
;;
build)
PREFIX="$2"
do_build
;;
@ -132,6 +127,7 @@ case "$1" in
install)
DESTDIR="$2"
PREFIX="$3"
do_install
clean_build_dir
;;
@ -141,6 +137,7 @@ case "$1" in
;;
prepare-install)
PREFIX="$2"
prepare_install
;;

4
web-greeter/whither.yml

@ -41,9 +41,9 @@ WebGreeter:
locale_dir: '@locale_dir@'
themes_dir: '@themes_dir@'
version:
full: '3.0.0alpha4'
full: '3.0.0alpha5'
major: 3
minor: 0
micro: 0
alpha: 4
alpha: 5
beta: False

Loading…
Cancel
Save