mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-22 16:44: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
|
SHAREDIR ?= $(PREFIX)/share
|
||||||
PYTHON ?= /usr/bin/env python
|
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
|
# 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)
|
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
|
done
|
||||||
touch -t 200001010101 zip/youtube_dl/*.py zip/youtube_dl/*/*.py
|
touch -t 200001010101 zip/youtube_dl/*.py zip/youtube_dl/*/*.py
|
||||||
mv zip/youtube_dl/__main__.py zip/
|
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
|
rm -rf zip
|
||||||
echo '#!$(PYTHON)' > youtube-dl
|
echo '#!$(PYTHON)' > youtube-dl
|
||||||
cat youtube-dl.zip >> youtube-dl
|
cat youtube-dl.zip >> youtube-dl
|
||||||
|
Loading…
Reference in New Issue
Block a user