mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-19 03:06:26 +00:00
RPM build fixes -- use RPM cflags, spec fixes, etc.
This commit is contained in:
parent
b02c3dfe8d
commit
8de5b2beda
@ -94,10 +94,14 @@ ifeq ($(ZT_ENABLE_CLUSTER),1)
|
|||||||
DEFS+=-DZT_ENABLE_CLUSTER
|
DEFS+=-DZT_ENABLE_CLUSTER
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ZT_TRACE),1)
|
||||||
|
DEFS+=-DZT_TRACE
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(ZT_DEBUG),1)
|
ifeq ($(ZT_DEBUG),1)
|
||||||
DEFS+=-DZT_TRACE
|
DEFS+=-DZT_TRACE
|
||||||
CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
override CFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||||
CXXFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
override CXXFLAGS+=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
STRIP?=echo
|
STRIP?=echo
|
||||||
# The following line enables optimization for the crypto code, since
|
# The following line enables optimization for the crypto code, since
|
||||||
@ -105,18 +109,14 @@ ifeq ($(ZT_DEBUG),1)
|
|||||||
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
|
||||||
else
|
else
|
||||||
CFLAGS?=-O3 -fstack-protector-strong
|
CFLAGS?=-O3 -fstack-protector-strong
|
||||||
CFLAGS+=-Wall -fPIE -fvisibility=hidden -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
override CFLAGS+=-Wall -fPIE -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
||||||
CXXFLAGS?=-O3 -fstack-protector-strong
|
CXXFLAGS?=-O3 -fstack-protector-strong
|
||||||
CXXFLAGS+=-Wall -Wno-unused-result -Wreorder -fPIE -fvisibility=hidden -fno-rtti -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
override CXXFLAGS+=-Wall -Wno-unused-result -Wreorder -fPIE -fno-rtti -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
||||||
LDFLAGS=-pie -Wl,-z,relro,-z,now
|
LDFLAGS=-pie -Wl,-z,relro,-z,now
|
||||||
STRIP?=strip
|
STRIP?=strip
|
||||||
STRIP+=--strip-all
|
STRIP+=--strip-all
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ZT_TRACE),1)
|
|
||||||
DEFS+=-DZT_TRACE
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Uncomment for gprof profile build
|
# Uncomment for gprof profile build
|
||||||
#CFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
|
#CFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
|
||||||
#CXXFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
|
#CXXFLAGS=-Wall -g -pg -pthread $(INCLUDES) $(DEFS)
|
||||||
|
@ -11,7 +11,7 @@ BuildRequires: http-parser-devel
|
|||||||
BuildRequires: lz4-devel
|
BuildRequires: lz4-devel
|
||||||
BuildRequires: libnatpmp-devel
|
BuildRequires: libnatpmp-devel
|
||||||
|
|
||||||
%if 0%{rhel} > 7
|
%if 0%{?rhel} > 7
|
||||||
BuildRequires: libnatpmp-devel
|
BuildRequires: libnatpmp-devel
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
%endif
|
%endif
|
||||||
@ -26,11 +26,11 @@ Requires: lz4
|
|||||||
Requires: libnatpmp
|
Requires: libnatpmp
|
||||||
Requires: iproute
|
Requires: iproute
|
||||||
|
|
||||||
%if 0%{rhel} >= 7
|
%if 0%{?rhel} >= 7
|
||||||
Requires: systemd
|
Requires: systemd
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if 0%{rhel} <= 6
|
%if 0%{?rhel} <= 6
|
||||||
Requires: chkconfig
|
Requires: chkconfig
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
@ -64,21 +64,20 @@ rm -f %{name}-%{version}
|
|||||||
cp -a %{getenv:PWD}/* .
|
cp -a %{getenv:PWD}/* .
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make ZT_USE_MINIUPNPC=1 %{?_smp_mflags}
|
make CFLAGS="`echo %{optflags} | sed s/stack-protector-strong/stack-protector/`" CXXFLAGS="`echo %{optflags} | sed s/stack-protector-strong/stack-protector/`" ZT_USE_MINIUPNPC=1 %{?_smp_mflags} one manpages selftest
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
make install DESTDIR=$RPM_BUILD_ROOT
|
make install DESTDIR=$RPM_BUILD_ROOT
|
||||||
|
%if 0%{?rhel} >= 7
|
||||||
%if 0%{rhel} >= 7
|
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
||||||
cp debian/zerotier-one.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
|
cp debian/zerotier-one.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
|
||||||
%endif
|
%endif
|
||||||
%if 0%{fedora} >= 21
|
%if 0%{?fedora} >= 21
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
||||||
cp debian/zerotier-one.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
|
cp debian/zerotier-one.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
|
||||||
%endif
|
%endif
|
||||||
%if 0%{rhel} <= 6
|
%if 0%{?rhel} <= 6
|
||||||
cp ext/installfiles/linux/zerotier-one.init.rhel6 $RPM_BUILD_ROOT/etc/init.d/zerotier-one
|
cp ext/installfiles/linux/zerotier-one.init.rhel6 $RPM_BUILD_ROOT/etc/init.d/zerotier-one
|
||||||
chmod 0755 $RPM_BUILD_ROOT/etc/init.d/zerotier-one
|
chmod 0755 $RPM_BUILD_ROOT/etc/init.d/zerotier-one
|
||||||
%endif
|
%endif
|
||||||
@ -88,26 +87,26 @@ chmod 0755 $RPM_BUILD_ROOT/etc/init.d/zerotier-one
|
|||||||
%{_bindir}/*
|
%{_bindir}/*
|
||||||
%{_mandir}/*
|
%{_mandir}/*
|
||||||
%{_localstatedir}/*
|
%{_localstatedir}/*
|
||||||
%if 0%{rhel} >= 7
|
%if 0%{?rhel} >= 7
|
||||||
%{_unitdir}/%{name}.service
|
%{_unitdir}/%{name}.service
|
||||||
%endif
|
%endif
|
||||||
%if 0%{fedora} >= 21
|
%if 0%{?fedora} >= 21
|
||||||
%{_unitdir}/%{name}.service
|
%{_unitdir}/%{name}.service
|
||||||
%endif
|
%endif
|
||||||
%if 0%{rhel} <= 6
|
%if 0%{?rhel} <= 6
|
||||||
/etc/init.d/zerotier-one
|
/etc/init.d/zerotier-one
|
||||||
%endif
|
%endif
|
||||||
%doc AUTHORS.md README.md
|
%doc AUTHORS.md README.md
|
||||||
%license LICENSE.GPL-3
|
%license LICENSE.GPL-3
|
||||||
|
|
||||||
%post
|
%post
|
||||||
%if 0%{rhel} >= 7
|
%if 0%{?rhel} >= 7
|
||||||
%systemd_post zerotier-one.service
|
%systemd_post zerotier-one.service
|
||||||
%endif
|
%endif
|
||||||
%if 0%{fedora} >= 21
|
%if 0%{?fedora} >= 21
|
||||||
%systemd_post zerotier-one.service
|
%systemd_post zerotier-one.service
|
||||||
%endif
|
%endif
|
||||||
%if 0%{rhel} <= 6
|
%if 0%{?rhel} <= 6
|
||||||
case "$1" in
|
case "$1" in
|
||||||
1)
|
1)
|
||||||
chkconfig --add zerotier-one
|
chkconfig --add zerotier-one
|
||||||
@ -120,13 +119,13 @@ esac
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%preun
|
%preun
|
||||||
%if 0%{rhel} >= 7
|
%if 0%{?rhel} >= 7
|
||||||
%systemd_preun zerotier-one.service
|
%systemd_preun zerotier-one.service
|
||||||
%endif
|
%endif
|
||||||
%if 0%{fedora} >= 21
|
%if 0%{?fedora} >= 21
|
||||||
%systemd_preun zerotier-one.service
|
%systemd_preun zerotier-one.service
|
||||||
%endif
|
%endif
|
||||||
%if 0%{rhel} <= 6
|
%if 0%{?rhel} <= 6
|
||||||
case "$1" in
|
case "$1" in
|
||||||
0)
|
0)
|
||||||
service zerotier-one stop
|
service zerotier-one stop
|
||||||
@ -140,10 +139,10 @@ esac
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%postun
|
%postun
|
||||||
%if 0%{rhel} >= 7
|
%if 0%{?rhel} >= 7
|
||||||
%systemd_postun_with_restart zerotier-one.service
|
%systemd_postun_with_restart zerotier-one.service
|
||||||
%endif
|
%endif
|
||||||
%if 0%{fedora} >= 21
|
%if 0%{?fedora} >= 21
|
||||||
%systemd_postun_with_restart zerotier-one.service
|
%systemd_postun_with_restart zerotier-one.service
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user