[asterisk-dev] Corydon76 Issue Deleted: 0006925, 04-28-06 17:49 Corydon76 Issue Deleted: 0006920

Denis Smirnov ds at seiros.ru
Mon May 1 07:03:48 MST 2006


On Mon, May 01, 2006 at 04:25:24PM +0400, Denis Smirnov wrote:

DS> Ok, I try to write this patch.

Simple concept attached.

-- 
JID: ds at im.seiros.ru
ICQ: 58417635 (please, use jabber, if you can)

http://freesource.info/

-------------- next part --------------
--- cdr/Makefile	(svn)
+++ cdr/Makefile	(working copy)
@@ -49,28 +49,28 @@
 	rm -f *.so *.o
 
 %.so : %.o
-	$(CC) $(SOLINK) -o $@ $<
+	$(CC) $(SOLINK) -o $@ $< -lasterisk
 
 cdr_odbc.so: cdr_odbc.o
-	$(CC) $(SOLINK) -o $@ $< $(ODBC_LIB)
+	$(CC) $(SOLINK) -o $@ $< $(ODBC_LIB) -lasterisk
 
 cdr_odbc.o: cdr_odbc.c
 	$(CC) -c -o $@ $(CFLAGS) $(ODBC_INCLUDE) $<
 
 cdr_tds.so: cdr_tds.o
-	$(CC) $(SOLINK) -o $@ $< $(TDS_LIB)
+	$(CC) $(SOLINK) -o $@ $< $(TDS_LIB) -lasterisk
 
 cdr_tds.o: cdr_tds.c
 	$(CC) -c -o $@ $(CFLAGS) $(TDS_INCLUDE) $<
 
 cdr_pgsql.so: cdr_pgsql.o
-	$(CC) $(SOLINK) -o $@ $< $(PGSQL_LIB)
+	$(CC) $(SOLINK) -o $@ $< $(PGSQL_LIB) -lasterisk
 
 cdr_pgsql.o: cdr_pgsql.c
 	$(CC) -c -o $@ $(CFLAGS) $(PGSQL_INCLUDE) $<
 
 cdr_sqlite.so: cdr_sqlite.o
-	$(CC) $(SOLINK) -o $@ $< $(SQLITE_LIB)
+	$(CC) $(SOLINK) -o $@ $< $(SQLITE_LIB) -lasterisk
 
 cdr_sqlite.o: cdr_sqlite.c
 	$(CC) -c -o $@ $(CFLAGS) $(SQLITE_INCLUDE) $<
--- codecs/Makefile	(svn)
+++ codecs/Makefile	(working copy)
@@ -61,42 +61,42 @@
 	CFLAGS="$(ASTCFLAGS)" $(MAKE) -C ilbc all
 
 codec_ilbc.so: codec_ilbc.o $(LIBILBC)
-	$(CC) $(SOLINK) -o $@ $< $(LIBILBC)
+	$(CC) $(SOLINK) -o $@ $< $(LIBILBC) -lasterisk
 
 codec_g723_1.so : codec_g723_1.o $(LIBG723)
-	$(CC) $(SOLINK) -o $@ $< $(LIBG723)
+	$(CC) $(SOLINK) -o $@ $< $(LIBG723) -lasterisk
 
 codec_g723_1b.o : codec_g723_1.c
-	$(CC) -c -o $@ $(CFLAGS) -DANNEX_B -Dsingle $<
+	$(CC) -c -o $@ $(CFLAGS) -DANNEX_B -Dsingle $< -lasterisk
 
 codec_g723_1b.so : codec_g723_1b.o $(LIBG723B)
-	$(CC) $(SOLINK) -o $@ $< $(LIBG723B) -lm
+	$(CC) $(SOLINK) -o $@ $< $(LIBG723B) -lm -lasterisk
 
 ifeq ($(GSM_LIB),internal)
 codec_gsm.o: codec_gsm.c
 	$(CC) -c -o $@ $(CFLAGS) -Igsm/inc $<
 
 codec_gsm.so: codec_gsm.o gsm/lib/libgsm.a
