96 elif [[ $ARG = --mandir=* ]]; then |
91 elif [[ $ARG = --mandir=* ]]; then |
97 MANDIR=${ARG:9} |
92 MANDIR=${ARG:9} |
98 elif [ $ARG = "--help" ]; then |
93 elif [ $ARG = "--help" ]; then |
99 printhelp |
94 printhelp |
100 exit 0 |
95 exit 0 |
101 elif [[ $ARG == --toolkit=* ]]; then |
96 elif [[ $ARG == --enable-pg ]]; then |
102 OPT_TOOLKIT=${ARG:10} |
97 FEATURE_PG=on |
103 elif [[ $ARG == --enable-db ]]; then |
98 elif [[ $ARG == --disable-pg ]]; then |
104 FEATURE_DB=on |
99 unset FEATURE_PG |
105 elif [[ $ARG == --disable-db ]]; then |
|
106 unset FEATURE_DB |
|
107 elif [[ $ARG == --enable-gui ]]; then |
|
108 FEATURE_GUI=on |
|
109 elif [[ $ARG == --disable-gui ]]; then |
|
110 unset FEATURE_GUI |
|
111 fi |
100 fi |
112 done |
101 done |
113 |
102 |
114 # set dir variables |
103 # set dir variables |
115 if [ -z $BINDIR ]; then |
104 if [ -z $BINDIR ]; then |
226 |
215 |
227 # |
216 # |
228 # DEPENDENCIES |
217 # DEPENDENCIES |
229 # |
218 # |
230 |
219 |
231 dependency_qt4() |
220 dependency_libpq() |
232 { |
221 { |
233 printf "checking for qt4... " |
222 printf "checking for libpq... " |
234 # dependency qt4 |
223 # dependency libpq |
235 while true |
224 while true |
236 do |
225 do |
237 which qmake-qt4 > /dev/null |
226 if [ -z "PKG_CONFIG" ]; then |
238 if [ $? -ne 0 ]; then |
|
239 break |
227 break |
240 fi |
228 fi |
|
229 if ! pkg-config libpq ; then |
|
230 break |
|
231 fi |
|
232 CFLAGS+=" `pkg-config --cflags libpq`" |
|
233 LDFLAGS+=" `pkg-config --libs libpq`" |
241 echo yes |
234 echo yes |
242 return 0 |
235 return 0 |
243 done |
236 done |
244 |
237 |
245 echo no |
238 echo no |
246 return 1 |
239 return 1 |
247 } |
240 } |
248 dependency_curl() |
241 dependency_openssl() |
249 { |
242 { |
250 printf "checking for curl... " |
243 printf "checking for openssl... " |
251 # dependency curl platform="windows" |
244 # dependency openssl |
252 while true |
|
253 do |
|
254 if ! isplatform "windows"; then |
|
255 break |
|
256 fi |
|
257 CFLAGS+="-I/mingw/include" |
|
258 LDFLAGS+="-lcurl" |
|
259 echo yes |
|
260 return 0 |
|
261 done |
|
262 |
|
263 # dependency curl platform="macos" |
|
264 while true |
|
265 do |
|
266 if ! isplatform "macos"; then |
|
267 break |
|
268 fi |
|
269 curl-config --cflags > /dev/null |
|
270 if [ $? -eq 0 ]; then |
|
271 CFLAGS+=" `curl-config --cflags`" |
|
272 else |
|
273 break |
|
274 fi |
|
275 curl-config --ldflags > /dev/null |
|
276 if [ $? -eq 0 ]; then |
|
277 LDFLAGS+=" `curl-config --ldflags`" |
|
278 else |
|
279 break |
|
280 fi |
|
281 echo yes |
|
282 return 0 |
|
283 done |
|
284 |
|
285 # dependency curl |
|
286 while true |
245 while true |
287 do |
246 do |
288 if [ -z "PKG_CONFIG" ]; then |
247 if [ -z "PKG_CONFIG" ]; then |
289 break |
248 break |
290 fi |
249 fi |
291 if ! pkg-config libcurl ; then |
250 if ! pkg-config openssl ; then |
292 break |
251 break |
293 fi |
252 fi |
294 CFLAGS+=" `pkg-config --cflags libcurl`" |
253 CFLAGS+=" `pkg-config --cflags openssl`" |
295 LDFLAGS+=" `pkg-config --libs libcurl`" |
254 LDFLAGS+=" `pkg-config --libs openssl`" |
296 echo yes |
|
297 return 0 |
|
298 done |
|
299 |
|
300 echo no |
|
301 return 1 |
|
302 } |
|
303 dependency_test() |
|
304 { |
|
305 printf "checking for test... " |
|
306 # dependency test platform="bsd" |
|
307 while true |
|
308 do |
|
309 if ! isplatform "bsd"; then |
|
310 break |
|
311 fi |
|
312 if isplatform "macos"; then |
|
313 break |
|
314 fi |
|
315 CFLAGS+="-DBSD" |
|
316 echo yes |
|
317 return 0 |
|
318 done |
|
319 |
|
320 # dependency test |
|
321 while true |
|
322 do |
|
323 CFLAGS+="-DTEST" |
|
324 echo yes |
|
325 return 0 |
|
326 done |
|
327 |
|
328 echo no |
|
329 return 1 |
|
330 } |
|
331 dependency_sqlite() |
|
332 { |
|
333 printf "checking for sqlite... " |
|
334 # dependency sqlite |
|
335 while true |
|
336 do |
|
337 if [ -z "PKG_CONFIG" ]; then |
|
338 break |
|
339 fi |
|
340 if ! pkg-config sqlite3 ; then |
|
341 break |
|
342 fi |
|
343 CFLAGS+=" `pkg-config --cflags sqlite3`" |
|
344 LDFLAGS+=" `pkg-config --libs sqlite3`" |
|
345 echo yes |
|
346 return 0 |
|
347 done |
|
348 |
|
349 echo no |
|
350 return 1 |
|
351 } |
|
352 dependency_gtk2() |
|
353 { |
|
354 printf "checking for gtk2... " |
|
355 # dependency gtk2 |
|
356 while true |
|
357 do |
|
358 if [ -z "PKG_CONFIG" ]; then |
|
359 break |
|
360 fi |
|
361 if ! pkg-config gtk+-2.0 ; then |
|
362 break |
|
363 fi |
|
364 CFLAGS+=" `pkg-config --cflags gtk+-2.0`" |
|
365 LDFLAGS+=" `pkg-config --libs gtk+-2.0`" |
|
366 echo yes |
|
367 return 0 |
|
368 done |
|
369 |
|
370 echo no |
|
371 return 1 |
|
372 } |
|
373 dependency_gtk3() |
|
374 { |
|
375 printf "checking for gtk3... " |
|
376 # dependency gtk3 |
|
377 while true |
|
378 do |
|
379 if [ -z "PKG_CONFIG" ]; then |
|
380 break |
|
381 fi |
|
382 if ! pkg-config gtk+-5.0 ; then |
|
383 break |
|
384 fi |
|
385 CFLAGS+=" `pkg-config --cflags gtk+-5.0`" |
|
386 LDFLAGS+=" `pkg-config --libs gtk+-5.0`" |
|
387 echo yes |
|
388 return 0 |
|
389 done |
|
390 |
|
391 echo no |
|
392 return 1 |
|
393 } |
|
394 dependency_deptest() |
|
395 { |
|
396 printf "checking for deptest... " |
|
397 # dependency deptest |
|
398 while true |
|
399 do |
|
400 CFLAGS+="-DDEPTEST" |
|
401 echo yes |
255 echo yes |
402 return 0 |
256 return 0 |
403 done |
257 done |
404 |
258 |
405 echo no |
259 echo no |
462 fi |
351 fi |
463 |
352 |
464 # |
353 # |
465 # OPTION VALUES |
354 # OPTION VALUES |
466 # |
355 # |
467 checkopt_toolkit_gtk3() |
|
468 { |
|
469 VERR=0 |
|
470 dependency_gtk3 |
|
471 if [ $? -ne 0 ]; then |
|
472 VERR=1 |
|
473 fi |
|
474 if [ $VERR -ne 0 ]; then |
|
475 return 1 |
|
476 fi |
|
477 CFLAGS+=" -Da=b" |
|
478 cat >> $TEMP_DIR/make.mk << __EOF__ |
|
479 UIOBJ += graphics_cairo.o |
|
480 |
|
481 __EOF__ |
|
482 return 0 |
|
483 } |
|
484 checkopt_toolkit_cli() |
|
485 { |
|
486 VERR=0 |
|
487 dependency_curl |
|
488 if [ $? -ne 0 ]; then |
|
489 VERR=1 |
|
490 fi |
|
491 dependency_test |
|
492 if [ $? -ne 0 ]; then |
|
493 VERR=1 |
|
494 fi |
|
495 if [ $VERR -ne 0 ]; then |
|
496 return 1 |
|
497 fi |
|
498 return 0 |
|
499 } |
|
500 checkopt_toolkit_gtk2() |
|
501 { |
|
502 VERR=0 |
|
503 dependency_gtk2 |
|
504 if [ $? -ne 0 ]; then |
|
505 VERR=1 |
|
506 fi |
|
507 if [ $VERR -ne 0 ]; then |
|
508 return 1 |
|
509 fi |
|
510 return 0 |
|
511 } |
|
512 checkopt_toolkit_wpf() |
|
513 { |
|
514 VERR=0 |
|
515 dependency_test |
|
516 if [ $? -ne 0 ]; then |
|
517 VERR=1 |
|
518 fi |
|
519 if [ $VERR -ne 0 ]; then |
|
520 return 1 |
|
521 fi |
|
522 return 0 |
|
523 } |
|
524 |
356 |
525 # |
357 # |
526 # TARGETS |
358 # TARGETS |
527 # |
359 # |
528 CFLAGS= |
360 CFLAGS= |
529 CXXFLAGS= |
361 CXXFLAGS= |
530 LDFLAGS= |
362 LDFLAGS= |
531 |
363 |
532 # Target: dav |
364 # Target |
533 CFLAGS= |
365 CFLAGS= |
534 LDFLAGS= |
366 LDFLAGS= |
535 CXXFLAGS= |
367 CXXFLAGS= |
536 |
368 |
537 dependency_curl |
|
538 if [ $? -ne 0 ]; then |
|
539 DEPENDENCIES_FAILED+="curl " |
|
540 ERROR=1 |
|
541 fi |
|
542 dependency_libxml2 |
369 dependency_libxml2 |
543 if [ $? -ne 0 ]; then |
370 if [ $? -ne 0 ]; then |
544 DEPENDENCIES_FAILED+="libxml2 " |
371 DEPENDENCIES_FAILED+="libxml2 " |
545 ERROR=1 |
372 ERROR=1 |
546 fi |
373 fi |
547 dependency_test |
374 dependency_openssl |
548 if [ $? -ne 0 ]; then |
375 if [ $? -ne 0 ]; then |
549 DEPENDENCIES_FAILED+="test " |
376 DEPENDENCIES_FAILED+="openssl " |
550 ERROR=1 |
|
551 fi |
|
552 |
|
553 # Option: --toolkit |
|
554 if [ -z $OPT_TOOLKIT ]; then |
|
555 SAVED_ERROR=$ERROR |
|
556 SAVED_DEPENDENCIES_FAILED=$DEPENDENCIES_FAILED |
|
557 ERROR=0 |
|
558 while true |
|
559 do |
|
560 if isplatform "windows"; then |
|
561 checkopt_toolkit_wpf |
|
562 if [ $? -eq 0 ]; then |
|
563 echo " toolkit: wpf" >> $TEMP_DIR/options |
|
564 ERROR=0 |
|
565 break |
|
566 fi |
|
567 fi |
|
568 checkopt_toolkit_gtk3 |
|
569 if [ $? -eq 0 ]; then |
|
570 echo " toolkit: gtk3" >> $TEMP_DIR/options |
|
571 ERROR=0 |
|
572 break |
|
573 fi |
|
574 checkopt_toolkit_gtk2 |
|
575 if [ $? -eq 0 ]; then |
|
576 echo " toolkit: gtk2" >> $TEMP_DIR/options |
|
577 ERROR=0 |
|
578 break |
|
579 fi |
|
580 break |
|
581 done |
|
582 if [ $ERROR -ne 0 ]; then |
|
583 SAVED_ERROR=1 |
|
584 fi |
|
585 ERROR=$SAVED_ERROR |
|
586 DEPENDENCIES_FAILED=$SAVED_DEPENDENCIES_FAILED= |
|
587 else |
|
588 if false; then |
|
589 false |
|
590 elif [ $OPT_TOOLKIT = "gtk3" ]; then |
|
591 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
592 checkopt_toolkit_gtk3 |
|
593 if [ $? -ne 0 ]; then |
|
594 ERROR=1 |
|
595 fi |
|
596 elif [ $OPT_TOOLKIT = "cli" ]; then |
|
597 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
598 checkopt_toolkit_cli |
|
599 if [ $? -ne 0 ]; then |
|
600 ERROR=1 |
|
601 fi |
|
602 elif [ $OPT_TOOLKIT = "gtk2" ]; then |
|
603 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
604 checkopt_toolkit_gtk2 |
|
605 if [ $? -ne 0 ]; then |
|
606 ERROR=1 |
|
607 fi |
|
608 elif [ $OPT_TOOLKIT = "wpf" ]; then |
|
609 echo " toolkit: $OPT_TOOLKIT" >> $TEMP_DIR/options |
|
610 checkopt_toolkit_wpf |
|
611 if [ $? -ne 0 ]; then |
|
612 ERROR=1 |
|
613 fi |
|
614 fi |
|
615 fi |
|
616 |
|
617 echo >> $TEMP_DIR/config.mk |
|
618 if [[ ! -z ${CFLAGS} ]]; then |
|
619 echo "DAV_CFLAGS += $CFLAGS" >> $TEMP_DIR/config.mk |
|
620 fi |
|
621 if [[ ! -z ${CXXFLAGS} ]]; then |
|
622 echo "DAV_CXXFLAGS += $CXXFLAGS" >> $TEMP_DIR/config.mk |
|
623 fi |
|
624 if [[ ! -z ${LDFLAGS} ]]; then |
|
625 echo "DAV_LDFLAGS += $LDFLAGS" >> $TEMP_DIR/config.mk |
|
626 fi |
|
627 |
|
628 # Target |
|
629 CFLAGS= |
|
630 LDFLAGS= |
|
631 CXXFLAGS= |
|
632 |
|
633 dependency_deptest |
|
634 if [ $? -ne 0 ]; then |
|
635 DEPENDENCIES_FAILED+="deptest " |
|
636 ERROR=1 |
377 ERROR=1 |
637 fi |
378 fi |
638 |
379 |
639 |
380 |
640 echo >> $TEMP_DIR/config.mk |
381 echo >> $TEMP_DIR/config.mk |