VPATH problems with samba-1.9.18p8
Bill Campbell
bill at celestial.com
Wed Aug 5 18:33:45 GMT 1998
The following diffs fix some problems I've found compiling samba-1.9.18p8
in a directory other than the source directory. This includes fixes the
the Makefile as well as a couple of the install.*sh scripts which didn't
recognize the SRCDIR setting and attempted to copy files from the current
directory.
The changes to the Makefile include:
1. Make the appropriate subdirectories for object files.
2. Fix the -o option the rule to make objects removing $(srcdir)
3. Add the $(srcdir) argument to installscripts.sh and installcp.sh
which they need for their source files.
My changes to installscripts.sh and installcp.sh include some things that
others may not want to use as we use ginstall modified to install relative
to the ROOT environment variable (actually I have rewritten gnu-install in
perl to use rsync to update the objects preserving the timestamps and
allowing more efficient installs across a network).
diff -ur /home/tmp/samba-1.9.18p8.orig/source/Makefile ./source/Makefile
--- /home/tmp/samba-1.9.18p8.orig/source/Makefile Sun May 31 23:29:04 1998
+++ ./source/Makefile Wed Aug 5 11:23:44 1998
@@ -742,6 +742,11 @@
all : CHECK $(SPROGS) $(PROGS)
CHECK :
+ # this is necessary if VPATH is set to insure that the appropriate
+ # subdirectories are present for object files.
+ -[ -d mem_man ] || mkdir mem_man
+ -[ -d ubiqx ] || mkdir ubiqx
+ -[ -d rpc_pipes ] || mkdir rpc_pipes
@$(SHELL) $(srcdir)checkos.sh $(FLAGSM)
@echo "Using CFLAGS = $(CFLAGS)"
@echo "Using LIBS = $(LIBS)"
@@ -751,7 +756,7 @@
.c.o: $(INCLUDES)
@echo Compiling $*.c
- @$(CC) $(CFLAGS) -c $(srcdir)$*.c -o $(srcdir)$*.o
+ @$(CC) $(CFLAGS) -c $(srcdir)$*.c -o $*.o
smbd: $(SMBDOBJ) $(ARCFOUR_OBJ)
@echo Linking smbd
@@ -828,10 +833,12 @@
@$(SHELL) $(srcdir)installbin.sh $(INSTALLPERMS) $(BASEDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(PROGS)
installscripts:
- @$(SHELL) $(srcdir)installscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS)
+ $(SHELL) $(srcdir)installscripts.sh \
+ $(INSTALLPERMS) $(BINDIR) $(srcdir) $(SCRIPTS)
installcp:
- @$(SHELL) $(srcdir)installcp.sh $(LIBDIR) $(CODEPAGEDIR) $(BINDIR) $(CODEPAGELIST)
+ @$(SHELL) $(srcdir)installcp.sh \
+ $(LIBDIR) $(CODEPAGEDIR) $(BINDIR) $(srcdir) $(CODEPAGELIST)
# revert to the previously installed version
revert:
diff -ur /home/tmp/samba-1.9.18p8.orig/source/installbin.sh ./source/installbin.sh
--- /home/tmp/samba-1.9.18p8.orig/source/installbin.sh Thu Jul 4 20:51:27 1996
+++ ./source/installbin.sh Wed Aug 5 10:12:09 1998
@@ -11,10 +11,10 @@
shift
for d in $BASEDIR $BINDIR $LIBDIR $VARDIR; do
-if [ ! -d $d ]; then
-mkdir $d
-if [ ! -d $d ]; then
- echo Failed to make directory $d
+if [ ! -d $ROOT$d ]; then
+ginstall -d $d
+if [ ! -d $ROOT$d ]; then
+ echo Failed to make directory $ROOT$d
exit 1
fi
fi
@@ -22,12 +22,11 @@
for p in $*; do
- echo Installing $p as $BINDIR/$p
- if [ -f $BINDIR/$p ]; then
- mv $BINDIR/$p $BINDIR/$p.old
+ echo Installing $p as $ROOT$BINDIR/$p
+ if [ -f $ROOT$BINDIR/$p ]; then
+ mv $ROOT$BINDIR/$p $ROOT$BINDIR/$p.old
fi
- cp $p $BINDIR/$p
- chmod $INSTALLPERMS $BINDIR/$p
+ ginstall -m $INSTALLPERMS $p $BINDIR/$p
done
diff -ur /home/tmp/samba-1.9.18p8.orig/source/installcp.sh ./source/installcp.sh
--- /home/tmp/samba-1.9.18p8.orig/source/installcp.sh Mon Dec 1 07:21:23 1997
+++ ./source/installcp.sh Wed Aug 5 10:36:20 1998
@@ -2,25 +2,27 @@
LIBDIR=$1
CODEPAGEDIR=$2
BINDIR=$3
+SRCDIR=$4
shift
shift
shift
+shift
echo Installing codepage files in $CODEPAGEDIR
for d in $LIBDIR $CODEPAGEDIR; do
-if [ ! -d $d ]; then
-mkdir $d
-if [ ! -d $d ]; then
- echo Failed to make directory $d
+if [ ! -d $ROOT$d ]; then
+ginstall -d $d
+if [ ! -d $ROOT$d ]; then
+ echo Failed to make directory $ROOT$d
exit 1
fi
fi
done
for p in $*; do
- echo Creating codepage file $CODEPAGEDIR/codepage.$p from codepage_def.$p
- $BINDIR/make_smbcodepage c $p codepage_def.$p $CODEPAGEDIR/codepage.$p
+ echo Creating codepage file $ROOT$CODEPAGEDIR/codepage.$p from codepage_def.$p
+ $BINDIR/make_smbcodepage c $p ${SRCDIR}codepage_def.$p $ROOT$CODEPAGEDIR/codepage.$p
done
diff -ur /home/tmp/samba-1.9.18p8.orig/source/installman.sh ./source/installman.sh
--- /home/tmp/samba-1.9.18p8.orig/source/installman.sh Thu Jul 4 20:51:27 1996
+++ ./source/installman.sh Wed Aug 5 10:14:36 1998
@@ -7,10 +7,10 @@
echo Installing man pages in $MANDIR
for d in $MANDIR $MANDIR/man1 $MANDIR/man5 $MANDIR/man7 $MANDIR/man8; do
-if [ ! -d $d ]; then
-mkdir $d
-if [ ! -d $d ]; then
- echo Failed to make directory $d, does $USER have privileges?
+if [ ! -d $ROOT$d ]; then
+ginstall $d
+if [ ! -d $ROOT$d ]; then
+ echo Failed to make directory $ROOT$d, does $USER have privileges?
exit 1
fi
fi
@@ -20,8 +20,7 @@
for m in $MANDIR/man$sect ; do
for s in $SRCDIR../docs/*$sect; do
FNAME=$m/`basename $s`
- cp $s $m || echo Cannot create $FNAME... does $USER have privileges?
- chmod 0644 $FNAME
+ ginstall -m 0644 $s $m || echo Cannot create $FNAME... does $USER have privileges?
done
done
done
diff -ur /home/tmp/samba-1.9.18p8.orig/source/installscripts.sh ./source/installscripts.sh
--- /home/tmp/samba-1.9.18p8.orig/source/installscripts.sh Fri Aug 16 06:09:59 1996
+++ ./source/installscripts.sh Wed Aug 5 10:36:08 1998
@@ -4,17 +4,19 @@
INSTALLPERMS=$1
BINDIR=$2
+SRCDIR=$3
shift
shift
+shift
echo Installing scripts in $BINDIR
for d in $BINDIR; do
- if [ ! -d $d ]; then
- mkdir $d
- if [ ! -d $d ]; then
- echo Failed to make directory $d
+ if [ ! -d $ROOT$d ]; then
+ ginstall $d
+ if [ ! -d $ROOT$d ]; then
+ echo Failed to make directory $ROOT$d
echo Have you run installbin first?
exit 1
fi
@@ -22,13 +24,13 @@
done
for p in $*; do
- echo Installing $BINDIR/$p
- cp $p $BINDIR/$p
- if [ ! -f $BINDIR/$p ]; then
- echo Cannot copy $p... does $USER have privileges?
+ echo Installing $ROOT$BINDIR/$p
+ ginstall -m $INSTALLPERMS $SRCDIR$p $BINDIR/$p
+ if [ ! -f $ROOT$BINDIR/$p ]; then
+ echo Cannot copy $SRCDIR$p... does $USER have privileges?
fi
- echo Setting permissions on $BINDIR/$p
- chmod $INSTALLPERMS $BINDIR/$p
+ # echo Setting permissions on $BINDIR/$p
+ # chmod $INSTALLPERMS $BINDIR/$p
done
cat << EOF
--
Bill
--
INTERNET: bill at Celestial.COM Bill Campbell; Celestial Systems, Inc.
UUCP: camco!bill PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/
It is practically impossible to teach good programming style to
students that have had prior exposure to BASIC: as potential
programmers they are mentally mutilated beyond hope of
regeneration.
-- Dijkstra
More information about the samba
mailing list