-	$(CC) $(SOLINK) -o $@ $< gsm/lib/libgsm.a
+	$(CC) $(SOLINK) -o $@ $< gsm/lib/libgsm.a -lasterisk
 else
 codec_gsm.o: codec_gsm.c
 	$(CC) -c -o $@ $(CFLAGS) $(GSM_INCLUDE) $<
 
 codec_gsm.so: codec_gsm.o
-	$(CC) $(SOLINK) -o $@ $< $(GSM_LIB)
+	$(CC) $(SOLINK) -o $@ $< $(GSM_LIB) -lasterisk
 endif
 
 codec_speex.o: codec_speex.c
 	$(CC) -c -o $@ $(CFLAGS) $(SPEEX_INCLUDE) $<
 
 codec_speex.so: codec_speex.o
-	$(CC) $(SOLINK) -o $@ $< $(SPEEX_LIB)
+	$(CC) $(SOLINK) -o $@ $< $(SPEEX_LIB) -lasterisk
 
 codec_lpc10.so: codec_lpc10.o $(LIBLPC10)
-	$(CC) $(SOLINK) -o $@ $< $(LIBLPC10) -lm
+	$(CC) $(SOLINK) -o $@ $< $(LIBLPC10) -lm -lasterisk
 
 %.so : %.o
-	$(CC) $(SOLINK) -o $@ $<
+	$(CC) $(SOLINK) -o $@ $< -lasterisk
 
 ifneq ($(wildcard .depend),)
   include .depend
--- pbx/Makefile	(svn)
+++ pbx/Makefile	(working copy)
@@ -31,27 +31,27 @@
 	$(CC) $(CFLAGS) $(GTK_FLAGS) -c -o $@ $<
 
 pbx_gtkconsole.so: pbx_gtkconsole.o
-	$(CC) $(SOLINK) -o $@ $< $(GTK_LIBS)
+	$(CC) $(SOLINK) -o $@ $< $(GTK_LIBS) -lasterisk
 
 pbx_kdeconsole.o: pbx_kdeconsole.cc pbx_kdeconsole.moc
-	$(CXX) $(CFLAGS) $(KDE_FLAGS) -c -o $@ $<
+	$(CXX) $(CFLAGS) $(KDE_FLAGS) -c -o $@ $< -lasterisk
 
 pbx_kdeconsole_main.o: pbx_kdeconsole_main.cc pbx_kdeconsole.h
-	$(CXX) $(CFLAGS) $(KDE_FLAGS) -c -o $@ $<
+	$(CXX) $(CFLAGS) $(KDE_FLAGS) -c -o $@ $< -lasterisk
 
 pbx_kdeconsole.so: $(KDE_CONSOLE_OBJS)
-	$(CC) $(SOLINK) -o $@ $(KDE_CONSOLE_OBJS) $(KDE_LIBS)
+	$(CC) $(SOLINK) -o $@ $(KDE_CONSOLE_OBJS) $(KDE_LIBS) -lasterisk
 
 pbx_dundi.so: pbx_dundi.o dundi-parser.o
-	$(CC) $(SOLINK) -o $@ $< dundi-parser.o $(Z_LIB)
+	$(CC) $(SOLINK) -o $@ $< dundi-parser.o $(Z_LIB) -lasterisk
 
 pbx_dundi.o: pbx_dundi.c
-	$(CC) -c -o $@ $(CFLAGS) $(Z_INCLUDE) $<
+	$(CC) -c -o $@ $(CFLAGS) $(Z_INCLUDE) $< -lasterisk
 
 pbx_ael.o: ael/aelflex.o ael/aelbison.o ../include/asterisk/ael_structs.h
 
 pbx_ael.so: pbx_ael.o ael/aelbison.o ael/aelflex.o
-	$(CC) $(SOLINK) -o $@ pbx_ael.o ael/aelbison.o ael/aelflex.o
+	$(CC) $(SOLINK) -o $@ pbx_ael.o ael/aelbison.o ael/aelflex.o -lasterisk
 
 ael/aelflex.o: ael/ael_lex.c ../include/asterisk/ael_structs.h ael/ael.tab.h
 	$(CC) $(CFLAGS) -I. -c -o ael/aelflex.o ael/ael_lex.c
