Ticket #391: solaris.diffs

File solaris.diffs, 6.8 KB (added by harlan+opendarwinbugs@…, 22 years ago)

PAtches to get "base" working under solaris.

Line 
1Index: proj/darwinports/base/doc/Makefile
2===================================================================
3RCS file: /Volumes/src/cvs/od/proj/darwinports/base/doc/Makefile,v
4retrieving revision 1.28
5diff -u -r1.28 Makefile
6--- proj/darwinports/base/doc/Makefile  1 Mar 2003 01:57:50 -0000       1.28
7+++ proj/darwinports/base/doc/Makefile  12 Mar 2003 03:55:28 -0000
8@@ -13,14 +13,12 @@
9 install:
10        mkdir -p ${DESTDIR}${ETCDIR}
11        mkdir -p ${INSTALLDIR}
12-       
13-       @if [ ! -e ${DESTDIR}/${ETCDIR}/ports.conf ]; then \
14+       @if /bin/test ! -e ${DESTDIR}/${ETCDIR}/ports.conf ; then \
15                set -x; \
16                install -o ${DSTUSR} -g ${DSTGRP} -m 644 ports.conf ${DESTDIR}${ETCDIR}; \
17        fi
18-
19-       @if [ ! -e ${DESTDIR}${ETCDIR}/sources.conf ]; then \
20+       @if /bin/test ! -e ${DESTDIR}${ETCDIR}/sources.conf ; then \
21                set -x; \
22                install -o ${DSTUSR} -g ${DSTGRP} -m 644 sources.conf ${DESTDIR}${ETCDIR}; \
23        fi
24@@ -28,6 +25,7 @@
25        mkdir -p ${INSTALLDIR}/share/darwinports/resources/port1.0/install
26        install -o ${DSTUSR} -g ${DSTGRP} -m 644 prefix.mtree ${INSTALLDIR}/share/darwinports/resources/port1.0/install/
27        install -o ${DSTUSR} -g ${DSTGRP} -m 644 macosx.mtree ${INSTALLDIR}/share/darwinports/resources/port1.0/install/
28+       install -d -o ${DSTUSR} -g ${DSTGRP} ${INSTALLDIR}/man/man7
29        install -o ${DSTUSR} -g ${DSTGRP} -m 444 portfile.7 ${INSTALLDIR}/man/man7
30        install -o ${DSTUSR} -g ${DSTGRP} -m 444 portstyle.7 ${INSTALLDIR}/man/man7
31 
32Index: proj/darwinports/base/src/pextlib1.0/Pextlib.c
33===================================================================
34RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/pextlib1.0/Pextlib.c,v
35retrieving revision 1.36
36diff -u -r1.36 Pextlib.c
37--- proj/darwinports/base/src/pextlib1.0/Pextlib.c      11 Mar 2003 22:36:16 -0000      1.36
38+++ proj/darwinports/base/src/pextlib1.0/Pextlib.c      12 Mar 2003 03:55:29 -0000
39@@ -44,6 +44,12 @@
40 #include <sys/wait.h>
41 #include <tcl.h>
42 #include <unistd.h>
43+#ifdef HAVE_SYS_STAT_H
44+#include <sys/stat.h>
45+#endif
46+#ifdef HAVE_FCNTL_H
47+#include <fcntl.h>
48+#endif
49 #ifdef __APPLE__
50 #include <crt_externs.h>
51 #endif
52@@ -55,6 +61,13 @@
53 extern char **environ;
54 #endif
55 
56+#ifdef HAVE_LOCKF
57+# define       LOCK_SH         0x01    /* shared file lock */
58+# define       LOCK_EX         0x02    /* exclusive file lock */
59+# define       LOCK_NB         0x04    /* don't block when locking */
60+# define       LOCK_UN         0x08    /* unlock file */
61+#endif
62+
63 char *ui_escape(const char *source)
64 {
65        char *d, *dest;
66@@ -258,7 +271,38 @@
67                        operation |= LOCK_NB;
68                }
69        }
70-       if ((ret = flock(fd, operation)) != 0)
71+#ifdef HAVE_LOCKF
72+       {
73+               off_t where;
74+               off_t size;
75+               int function;
76+
77+               if (operation & LOCK_UN)
78+               {
79+                       where = 0;
80+                       size = 0;
81+                       function = F_ULOCK;
82+                       operation &= ~LOCK_UN;
83+               } else if (operation & LOCK_SH) {
84+                       where = getpid();
85+                       size = 1;
86+                       function = (operation & LOCK_NB) ? F_TLOCK : F_LOCK;
87+                       operation &= ~(LOCK_SH & LOCK_NB);
88+               } else if (operation & LOCK_EX) {
89+                       where = 0;
90+                       size = 0;
91+                       function = (operation & LOCK_NB) ? F_TLOCK : F_LOCK;
92+                       operation &= ~(LOCK_EX & LOCK_NB);
93+               }
94+               /* operation should be 0 here */
95+
96+               lseek(fd, where, SEEK_SET);
97+               ret = lockf(fd, function, size);
98+       }
99+#else
100+       ret = flock(fd, operation);
101+#endif
102+       if (ret != 0)
103        {
104                switch(errno) {
105                        case EAGAIN:
106Index: proj/darwinports/base/src/pextlib1.0/compile.sh
107===================================================================
108RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/pextlib1.0/compile.sh,v
109retrieving revision 1.8
110diff -u -r1.8 compile.sh
111--- proj/darwinports/base/src/pextlib1.0/compile.sh     9 Mar 2003 20:04:24 -0000       1.8
112+++ proj/darwinports/base/src/pextlib1.0/compile.sh     12 Mar 2003 03:55:29 -0000
113@@ -16,5 +17,8 @@
114        ;;
115        Linux)
116                cc -c -fPIC -DPIC -I/usr/include/tcl8.3 -O -pipe $*
117+       ;;
118+       SunOS)
119+               gcc -c -fPIC -DPIC -DHAVE_LOCKF -DHAVE_SYS_STAT_H -DHAVE_FCNTL_H -I/home/dp/local/include -I. -O -pipe $*
120        ;;
121 esac
122Index: proj/darwinports/base/src/pextlib1.0/link.sh
123===================================================================
124RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/pextlib1.0/link.sh,v
125retrieving revision 1.5
126diff -u -r1.5 link.sh
127--- proj/darwinports/base/src/pextlib1.0/link.sh        9 Mar 2003 19:59:54 -0000       1.5
128+++ proj/darwinports/base/src/pextlib1.0/link.sh        12 Mar 2003 03:55:29 -0000
129@@ -10,6 +10,7 @@
130                FreeBSD) echo $2.so ;;
131                NetBSD) echo $2.so ;;
132                Linux) echo $2.so ;;
133+               SunOS) echo $2.so ;;
134        esac
135        exit 0
136 fi
137@@ -28,5 +29,8 @@
138        ;;
139        Linux)
140                cc -shared $* -o ${LIB}.so -L/usr/lib/ -ltcl8.3
141+       ;;
142+       SunOS)
143+               gcc -shared $* -o ${LIB}.so -L/home/dp/local/lib/ -ltcl8.3
144        ;;
145 esac
146Index: proj/darwinports/base/src/port1.0/portchecksum.tcl
147===================================================================
148RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portchecksum.tcl,v
149retrieving revision 1.23
150diff -u -r1.23 portchecksum.tcl
151--- proj/darwinports/base/src/port1.0/portchecksum.tcl  1 Mar 2003 23:37:04 -0000       1.23
152+++ proj/darwinports/base/src/port1.0/portchecksum.tcl  12 Mar 2003 03:55:29 -0000
153@@ -43,15 +43,27 @@
154 set UI_PREFIX "---> "
155 
156 proc md5 {file} {
157-    global distpath UI_PREFIX
158+    global distpath UI_PREFIX os.platform
159 
160-    set md5regex "^(MD5)\[ \]\\((.+)\\)\[ \]=\[ \](\[A-Za-z0-9\]+)\n$"
161+    # Solaris returns:
162+    # sig1: md5      : d41d8cd98f00b204e9800998ecf8427e
163+    # FreeBSD returns:
164+    # MD5 (/dev/null) = d41d8cd98f00b204e9800998ecf8427e
165     if {[catch {set pipe [open "|md5 \"${file}\"" r]} result]} {
166         return -code error "[format [msgcat::mc "Unable to parse checksum: %s"] $result]"
167     }
168     set line [read $pipe]
169-    if {[regexp $md5regex $line match type filename sum] == 1} {
170+    if {${os.platform} == "sunos"} {
171+       set md5regex "^(sig1):\[ \](md5)\[ \]+:\[ \](\[A-Za-z0-9\]+)\n$"
172+       set rc [regexp $md5regex $line match sigN type sum]
173+       set filename $file
174+    } else {
175+       set md5regex "^(MD5)\[ \]\\((.+)\\)\[ \]=\[ \](\[A-Za-z0-9\]+)\n$"
176+       set rc [regexp $md5regex $line match type filename sum]
177+    }
178+    if {$rc == 1} {
179        close $pipe
180+       # ui_msg "$UI_PREFIX [format [msgcat::mc "%s ==? %s, sum %s"] $filename $file $sum]"
181        if {$filename == $file} {
182            return $sum
183        } else {
184Index: proj/darwinports/base/src/port1.0/resources/Makefile
185===================================================================
186RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/resources/Makefile,v
187retrieving revision 1.5
188diff -u -r1.5 Makefile
189--- proj/darwinports/base/src/port1.0/resources/Makefile        17 Feb 2003 18:22:20 -0000      1.5
190+++ proj/darwinports/base/src/port1.0/resources/Makefile        12 Mar 2003 03:55:29 -0000
191@@ -8,9 +8,9 @@
192 RSRCS=
193 
194 install::
195-       mkdir -p ${INSTALLDIR}
196-       @set -x; for file in ${RSRCS}; do \
197-               install -c -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
198-       done
199+#      mkdir -p ${INSTALLDIR}
200+#      @set -x; for file in ${RSRCS}; do \
201+#              install -c -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}; \
202+#      done
203 
204 include ../../../Mk/dports.subdir.mk