Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build all binaries with a Makefile #213

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ignore local developer settings
/.vscode/

# ignore temporary build artifacts
_build
*~

# ignore built binaries
/schemas/gschemas.compiled
*.mo
*.zip
104 changes: 104 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Makefile of the Arch Linux Updates Indicator GNOME Shell Extension
# (adapted from https://gitlab.com/skrewball/openweather/)

PKG_NAME = arch-update
UUID = arch-update@RaphaelRochet
BASE_MODULES = metadata.json LICENCE.txt prefs.xml
SRC_MODULES = extension.js prefs.js stylesheet.css
EXTRA_DIRECTORIES = icons
TOLOCALIZE = extension.js prefs.js
MSGSRC = $(wildcard locale/*/arch-update.po)

# Packagers: Use DESTDIR for system wide installation
ifeq ($(strip $(DESTDIR)),)
INSTALLTYPE = local
INSTALLBASE = $(HOME)/.local/share/gnome-shell/extensions
else
INSTALLTYPE = system
SHARE_PREFIX = $(DESTDIR)/usr/share
INSTALLBASE = $(SHARE_PREFIX)/gnome-shell/extensions
endif
# Set a git version for self builds from the latest git tag with the revision
# (a monotonically increasing number that uniquely identifies the source tree)
# and the current short commit SHA1. (Note: not set if VERSION passed)
GIT_VER = $(shell git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')
# The command line passed variable VERSION is used to set the version integer
# in the metadata and in the generated zip file. If no VERSION is passed, we
# won't touch the metadata version and instead use that for the zip file.
ifdef VERSION
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is is supposed to be set on command line ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes a shell variable, try VERSION=99 make zip-file or VERSION=99 make install and restart. The manifest isn't touched.

ZIPVER = -v$(VERSION)
else
ZIPVER = -v$(shell cat metadata.json | sed '/"version"/!d' | sed s/\"version\"://g | sed s/\ //g)
endif

.PHONY: all clean extension potfile mergepo install install-local zip-file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does PHONY mean ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short: these are the target names you can explicit request, longer: I've taken a working file of an extension good looking for me and modified it according your paths.


all: extension

clean:
rm -f ./schemas/gschemas.compiled
rm -f ./locale/*/arch-update.po~
rm -f ./locale/*/LC_MESSAGES/arch-update.mo

extension: ./schemas/gschemas.compiled $(MSGSRC:arch-update.po=LC_MESSAGES/arch-update.mo)

./schemas/gschemas.compiled: ./schemas/org.gnome.shell.extensions.arch-update.gschema.xml
glib-compile-schemas ./schemas/

# TODO: disabled, since xgettext is not able to include prefs.xml to the pot file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use this CLI :
xgettext --from-code=UTF-8 -j -o "$POTFILE" -L glade *.xml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I couldn't reproduce the binaries. What's your msgfmt command line?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use msgfmt "$pofile" -o "$mofile", no checking. In rare cases of something wrong, I let translators come back and fix it.

# We have to update the arch-update.pot manually.
#potfile: ./locale/arch-update.pot

mergepo: potfile
for l in $(MSGSRC); do \
msgmerge -U $$l ./locale/arch-update.pot; \
done;

./locale/arch-update.pot: $(TOLOCALIZE)
mkdir -p locale
xgettext -k_ -kN_ --from-code utf-8 -o locale/arch-update.pot --package-name $(PKG_NAME) $(TOLOCALIZE)

./locale/%/LC_MESSAGES/arch-update.mo: ./locale/%/arch-update.po
msgfmt -c $< -o $@

install: install-local

install-local: _build
rm -rf $(INSTALLBASE)/$(UUID)
mkdir -p $(INSTALLBASE)/$(UUID)
cp -r ./_build/* $(INSTALLBASE)/$(UUID)/
ifeq ($(INSTALLTYPE),system)
# system-wide settings and locale files
rm -r $(addprefix $(INSTALLBASE)/$(UUID)/, schemas locale COPYING)
mkdir -p $(SHARE_PREFIX)/glib-2.0/schemas \
$(SHARE_PREFIX)/locale \
$(SHARE_PREFIX)/licenses/$(PKG_NAME)
cp -r ./schemas/*gschema.xml $(SHARE_PREFIX)/glib-2.0/schemas
cp -r ./_build/locale/* $(SHARE_PREFIX)/locale
cp -r ./_build/COPYING $(SHARE_PREFIX)/licenses/$(PKG_NAME)
endif
-rm -fR _build
echo done

zip-file: _build
cd _build ; \
zip -qr "$(PKG_NAME)$(ZIPVER).zip" .
mv _build/$(PKG_NAME)$(ZIPVER).zip ./
-rm -fR _build

_build: all
-rm -fR ./_build
mkdir -p _build
cp $(BASE_MODULES) $(SRC_MODULES) _build
cp -r $(EXTRA_DIRECTORIES) _build
mkdir -p _build/schemas
cp schemas/*.xml _build/schemas
cp schemas/gschemas.compiled _build/schemas
for l in $(MSGSRC:arch-update.po=LC_MESSAGES/arch-update.mo) ; do \
cp -au --parents $$l _build; \
done;
ifdef VERSION
sed -i 's/"version": .*/"version": $(VERSION)/' _build/metadata.json;
else ifneq ($(strip $(GIT_VER)),)
sed -i '/"version": .*/i\ \ "git-version": "$(GIT_VER)",' _build/metadata.json;
endif
Binary file removed locale/ar/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/ca/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/cs_CZ/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/de_DE/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/eo/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/es/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/et/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/fa_IR/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/fi_FI/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/fr/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/he_IL/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/hu_HU/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/it_IT/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/ko/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/nb_NO/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/nl/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/oc/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/pl/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/pt_BR/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/ro/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/ru_RU/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/sk/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/sr/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/sr@latin/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/sv/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/tr_TR/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/uk_UA/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed locale/zh_CN/LC_MESSAGES/arch-update.mo
Binary file not shown.
Binary file removed schemas/gschemas.compiled
Binary file not shown.