@@ -69,7 +69,7 @@
 	$(MOC) $< -o $@
 
 %.so : %.o
-	$(CC) $(SOLINK) -o $@ $<
+	$(CC) $(SOLINK) -o $@ $< -lasterisk
 
 ifneq ($(wildcard .depend),)
   include .depend
--- formats/Makefile	(svn)
+++ formats/Makefile	(working copy)
@@ -24,14 +24,14 @@
 	rm -f *.so *.o
 
 %.so : %.o
-	$(CC) $(SOLINK) -o $@ $<
+	$(CC) $(SOLINK) -o $@ $< -lasterisk
 
 ifneq ($(wildcard .depend),)
   include .depend
 endif
 
 format_ogg_vorbis.so : format_ogg_vorbis.o
-	$(CC) $(SOLINK) -o $@ $< $(OGG_LIB) $(VORBIS_LIB)
+	$(CC) $(SOLINK) -o $@ $< $(OGG_LIB) $(VORBIS_LIB) -lasterisk
 
 format_ogg_vorbis.o: format_ogg_vorbis.c
 	$(CC) -c -o $@ $(CFLAGS) $(OGG_INCLUDE) $(VORBIS_INCLUDE) $<
--- channels/Makefile	(svn)
+++ channels/Makefile	(working copy)
@@ -76,7 +76,7 @@
 	rm -f busy.h ringtone.h gentone gentone-ulaw
 
 %.so : %.o
-	$(CC) $(SOLINK) -o $@ $<
+	$(CC) $(SOLINK) -o $@ $< -lasterisk
 
 ifneq ($(wildcard .depend),)
   include .depend
@@ -106,48 +106,48 @@
 	$(CC) -c -o $@ $(CFLAGS) $(OSSAUDIO_INCLUDE) $<
 
 chan_oss.so: chan_oss.o
-	$(CC) $(SOLINK) -o $@ chan_oss.o $(OSSAUDIO_LIB)
+	$(CC) $(SOLINK) -o $@ chan_oss.o $(OSSAUDIO_LIB) -lasterisk
 
 chan_iax2.so: chan_iax2.o iax2-parser.o iax2-provision.o
-	$(CC) $(SOLINK) -o $@ $< iax2-parser.o iax2-provision.o
+	$(CC) $(SOLINK) -o $@ $< iax2-parser.o iax2-provision.o -lasterisk
 
 chan_zap.so: chan_zap.o
-	$(CC) $(SOLINK) -o $@ $< $(PRI_LIB) $(ZAPTEL_LIB)
+	$(CC) $(SOLINK) -o $@ $< $(PRI_LIB) $(ZAPTEL_LIB) -lasterisk
 
 chan_zap.o: chan_zap.c
-	$(CC) -c -o $@ $(CFLAGS) $(ZAPTEL_INCLUDE) $<
+	$(CC) -c -o $@ $(CFLAGS) $(ZAPTEL_INCLUDE) $< -lasterisk
 
 chan_alsa.so: chan_alsa.o
-	$(CC) $(SOLINK) -o $@ $< $(ASOUND_LIB)
+	$(CC) $(SOLINK) -o $@ $< $(ASOUND_LIB) -lasterisk
 
 chan_alsa.o: chan_alsa.c busy.h ringtone.h
-	$(CC) -c -o $@ $(CFLAGS) $(ASOUND_INCLUDE) $<
+	$(CC) -c -o $@ $(CFLAGS) $(ASOUND_INCLUDE) $< -lasterisk
 
 chan_nbs.so: chan_nbs.o
-	$(CC) $(SOLINK) -o $@ $< $(NBS_LIB)
+	$(CC) $(SOLINK) -o $@ $< $(NBS_LIB) -lasterisk
 
 chan_nbs.o: chan_nbs.c
-	$(CC) -c -o $@ $(CFLAGS) $(NBS_INCLUDE) $<
+	$(CC) -c -o $@ $(CFLAGS) $(NBS_INCLUDE) $< -lasterisk
 
 chan_vpb.o: chan_vpb.c
