On Mar 22, 2006, at 14:08 , Nick Sharp wrote:

> This concerns compiling rrdtool on one Linux machine for  
> distribution to other very similar
> machines.  I have spent most of my time on Windows, and only picked  
> up Linux about a year ago, so my
> biggest culture shock has been installing third party items.   
> No .exe wizard inside a .zip any more;
> you have to download the source and compile it mate!
>
> I wrote and manage a LAMP+R application which monitors an  
> international IP VPN network.  The
> L=Fedora Core 4 Linux, the P=Perl, and of course the +R=rrdtool.   
> (New to the LAMP acronym?
> A=Apache web server and M=MySQL database).
>
> Yesterday, on two test i386 laptops, I loaded the very recent  
> Fedora Core 5 final release (fc5fr).
> On one machine, with development tools and libraries, I used all  
> the relevant bash lines from:
>
> http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/doc/ 
> rrdbuild.en.html
>
> to download and compile rrdtool, which ran OK, and then did a  
> cursory test by successfully running
> one of the examples.
>
> I then used archive manager to make a .tar.gz tarball of the file  
> system from
> /usr/local/rrdtool-1.12.2 downwards (just 2.5Mbyte).
>
> I then extracted that at /usr/local/ on the second machine, which  
> deliberately lacked the
> development tools and libraries.  The example worked OK on that  
> machine.
>
> I thus feel confident that when I get fc5fr put on the  
> application's test machine, I can just add
> the tarball, make sure that my Perl program knows where to find  
> RRDs.pm:
>
> use lib qw(/usr/local/rrdtool-1.2.12/lib/perl/5.8.8/i386-linux- 
> thread-multi);
>
> and then expect the program to run without further effort (once I  
> have done all the Apache and MySQL
> initialisations of course).
>
> Do you think it will happen?

If you are going from the same OS to the same OS then yes it will  
work and I use this method to generate builds for a particular OS  
major version which works within the Major version regardless of the  
minor version provided that there are no significant core changes.

As a rule of thumb, I do my install the following way.

mkdir /RRDTool_Linux5 /Distro_Archives
make DESTDIR= install/RRDTool_Linux5

Then I can see what files are installed, where they are installed and  
then tar the packagewith the following:

( cd /RRDTool_Linux5/usr/local/ && tar czf /Distro_Archives/ 
rrdtool_linux5.tar.gz . | ( cd /usr/local && tar xzf /Distro_Archives/ 
rrdtool_linux5.tar.gz ) )

Another thing that helps is I make some GNU Makefile's with the  
commands I used to build the package which includes a curl command to  
download the source packages, apply and the source dependancies  
packages, apply any patches so I can simplify the build process and  
make it easier to duplicate in other OS's.

> Regards and thanks
> -- 
> Nick Sharp

Here's an example of such a Makefile ( it should work for you as is  
and give you some ideas how to generate similar, the rrdtool data is  
also at the bottom ).


##
# Makefile for the automated build of the ClamAV/gmp/mpfr software
#
# Written by Dale Walsh
##

PKG_NAME=ClamAV

BASE_DIR=$(shell pwd)
TAR_DIR=$(BASE_DIR)/tardir
PATCH_DIR=$(BASE_DIR)/patches
DIST_DIR=$(BASE_DIR)/DIST
INST_DIR=/usr/local
RRDTOOL_INST_DIR=$(INST_DIR)/rrdtool

ifndef SRCROOT
SRCROOT=$(BASE_DIR)/srcroot
endif

ifndef DSTROOT
DSTROOT=$(BASE_DIR)/$(PKG_NAME).root
endif

GLOBAL_INCFLAGS=-I$(INST_DIR)/include

# ------------------------------
# DONOT CHANGE BELOW THIS LINE
# ------------------------------

