mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-22 08:34:32 +01:00
[Makefile] Add option to compile to bytecode when building youtube-dl
This commit is contained in:
parent
b5434b5c31
commit
de6369c976
12
Makefile
12
Makefile
@ -11,6 +11,13 @@ MANDIR ?= $(PREFIX)/man
|
||||
SHAREDIR ?= $(PREFIX)/share
|
||||
PYTHON ?= /usr/bin/env python
|
||||
|
||||
COMPILE ?= no
|
||||
COMPILEFLAGS := -q
|
||||
# Write to legacy location for python >=3.2, instead of __pycache__
|
||||
ifneq ($(shell $(PYTHON) --version 2>&1 | grep '^Python 3\.[2-9]'),)
|
||||
COMPILEFLAGS += -b
|
||||
endif
|
||||
|
||||
# set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
|
||||
SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then echo /etc; else echo $(PREFIX)/etc; fi)
|
||||
|
||||
@ -62,7 +69,10 @@ youtube-dl: youtube_dl/*.py youtube_dl/*/*.py
|
||||
done
|
||||
touch -t 200001010101 zip/youtube_dl/*.py zip/youtube_dl/*/*.py
|
||||
mv zip/youtube_dl/__main__.py zip/
|
||||
cd zip ; zip -q ../youtube-dl youtube_dl/*.py youtube_dl/*/*.py __main__.py
|
||||
if [ "$(COMPILE)" = yes ] ; then \
|
||||
$(PYTHON) -m compileall $(COMPILEFLAGS) zip/ ;\
|
||||
fi
|
||||
cd zip ; zip -q ../youtube-dl youtube_dl/*.py* youtube_dl/*/*.py* __main__.py*
|
||||
rm -rf zip
|
||||
echo '#!$(PYTHON)' > youtube-dl
|
||||
cat youtube-dl.zip >> youtube-dl
|
||||
|
Loading…
Reference in New Issue
Block a user