-	$(CXX) -c $(CFLAGS:-Werror=) -o $@ chan_vpb.c
+	$(CXX) -c $(CFLAGS:-Werror=) -o $@ chan_vpb.c -lasterisk
 
 chan_vpb.so: chan_vpb.o
-	 $(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
+	 $(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl -lasterisk
 
 ifeq ($(OSARCH),Linux)
 chan_h323.so: chan_h323.o h323/libchanh323.a h323/Makefile.ast
-	$(CC) $(SOLINK) $(H323LDFLAGS) -o $@ $< h323/libchanh323.a $(H323LDLIBS) -lstdc++
+	$(CC) $(SOLINK) $(H323LDFLAGS) -o $@ $< h323/libchanh323.a $(H323LDLIBS) -lstdc++ -lasterisk
 else
 chan_h323.so: chan_h323.o h323/libchanh323.a
-	$(CC) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat
+	$(CC) $(SOLINK) -o $@ $< h323/libchanh323.a $(CHANH323LIB) -L$(PWLIBDIR)/lib $(PTLIB) -L$(OPENH323DIR)/lib $(H323LIB) -L/usr/lib -lcrypto -lssl -lexpat -lasterisk
 endif
 
 misdn/chan_misdn_lib.a:
 	make -C misdn
 
 chan_misdn.so: chan_misdn.o misdn_config.o misdn/chan_misdn_lib.a
-	$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN
+	$(CC) -shared -Xlinker -x -L/usr/lib -o $@ $^ -lisdnnet -lmISDN -lasterisk
 
 chan_misdn.o: chan_misdn.c
 	$(CC) $(CFLAGS) -DCHAN_MISDN_VERSION=\"0.3.0\" -c $< -o $@
--- apps/Makefile	(svn)
+++ apps/Makefile	(working copy)
@@ -35,10 +35,10 @@
 	rm -f *.so *.o
 
 %.so: %.o
-	$(CC) $(SOLINK) -o $@ $<
+	$(CC) $(SOLINK) -o $@ $< -lasterisk
 
 app_rpt.so: app_rpt.o
-	$(CC) $(SOLINK) -o $@ $< $(ZAPTEL_LIB)
+	$(CC) $(SOLINK) -o $@ $< -lasterisk $(ZAPTEL_LIB)
 
 app_rpt.o: app_rpt.c
 	$(CC) -c -o $@ $(CFLAGS) $(ZAPTEL_INCLUDE) $<
@@ -53,7 +53,7 @@
 
 ifeq (SunOS,$(shell uname))
 app_chanspy.so: app_chanspy.o
-	$(CC) $(SOLINK) -o $@ $< -lrt
+	$(CC) $(SOLINK) -o $@ $< -lrt -lasterisk
 endif
 
 ifneq ($(wildcard .depend),)
--- Makefile	(svn)
+++ Makefile	(working copy)
@@ -254,6 +254,7 @@
 
 ASTCFLAGS+=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) #-DMAKE_VALGRIND_HAPPY
 ASTCFLAGS+=$(OPTIMIZE)
+LIBS+=-lasterisk
 
 ifeq ($(AST_DEVMODE),yes)
   ASTCFLAGS+=-Werror -Wunused
@@ -262,7 +263,6 @@
 ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
 ASTCFLAGS+= -Wno-pointer-sign
 endif
-ASTOBJ=-o asterisk
 
 ifeq ($(findstring BSD,$(OSARCH)),BSD)
   ASTCFLAGS+=-I$(CROSS_COMPILE_TARGET)/usr/local/include -L$(CROSS_COMPILE_TARGET)/usr/local/lib
@@ -302,6 +302,7 @@
 endif
 
 LIBEDIT=editline/libedit.a
+LIBDB1=db1-ast/libdb1.a
 
 ASTERISKVERSION:=$(shell build_tools/make_version .)
 
@@ -335,9 +336,9 @@
 MOD_SUBDIRS=res channels pbx apps codecs formats cdr funcs
 SUBDIRS:=$(MOD_SUBDIRS) utils stdtime agi
 
-OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
+OBJS=io.o sched.o logger.o loader.o config.o \
 	translate.o file.o pbx.o cli.o md5.o term.o \
-	ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
+	callerid.o fskmodem.o image.o app.o \
 	cdr.o tdd.o acl.o rtp.o udptl.o manager.o asterisk.o \
 	dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
 	astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
@@ -354,6 +355,8 @@
 # by a module.
 OBJS+= say.o
 
+LIBASTERISK_OBJS:=ulaw.o alaw.o channel.o frame.o
+
 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/sys/poll.h),)
   OBJS+= poll.o
   ASTCFLAGS+=-DPOLLCOMPAT