btxt=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }'  
</dev/null 2>/dev/null`
ntxt=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' </dev/ 
null 2>/dev/null`
white_blk=`echo -e "\e[37;40m" </dev/null 2>/dev/null`
white_red=`echo -e "\e[37;41m" </dev/null 2>/dev/null`


COMMON_CONFIG_FLAGS="--prefix=$(INST_DIR)"
GLOBAL_LINKFLAGS="-L$(INST_DIR)/lib"

ifndef LD_ENV
LD_ENV=MACOSX_DEPLOYMENT_TARGET=10.2
endif

all : header_msg install

install : unpack clamav-install

settings : header_msg

        @echo -e " current setting:"
        @echo

        @echo -e " $(btxt)COMMON_CONFIG_FLAGS$(ntxt)  = \"$ 
(COMMON_CONFIG_FLAGS)\""
        @echo -e " $(btxt)GLOBAL_LINKFLAGS$(ntxt)     = \"$(GLOBAL_LINKFLAGS) 
\""
        @echo -e " $(btxt)GLOBAL_INCFLAGS$(ntxt)      = \"$(INST_DIR)/include 
\""
        @echo -e " $(btxt)LD_ENV$(ntxt)               = $(LD_ENV)"

        @echo
        @echo -e " $(btxt)BASE_DIR$(ntxt)             = $(BASE_DIR)"
        @echo -e " $(btxt)TAR_DIR$(ntxt)              = $(TAR_DIR)"

        @echo
        @echo -e " $(btxt)INST_DIR$(ntxt)             = $(INST_DIR)"
        @echo -e " $(btxt)SRCROOT$(ntxt)              = $(SRCROOT)"
        @echo -e " $(btxt)OBJROOT$(ntxt)              = $(OBJROOT)"
        @echo -e " $(btxt)SYMROOT$(ntxt)              = $(SYMROOT)"
        @echo -e " $(btxt)DSTROOT$(ntxt)              = $(DSTROOT)"
        @echo -e " $(btxt)RC_ARCHS$(ntxt)             = $(RC_ARCHS)"
        @echo -e " $(btxt)CFLAGS$(ntxt)               = $(CFLAGS)"
        @echo -e " $(btxt)CPAN_BUILD_DIR$(ntxt)       = $(CPAN_BUILD_DIR)"

        @echo

header_msg : $(DSTROOT)
        @clear
        @echo "$ 
{white_blk}                                                              
          "
        @echo "   
+----------------------------------------------------------------+  "
        @echo "   
|                                                                |  "
        @echo "  |               ${white_red} Building amavsd-new/ClamAV/ 
gmp/ ${white_blk}                |  "
        @echo "   
|                                                                |  "
        @echo "  |                Your automated Clam/AV  
generator                |  "
        @echo "  |                         Version  
1.0.2                          |  "
        @echo "  |     (c) 2006 Dale R. Walsh  
<[EMAIL PROTECTED]>     |  "
        @echo "   
|                                                                |  "
        @echo "   
+----------------------------------------------------------------+  "
        @echo  
"                                                                      $ 
{ntxt}"
        @echo -en "\nOne moment...."
        @sleep 1
        @echo -en "\b\b\b\b\b\b\b\b\b\b\b\b\b\b               \b\b\b\b\b\b\b 
\b\b\b\b\b\b\b\b"



CLAMAV_CONFIG = \
         $(COMMON_CONFIG_FLAGS) \
        --sysconfdir=/private/etc/spam/clamav \
        --with-user=clamav \
        --with-group=clamav \
        --with-dbdir=/var/clamav \
        --with-datadir=/var/clamav \
        --with-zlib=$(INST_DIR) \
        --enable-bigstack \
        --enable-readdir_r \
        --enable-shared \
        --enable-static \
        CPPFLAGS="$(GLOBAL_INCFLAGS)" \
        LDFLAGS="$(GLOBAL_LINKFLAGS)"

# clamav --------------------------------

