Gentoo Archives: gentoo-commits

From: "Anthony G. Basile (blueness)" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-p2p/litecoind/files: litecoin.confd litecoin.conf litecoin.initd litecoin-sys_leveldb.patch litecoind.logrotate litecoin.service
Date: Sun, 01 Dec 2013 13:20:44
Message-Id: 20131201132037.0351A2004B@flycatcher.gentoo.org
1 blueness 13/12/01 13:20:36
2
3 Added: litecoin.confd litecoin.conf litecoin.initd
4 litecoin-sys_leveldb.patch litecoind.logrotate
5 litecoin.service
6 Log:
7 Initial commit
8
9 (Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0xF52D4BBA)
10
11 Revision Changes Path
12 1.1 net-p2p/litecoind/files/litecoin.confd
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoin.confd?rev=1.1&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoin.confd?rev=1.1&content-type=text/plain
16
17 Index: litecoin.confd
18 ===================================================================
19 # Config file for /etc/init.d/litecoind
20
21 # owner of liteciond process (don't change, must be existing)
22 LITECOIN_USER="litecoin"
23
24 # See http://www.bitcoin.org/smf/index.php?topic=1063
25 LITECOIN_OPTS="${LITECOIN_OPTS}"
26
27 # nice level
28 NICELEVEL="19"
29
30
31
32 1.1 net-p2p/litecoind/files/litecoin.conf
33
34 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoin.conf?rev=1.1&view=markup
35 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoin.conf?rev=1.1&content-type=text/plain
36
37 Index: litecoin.conf
38 ===================================================================
39 # http://www.bitcoin.org/smf/index.php?topic=644.0
40 #rpcuser=
41 #rpcpassword=
42
43
44
45
46
47
48
49
50 1.1 net-p2p/litecoind/files/litecoin.initd
51
52 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoin.initd?rev=1.1&view=markup
53 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoin.initd?rev=1.1&content-type=text/plain
54
55 Index: litecoin.initd
56 ===================================================================
57 #!/sbin/runscript
58 # Distributed under the terms of the GNU General Public License, v2 or later
59
60 VARDIR="/var/lib/litecoin"
61 CONFFILE="${VARDIR}/.litecoin/litecoin.conf"
62
63 depend() {
64 need net
65 }
66
67 checkconfig() {
68 if [[ "${LITECOIN_USER}" == "" ]] ; then
69 eerror "Please edit /etc/conf.d/litecoind"
70 eerror "A user must be specified to run litecoind as that user."
71 eerror "Modify USER to your needs (you may also add a group after a colon)"
72 return 1
73 fi
74 if ! `getent passwd | cut -d ':' -f 1 | grep $( echo "${LITECOIN_USER}" | cut -d ':' -f 1 ) -sq` ; then
75 eerror "Please edit /etc/conf.d/litecoind"
76 eerror "Specified user must exist!"
77 return 1
78 fi
79 if `echo "${LITECOIN_USER}" | grep ':' -sq` ; then
80 if ! `cut -d ':' -f 1 /etc/group | grep $( echo "${LITECOIN_USER}" | cut -d ':' -f 2 ) -sq` ; then
81 eerror "Please edit /etc/conf.d/litecoind"
82 eerror "Specified group must exist!"
83 return 1
84 fi
85 fi
86 if ! grep -q '^rpcpassword=' "${CONFFILE}"; then
87 eerror "Please edit `readlink -f ${CONFFILE}`"
88 eerror "There must be at least a line assigning rpcpassword=something-secure"
89 return 1
90 fi
91 if ! stat -Lc '%a' "${CONFFILE}" | grep -q '^[4567]00$'; then
92 eerror "`readlink -f ${CONFFILE}` should not be readable by other users"
93 return 1
94 fi
95 return 0
96 }
97
98 start() {
99 checkconfig || return 1
100 ebegin "Starting Litecoind daemon"
101
102 pkg-config openrc
103 if [ $? = 0 ]; then
104 start_openrc
105 else
106 start_baselayout
107 fi
108 }
109
110 stop() {
111 ebegin "Stopping Litecoin daemon"
112
113 pkg-config openrc
114 if [ $? = 0 ]; then
115 stop_openrc
116 else
117 stop_baselayout
118 fi
119 }
120
121 start_openrc() {
122 start-stop-daemon \
123 --start --user "${LITECOIN_USER}" --name litecoind \
124 --pidfile /var/run/litecoind.pid --make-pidfile \
125 --env HOME="${VARDIR}" --exec /usr/bin/litecoind \
126 --nicelevel "${NICELEVEL}" \
127 --background \
128 --wait 2000 \
129 -- ${LITECOIN_OPTS}
130 eend $?
131 }
132
133 stop_openrc() {
134 start-stop-daemon --stop --user "${LITECOIN_USER}" \
135 --name litecoind --pidfile /var/run/litecoind.pid \
136 --wait 30000 \
137 --progress
138 eend $?
139 }
140
141 start_baselayout() {
142 start-stop-daemon \
143 --start --user "${LITECOIN_USER}" --name litecoind \
144 --pidfile /var/run/litecoind.pid --make-pidfile \
145 --env HOME="${VARDIR}" --exec /usr/bin/litecoind \
146 --chuid "${LITECOIN_USER}" \
147 --nicelevel "${NICELEVEL}" \
148 --background \
149 -- ${LITECOIN_OPTS}
150 eend $?
151 }
152
153 stop_baselayout() {
154 start-stop-daemon \
155 --stop \
156 --user "${LITECOIN_USER}" \
157 --name litecoind \
158 --pidfile /var/run/litecoind.pid
159 eend $?
160 }
161
162
163
164 1.1 net-p2p/litecoind/files/litecoin-sys_leveldb.patch
165
166 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoin-sys_leveldb.patch?rev=1.1&view=markup
167 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoin-sys_leveldb.patch?rev=1.1&content-type=text/plain
168
169 Index: litecoin-sys_leveldb.patch
170 ===================================================================
171 diff -Naur litecoin-0.8.5.3-rc3.orig/bitcoin-qt.pro litecoin-0.8.5.3-rc3/bitcoin-qt.pro
172 --- litecoin-0.8.5.3-rc3.orig/bitcoin-qt.pro 2013-11-28 21:17:05.000000000 -0500
173 +++ litecoin-0.8.5.3-rc3/bitcoin-qt.pro 2013-11-29 14:53:00.960537685 -0500
174 @@ -5,7 +5,7 @@
175 INCLUDEPATH += src src/json src/qt
176 QT += core gui network
177 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
178 -DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE
179 +DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE LEVELDB_WITHOUT_MEMENV
180 CONFIG += no_include_pwd
181 CONFIG += thread
182
183 @@ -101,25 +101,30 @@
184 QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets
185 }
186
187 +contains(USE_SYSTEM_LEVELDB, 1) {
188 + LIBS += -lleveldb
189 +} else {
190 INCLUDEPATH += src/leveldb/include src/leveldb/helpers
191 -LIBS += $$PWD/src/leveldb/libleveldb.a $$PWD/src/leveldb/libmemenv.a
192 +LIBS += $$PWD/src/leveldb/libleveldb.a
193 !win32 {
194 # we use QMAKE_CXXFLAGS_RELEASE even without RELEASE=1 because we use RELEASE to indicate linking preferences not -O preferences
195 - genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a
196 + genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a
197 } else {
198 # make an educated guess about what the ranlib command is called
199 isEmpty(QMAKE_RANLIB) {
200 QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib)
201 }
202 LIBS += -lshlwapi
203 - genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a
204 + genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a
205 }
206 genleveldb.target = $$PWD/src/leveldb/libleveldb.a
207 genleveldb.depends = FORCE
208 PRE_TARGETDEPS += $$PWD/src/leveldb/libleveldb.a
209 QMAKE_EXTRA_TARGETS += genleveldb
210 +}
211 # Gross ugly hack that depends on qmake internals, unfortunately there is no other way to do it.
212 -QMAKE_CLEAN += $$PWD/src/leveldb/libleveldb.a; cd $$PWD/src/leveldb ; $(MAKE) clean
213 +QMAKE_CLEAN += $$PWD/src/leveldb/libleveldb.a; cd $$PWD/src/leveldb && $(MAKE) clean || true
214 +
215
216 # regenerate src/build.h
217 !win32|contains(USE_BUILD_INFO, 1) {
218 diff -Naur litecoin-0.8.5.3-rc3.orig/src/leveldb.cpp litecoin-0.8.5.3-rc3/src/leveldb.cpp
219 --- litecoin-0.8.5.3-rc3.orig/src/leveldb.cpp 2013-11-28 21:17:05.000000000 -0500
220 +++ litecoin-0.8.5.3-rc3/src/leveldb.cpp 2013-11-29 14:55:33.760543008 -0500
221 @@ -8,7 +8,9 @@
222 #include <leveldb/env.h>
223 #include <leveldb/cache.h>
224 #include <leveldb/filter_policy.h>
225 -#include <memenv/memenv.h>
226 +#ifndef LEVELDB_WITHOUT_MEMENV
227 +#include <memenv.h>
228 +#endif
229
230 #include <boost/filesystem.hpp>
231
232 @@ -43,8 +45,12 @@
233 options = GetOptions(nCacheSize);
234 options.create_if_missing = true;
235 if (fMemory) {
236 +#ifndef LEVELDB_WITHOUT_MEMENV
237 penv = leveldb::NewMemEnv(leveldb::Env::Default());
238 options.env = penv;
239 +#else
240 + throw std::runtime_error("CLevelDB(): compiled without memenv support");
241 +#endif
242 } else {
243 if (fWipe) {
244 printf("Wiping LevelDB in %s\n", path.string().c_str());
245 diff -Naur litecoin-0.8.5.3-rc3.orig/src/makefile.unix litecoin-0.8.5.3-rc3/src/makefile.unix
246 --- litecoin-0.8.5.3-rc3.orig/src/makefile.unix 2013-11-28 21:17:05.000000000 -0500
247 +++ litecoin-0.8.5.3-rc3/src/makefile.unix 2013-11-29 15:08:58.337571033 -0500
248 @@ -110,8 +110,7 @@
249 # adds some defaults in front. Unfortunately, LDFLAGS=... $(LDFLAGS) does not work.
250 xLDFLAGS=$(LDHARDENING) $(LDFLAGS)
251
252 -OBJS= \
253 - leveldb/libleveldb.a \
254 +BASEOBJS := \
255 obj/alert.o \
256 obj/version.o \
257 obj/checkpoints.o \
258 @@ -120,7 +119,6 @@
259 obj/crypter.o \
260 obj/key.o \
261 obj/db.o \
262 - obj/init.o \
263 obj/keystore.o \
264 obj/main.o \
265 obj/net.o \
266 @@ -141,9 +139,17 @@
267 obj/hash.o \
268 obj/bloom.o \
269 obj/noui.o \
270 - obj/leveldb.o \
271 obj/txdb.o
272
273 +OBJS := \
274 + obj/leveldb.o \
275 + obj/init.o \
276 + $(BASEOBJS)
277 +
278 +TESTOBJS := \
279 + obj-test/leveldb.o \
280 + $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp)) \
281 + $(BASEOBJS)
282
283 ifdef USE_SSE2
284 DEFS += -DUSE_SSE2
285 @@ -156,15 +162,25 @@
286 test check: test_litecoin FORCE
287 ./test_litecoin
288
289 +ifdef USE_SYSTEM_LEVELDB
290 + LIBS += -lleveldb
291 + TESTLIBS += -lmemenv
292 +else
293 #
294 # LevelDB support
295 #
296 MAKEOVERRIDES =
297 -LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
298 +LIBS += $(CURDIR)/leveldb/libleveldb.a
299 +TESTLIBS += $(CURDIR)/leveldb/libmemenv.a
300 DEFS += $(addprefix -I,$(CURDIR)/leveldb/include)
301 DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
302 leveldb/libleveldb.a:
303 - @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd ..
304 + @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a && cd ..
305 +leveldb/libmemenv.a:
306 + @echo "Building LevelDB memenv ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libmemenv.a && cd ..
307 +OBJS += leveldb/libleveldb.a
308 +TESTOBJS += leveldb/libmemenv.a
309 +endif
310
311 # auto-generated dependencies:
312 -include obj/*.P
313 @@ -175,33 +191,34 @@
314 version.cpp: obj/build.h
315 DEFS += -DHAVE_BUILD_INFO
316
317 -obj/%-sse2.o: %-sse2.cpp
318 - $(CXX) -c $(xCXXFLAGS) -msse2 -MMD -MF $(@:%.o=%.d) -o $@ $<
319 +P_TO_D = \
320 @cp $(@:%.o=%.d) $(@:%.o=%.P); \
321 - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
322 + sed -e 's/\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
323 -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
324 rm -f $(@:%.o=%.d)
325
326 +obj/%-sse2.o: %-sse2.cpp
327 + $(CXX) -c $(xCXXFLAGS) -msse2 -MMD -MF $(@:%.o=%.d) -o $@ $<
328 + $(P_TO_D)
329 +
330 obj/%.o: %.cpp
331 - $(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
332 - @cp $(@:%.o=%.d) $(@:%.o=%.P); \
333 - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
334 - -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
335 - rm -f $(@:%.o=%.d)
336 + $(CXX) -c $(xCXXFLAGS) -DLEVELDB_WITHOUT_MEMENV -MMD -MF $(@:%.o=%.d) -o $@ $<
337 + $(P_TO_D)
338
339 -litecoind: $(OBJS:obj/%=obj/%)
340 +litecoind: $(OBJS)
341 $(LINK) $(xCXXFLAGS) -o $@ $^ $(xLDFLAGS) $(LIBS)
342
343 -TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
344 -
345 obj-test/%.o: test/%.cpp
346 $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
347 - @cp $(@:%.o=%.d) $(@:%.o=%.P); \
348 - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
349 - -e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
350 - rm -f $(@:%.o=%.d)
351 + $(P_TO_D)
352 +
353 +obj-test/leveldb.o: leveldb.cpp
354 + $(CXX) -c $(TESTDEFS) $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
355 + $(P_TO_D)
356 +
357 +TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
358
359 -test_litecoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
360 +test_litecoin: $(TESTOBJS)
361 $(LINK) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS)
362
363 clean:
364
365
366
367 1.1 net-p2p/litecoind/files/litecoind.logrotate
368
369 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoind.logrotate?rev=1.1&view=markup
370 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoind.logrotate?rev=1.1&content-type=text/plain
371
372 Index: litecoind.logrotate
373 ===================================================================
374 /var/lib/litecoin/.litecoin/debug.log {
375 weekly
376 sharedscripts
377 postrotate
378 killall -HUP litecoind
379 endscript
380 }
381
382
383
384 1.1 net-p2p/litecoind/files/litecoin.service
385
386 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoin.service?rev=1.1&view=markup
387 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-p2p/litecoind/files/litecoin.service?rev=1.1&content-type=text/plain
388
389 Index: litecoin.service
390 ===================================================================
391 # It's not recommended to modify this file in-place, because it will be
392 # overwritten during package upgrades. If you want to customize, the
393 # best way is to create file
394 # "/etc/systemd/system/litecoind.service.d/*.conf"
395 # containing your changes
396
397 # For example, if you want to change some daemon and/or unit options,
398 # create a file named
399 # "/etc/systemd/system/litecoind.service.d/myopts.conf"
400 # containing:
401 # [Service]
402 # Environment="LITECOIN_OPTS=-debug -logtimestamps"
403 # Nice=10
404 # This will override the setting appearing below.
405
406 # Note that almost all daemon options could be specified in
407 # /etc/litecoin/litecoin.conf
408
409 [Unit]
410 Description=Litecoin Daemon
411 After=network.target
412
413 [Service]
414 User=litecoin
415 Environment=LITECOIN_OPTS=
416 ExecStart=/usr/bin/litecoind -daemon=0 $LITECOIN_OPTS
417 ExecReload=/bin/kill -HUP $MAINPID
418
419 [Install]
420 WantedBy=multi-user.target