@@ -384,7 +387,7 @@
 else
 # These are used for all but Darwin
   ASTLINK=-Wl,-E 
-  SOLINK=-shared -Xlinker -x
+  SOLINK=-shared -Xlinker -x -Wl,--rpath=/usr/lib/asterisk -L${PWD}
   ifeq ($(findstring BSD,$(OSARCH)),BSD)
     SOLINK+=-L$(CROSS_COMPILE_TARGET)/usr/local/lib
   endif
@@ -530,14 +533,14 @@
 stdtime/libtime.a:
 	CFLAGS="$(ASTCFLAGS) $(MOD_SUBDIR_CFLAGS)" $(MAKE) -C stdtime libtime.a
 
-asterisk: editline/libedit.a db1-ast/libdb1.a stdtime/libtime.a $(OBJS)
+asterisk: ${LIBEDIT} stdtime/libtime.a db1-ast/libdb1.a libasterisk.so ${OBJS}
 	build_tools/make_build_h > include/asterisk/build.h.tmp
 	if cmp -s include/asterisk/build.h.tmp include/asterisk/build.h ; then echo ; else \
 		mv include/asterisk/build.h.tmp include/asterisk/build.h ; \
 	fi
 	rm -f include/asterisk/build.h.tmp
 	$(CC) -c -o buildinfo.o $(CFLAGS) buildinfo.c
-	$(CC) $(DEBUG) $(ASTOBJ) $(ASTLINK) $(OBJS) buildinfo.o $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
+	$(CC) $(DEBUG) -o asterisk $(ASTLINK) $(OBJS) buildinfo.o -Wl,--rpath-link=/usr/lib/asterisk -lasterisk $(LIBEDIT) db1-ast/libdb1.a stdtime/libtime.a $(LIBS)
 
 muted: muted.o
 	$(CC) $(AUDIO_LIBS) -o muted muted.o
@@ -673,6 +676,7 @@
 	mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/tmp
 	mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/meetme
 	mkdir -p $(DESTDIR)$(ASTSPOOLDIR)/monitor
+	if [ -f libasterisk.so ]; then $(INSTALL) -m 755 libasterisk.so $(DESTDIR)/usr/lib/asterisk/; fi
 	if [ -f asterisk ]; then $(INSTALL) -m 755 asterisk $(DESTDIR)$(ASTSBINDIR)/; fi
 	if [ -f asterisk.dll ]; then $(INSTALL) -m 755 asterisk.dll $(DESTDIR)$(ASTSBINDIR)/; fi
 	ln -sf asterisk $(DESTDIR)$(ASTSBINDIR)/rasterisk
@@ -978,6 +982,9 @@
 	rm -rf $(DESTDIR)$(ASTETCDIR)
 	rm -rf $(DESTDIR)$(ASTLOGDIR)
 
+libasterisk.so: $(LIBASTERISK_OBJS) stdtime/libtime.a $(LIBEDIT) $(LIBDB1)
+	$(CC) -shared -Wl,--rpath-link=/usr/lib/asterisk -o libasterisk.so ${LIBASTERISK_OBJS} stdtime/libtime.a $(LIBDB1) $(LIBEDIT)
+
 menuselect: build_tools/menuselect makeopts.xml
 	- at build_tools/menuselect ${GLOBAL_MAKEOPTS} ${USER_MAKEOPTS} menuselect.makeopts && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!"
 


More information about the asterisk-dev mailing list