diff --git a/Makefile b/Makefile index 20c9ecf..c2e840a 100644 --- a/Makefile +++ b/Makefile @@ -6,16 +6,20 @@ CC ?= gcc CFLAGS ?= -O3 LDFLAGS ?= +RPI_VC_HEADERS ?= /opt/vc/include +RPI_VC_LIBS ?= /opt/vc/lib + # ===== LIBS = -lm -ljpeg -pthread -levent -levent_pthreads -luuid override CFLAGS += -c -std=c11 -Wall -Wextra -D_GNU_SOURCE SOURCES = $(shell ls src/*.c src/http/*.c src/encoders/cpu/*.c src/encoders/hw/*.c) -ifeq ($(shell ls -d /opt/vc/include 2>/dev/null), /opt/vc/include) -SOURCES += $(shell ls src/encoders/omx/*.c) -LIBS += -lbcm_host -lvcos -lopenmaxil -L/opt/vc/lib -override CFLAGS += -DWITH_OMX_ENCODER -DOMX_SKIP64BIT -I/opt/vc/include +ifeq ($(WITH_OMX_ENCODER),) +else + LIBS += -lbcm_host -lvcos -lopenmaxil -L$(RPI_VC_LIBS) + override CFLAGS += -DWITH_OMX_ENCODER -DOMX_SKIP64BIT -I$(RPI_VC_HEADERS) + SOURCES += $(shell ls src/encoders/omx/*.c) endif @@ -41,11 +45,18 @@ regen: $(PROG): $(SOURCES:.c=.o) - $(CC) $(SOURCES:.c=.o) -o $@ $(LDFLAGS) $(LIBS) + $(info -- LINKING $@) + @ $(CC) $(SOURCES:.c=.o) -o $@ $(LDFLAGS) $(LIBS) + $(info ===== Build complete =====) + $(info == CC = $(CC)) + $(info == LIBS = $(LIBS)) + $(info == CFLAGS = $(CFLAGS)) + $(info == LDFLAGS = $(LDFLAGS)) .c.o: - $(CC) $< -o $@ $(CFLAGS) $(LIBS) + $(info -- CC $<) + @ $(CC) $< -o $@ $(CFLAGS) $(LIBS) release: @@ -57,7 +68,7 @@ release: bump: - bumpversion $(if $(V), $(V), minor) + bumpversion $(if $(V),$(V),minor) push: diff --git a/README.md b/README.md index b1cfcfa..dd57374 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ If you're going to live-stream from your backyard webcam and need to control it, # Building You'll need ```make```, ```gcc```, ```libevent``` with ```pthreads``` support, ```libjpeg8```/```libjpeg-turbo``` and ```libuuid```. -It should compile automatically with OpenMAX IL on Raspberry Pi, if the corresponding headers are present in ```/opt/vc/include```. +On Raspberry Pi you can build the program with OpenMAX IL. To do this pass option ```WITH_OMX_ENCODER=1``` to ```make```. ``` $ git clone --depth=1 https://github.com/pi-kvm/ustreamer @@ -40,8 +40,8 @@ $ make $ ./ustreamer --help ``` -AUR has a package for Arch Linux: https://aur.archlinux.org/packages/ustreamer -FreeBSD port: https://www.freshports.org/multimedia/ustreamer +AUR has a package for Arch Linux: https://aur.archlinux.org/packages/ustreamer. It should compile automatically with OpenMAX IL on Raspberry Pi, if the corresponding headers are present in ```/opt/vc/include```. +FreeBSD port: https://www.freshports.org/multimedia/ustreamer. ----- # Usage diff --git a/README.ru.md b/README.ru.md index 668055b..23793e6 100644 --- a/README.ru.md +++ b/README.ru.md @@ -31,7 +31,7 @@ # Сборка Для сборки вам понадобятся ```make```, ```gcc```, ```libevent``` с поддержкой ```pthreads```, ```libjpeg8```/```libjpeg-turbo``` и ```libuuid```. -На Raspberry Pi програма автоматически собирается с поддержкой OpenMAX IL, если обнаружит нужные хедеры в ```/opt/vc/include```. +На Raspberry Pi программу можно собрать с поддержкой OpenMAX IL. Для этого передайте ```make``` параметр ```WITH_OMX_ENCODER=1```. ``` $ git clone --depth=1 https://github.com/pi-kvm/ustreamer @@ -40,8 +40,8 @@ $ make $ ./ustreamer --help ``` -Для Arch Linux в AUR есть готовый пакет: https://aur.archlinux.org/packages/ustreamer -Порт для FreeBSD: https://www.freshports.org/multimedia/ustreamer +Для Arch Linux в AUR есть готовый пакет: https://aur.archlinux.org/packages/ustreamer. На Raspberry Pi програма автоматически собирается с поддержкой OpenMAX IL, если обнаружит нужные хедеры в ```/opt/vc/include```. +Порт для FreeBSD: https://www.freshports.org/multimedia/ustreamer. ----- # Использование diff --git a/pkg/arch/PKGBUILD b/pkg/arch/PKGBUILD index 0630c2c..b775442 100644 --- a/pkg/arch/PKGBUILD +++ b/pkg/arch/PKGBUILD @@ -12,19 +12,23 @@ arch=(i686 x86_64 armv6h armv7h) depends=(libjpeg libevent libutil-linux) # optional: raspberrypi-firmware for OMX JPEG encoder makedepends=(gcc make) -source=("$url/archive/v$pkgver.tar.gz") +source=(${pkgname}::"git+https://github.com/pi-kvm/ustreamer#commit=${pkgver}") md5sums=(SKIP) build() { - cd $srcdir + cd "$srcdir" rm -rf $pkgname-build - cp -r $pkgname-$pkgver $pkgname-build + cp -r $pkgname $pkgname-build cd $pkgname-build - make CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" $MAKEFLAGS + + local _options="" + [ -d /opt/vc/include ] && _options="$_options WITH_OMX_ENCODER=1" + + make $_options CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" $MAKEFLAGS } package() { - cd $srcdir/$pkgname-build + cd "$srcdir/$pkgname-build" make DESTDIR="$pkgdir" PREFIX=/usr install } diff --git a/src/config.h b/src/config.h index bbc0a6a..361cbb3 100644 --- a/src/config.h +++ b/src/config.h @@ -22,4 +22,6 @@ #pragma once -#define VERSION "0.75" +#ifndef VERSION +# define VERSION "0.75" +#endif