clamav-install : NAME=clamav
clamav-install : clamav
        @cd $(SRCROOT)/$(NAME)*/ && $(MAKE) DESTDIR=$(DSTROOT) install
        @cd $(SRCROOT)/$(NAME)*/ && $(MAKE) install

clamav :  NAME=clamav
clamav : header_msg
        @echo -e "\nProcessing $(btxt)$(NAME)$(ntxt).\n"
        @if [ ! -f $(SRCROOT)/$(NAME)*/Makefile ]; then cd $(SRCROOT)/$(NAME) 
*/ && $(LD_ENV) \
        ./configure  $(CLAMAV_CONFIG); fi
        @cd $(SRCROOT)/$(NAME)*/ && $(LD_ENV) $(MAKE)


# clean-up --------------------------------

clean-up : NAME="Cleaning up"
clean-up :
        @echo -en "\n$(btxt)$(NAME)$(ntxt) ...\n"
        @cd / && if test -d man; then tar cf - man | (cd /usr && tar xf -);  
rm -rf /man; fi
        @cd / && if test -d share; then tar cf - share | (cd /usr/share &&  
tar xf -); rm -rf /share; fi
        @cd $(DSTROOT) && if test -d etc; then tar cf - etc | (cd $(DSTROOT)/ 
private && tar xf -); rm -rf $(DSTROOT)/etc; fi
        @cd $(DSTROOT) && if test -d man; then tar cf - man | (cd $(DSTROOT)/ 
usr && tar xf -); rm -rf $(DSTROOT)/man; fi
        @cd $(DSTROOT) && if test -d share; then tar cf - share | (cd $ 
(DSTROOT)/usr && tar xf -); rm -rf $(DSTROOT)/share; fi
        @echo -e "done\n"


# cleaning --------------------------------

tar-clean : NAME=tar-clean
tar-clean : header_msg
        @echo -e "\nProcessing $(btxt)$(NAME)$(ntxt).\n"
        @if [ -d $(TAR_DIR) ]; then rm -r -f $(TAR_DIR)/*; fi

src-clean :
        @rm -rf $(SRCROOT)/*
        @rm -rf $(SRCROOT)/.patched
        @if [ -d $(DSTROOT) ];then rm -r -f $(DSTROOT)/*; fi
        @if [ -f $(DIST_DIR)/Info.plist ];then rm -r -f $(DIST_DIR)/ 
Info.plist; fi
        @if [ -f $(DIST_DIR)/Description.plist ];then rm -r -f $(DIST_DIR)/ 
Description.plist; fi



# Archives --------------------------------

dl-files: header_msg
        @mkdir -p $(TAR_DIR)
        @mkdir -p $(SRCROOT)
        @# get the latest version of ClamAV
        @echo -en "\n\a$(btxt)Downlaoding src files:$(ntxt) ClamAV   "
        @if [ ! -f $(TAR_DIR)/clamav-`curl -s http://www.clamav.net| egrep  
is: | cut -d: -f2 | cut -d">" -f2 | cut -d"<" -f1 | \
        xargs -n 1 echo`.tar.gz ]; then cd $(TAR_DIR) && rm -rf clam*gz && \
        curl -fsOL http://easynews.dl.sourceforge.net/sourceforge/clamav/ 
clamav-`curl -s http://www.clamav.net| egrep is: | cut -d: -f2 | cut - 
d">" -f2 | cut -d"<" -f1 | xargs -n 1 echo`.tar.gz; fi
        @echo -e "\b\b\b\b\b\b\b\b\b$(btxt)Download Complete$(ntxt)\n"


unpack : header_msg src-clean dl-files $(AMAVISD_DIR)
        @mkdir -p $(SRCROOT)
        @echo -en "\n\a$(btxt)Unpacking source files$(ntxt) [.]\b\b"
        @if [ ! -d $(SRCROOT)/clamav-* ]; then cd $(SRCROOT) && tar -xzf $ 
(TAR_DIR)/clamav-`curl -s http://www.clamav.net| egrep is: | cut -d: - 
f2 | cut -d">" -f2 | cut -d"<" -f1 | xargs -n 1 echo`.tar.gz; fi
        @echo -e ".] $(btxt)Done$(ntxt)\a.\n"
        @echo -e "\n$(btxt)Patching source files$(ntxt)\n"

        @# ONLY NEEDED FOR MAC OS
ifdef MACOSX
        @if [ ! -f $(SRCROOT)/.patched ]; then \
        echo -e "$(btxt)ClamAV-`curl -s http://www.clamav.net| egrep is: |  
cut -d: -f2 | cut -d">" -f2 | cut -d"<" -f1 | xargs -n 1 echo`$ 
(ntxt):"; \
        cd $(SRCROOT)/clamav* && rm -r -f etc/*.conf && patch -p1 < $ 
(PATCH_DIR)/clamav.patch; echo "Fixing ClamAV";  
LIBTOOLIZE=glibtoolize autoreconf --warnings=none -i -f </dev/null >/ 
dev/null; \
        fi
endif

        @if [ ! -f $(SRCROOT)/.patched ]; then \
        echo -e "$(btxt)Source Tree$(ntxt):\nRemoving .cvsignore files"; \
        find $(SRCROOT)/ -name .cvsignore  -print0 | xargs -0 -n 1 rm -rf &&  
echo -e "Removing CVS files" && find $(SRCROOT)/ -name .CVS  -print0  
| xargs -0 -n 1 rm -rf; \
        touch $(SRCROOT)/.patched; fi
        @echo -e "$(btxt)Done$(ntxt)\a.\n\n"

.PHONY: dl-files unpack clamav-install install

$(DSTROOT) :
        @mkdir -p $@

# end of file ----------------------------


to build this for Mac OSX I issue:

make MACOSX=1

sit back and wait for it to finish.






For RRDTool -1.0.49 I use the following: (I build for both PowerPC  
and Intel architecture)


RRDTOOL_CONFIG = \
        $(COMMON_CONFIG_FLAGS)/rrdtool-1.0.49 \
        --mandir=/usr/share/man \
        --disable-shared \
        --enable-static \
        --enable-perl-site-install \
        --enable-local-zlib \
        --enable-local-libpng \
        --with-perl-options="CC=\"gcc-3.3 -arch ppc -arch i386\" \
        INSTALLDIRS=site \
        INSTALLSITEARCH=/System/Library/Perl/5.8.7/darwin-thread-multi-2level \
        INSTALLSITELIB=/System/Library/Perl/5.8.7 \
        PREFIX=/ \
        INSTALLSITEBIN=/usr/local/bin \
        INSTALLSCRIPT=/usr/local/bin \
        INSTALLSITEMAN1DIR=/usr/share/man/man1 \
        INSTALLSITEMAN3DIR=/usr/share/man/man3" ; \
        # remember to edit the .packlist file


rrdtool : NAME="rrdtool"
rrdtool : header_msg
        @echo -e "\nProcessing $(btxt)$(NAME)$(ntxt).\n"
        @if [ ! -f $(SRCROOT)/$(NAME)*/Makefile ]; then cd $(SRCROOT)/$(NAME) 
*/ && $(LD_ENV) \
        ./configure  $(RRDTOOL_CONFIG); fi
        @cd $(SRCROOT)/$(NAME)*/ && make

rrdtool-install : NAME="rrdtool"
rrdtool-install : rrdtool
        @cd $(SRCROOT)/$(NAME)*/ && make DESTDIR=$(DSTROOT) install
        @echo -e "\n$(btxt)Remember to edit the \".packlist\" file$(ntxt).\n"
        @cd $(SRCROOT)/$(NAME)*/ && make DESTDIR=$(DSTROOT) site-perl-install


-- Dale

--
Unsubscribe mailto:[EMAIL PROTECTED]
Help        mailto:[EMAIL PROTECTED]
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi

Reply via email to