1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
#!/bin/sh
#
# daemon - https://libslack.org/daemon
#
# Copyright (C) 1999-2004, 2010, 2020-2023 raf <raf@raf.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# 20230824 raf <raf@raf.org>
#
# Modify the macros.mk make include files to compile on Solaris 10 with gcc
perl -pi \
-e 's/^# (\S+ \+= xnet)$/$1/;' \
-e 's/^# (\S+ \+= socket)$/$1/;' \
-e 's/^# (\S+ \+= nsl)$/$1/;' \
-e 's/^(\S+ \+= m)$/# $1/;' \
-e 's/^# (GETOPT := getopt)$/$1/;' \
-e 's/^# (SNPRINTF := snprintf)$/$1/;' \
-e 's/^# (VSSCANF := vsscanf)$/$1/;' \
-e 's/^(\S+ \+= -DHAVE_GETOPT_LONG=1)$/# $1/;' \
-e 's/^(\S+ \+= -DHAVE_VSSCANF=1)$/# $1/;' \
-e 's/^# (\S+ \+= -DHAVE_PTHREAD_RWLOCK=1)$/$1/;' \
-e 's/^(\S+ \+= -DNO_POSIX_C_SOURCE=1)$/# $1/;' \
-e 's/^(\S+ \+= -DNO_POSIX_SOURCE=1)$/# $1/;' \
-e 's/^(\S+ \+= -DNO_XOPEN_SOURCE=1)$/# $1/;' \
-e 's/^(\S+ \+= -DROOT_PID_DIR)=.*$/# $1=\\"\/var\/run\\"/;' \
-e 's/^(CC := cc)$/# $1/;' \
-e 's/^# (CC := gcc)$/$1/;' \
-e 's/^(CC := .*other)$/# CC := other/;' \
-e 's/^# (\S+ \+= -Wno-long-long)$/$1/;' \
-e 's/^(\S+ \+= -Wno-overlength-strings)$/# $1/;' \
-e 's/^(\S+ \+= -Wno-address)$/# $1/;' \
-e 's/^(\S+ \+= -Wno-nonnull)$/# $1/;' \
-e 's/^(\S+ \+= -Wno-format)$/# $1/;' \
-e 's/^(\S+ \+= -Wno-restrict)$/# $1/;' \
-e 's/^(\S+ \+= -Wno-comment)$/# $1/;' \
-e 's/^(\S+ \+= -Wno-pointer-bool-conversion)$/# $1/;' \
-e 's/^(\S+ \+= -Wno-deprecated-declarations)$/# $1/;' \
-e 's/^(\S+ \+= -Wno-gnu-folding-constant)$/# $1/;' \
-e 's/^# (\w*CCFLAGS \+= -O3)$/$1/;' \
-e 's/^# (\w*CCFLAGS \+= -Wall -pedantic)$/$1/;' \
-e 's/^(\w*(?:CC|LD)FLAGS \+= -m64)$/# $1/;' \
-e 's/^(\w*CCFLAGS \+= -xO4)$/# $1/;' \
-e 's/^# (\w*LIBS \+= pthread)$/$1/;' \
-e 's/^(\w*LIBS \+= util)$/# $1/;' \
-e 's/^(\w*LDFLAGS \+= -pthread)$/# $1/;' \
-e 's/^MAN_GZIP := 1$/MAN_GZIP := 0/;' \
-e 's/^(MAN_SYSDIR\s*:=).*$/$1 \$(PREFIX)\/share\/man/;' \
-e 's/^(MAN_LOCDIR\s*:=).*$/$1 \$(PREFIX)\/share\/man/;' \
-e 's/^CONF_INSDIR := \$\(PREFIX\)\/etc$/CONF_INSDIR := \/etc/;' \
-e 's/^# (PREFIX := \/usr\/local)$/$1/;' \
-e 's/^(PREFIX := \/usr\/pkg)$/# $1/;' \
-e 's/^(DAEMON_DEFINES \+= -DCONFIG_PATH=\\"\$\(PREFIX\)\/etc\/daemon\.conf\\")$/# $1/;' \
`find . -name Makefile` \
`find . -name macros.mk`
# Solaris10 has /usr/ucb/install but OpenSolaris 200906 doesn't
# so we use own version rather than trying to get their native
# (weird) install program to work the way the normal one does.
if [ ! -f /usr/ucb/install ]
then
perl -pi \
-e 's/install -m/.\/myinstall -m/' \
`find . -name rules.mk`
else
perl -pi \
-e 's/\.\/myinstall -m/install -m/' \
`find . -name rules.mk`
fi
# On 64-bit Solaris/OpenSolaris gcc generates 32-bit binaries by
# default so we have to ask explicitly for 64-bit.
if [ "`isainfo -k`" = "amd64" ]
then
perl -pi \
-e 's/^# (\w*(?:CC|LD)FLAGS \+= -m64)$/$1/;' \
`find . -name Makefile` \
`find . -name macros.mk`
else
perl -pi \
-e 's/^(\w*(?:CC|LD)FLAGS \+= -m64)$/# $1/;' \
`find . -name Makefile` \
`find . -name macros.mk`
fi
perl -pi \
-e 's/^#define (NO_POSIX_SOURCE) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (NO_XOPEN_SOURCE) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_STDARG_H) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_STDINT_H) 1$/\/\* #undef $1 \*\//;' \
-e 's/^\/\* #undef (HAVE_POLL_H) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_SYS_POLL_H) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_SYS_SELECT_H) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_REGEX_H) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_LONG_DOUBLE) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_LONG_LONG) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_SNPRINTF) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_VSNPRINTF) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_GETOPT_LONG) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_VSSCANF) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_STRCASECMP) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_STRNCASECMP) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_STRLCPY) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_STRLCAT) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_ASPRINTF) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_VASPRINTF) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_FLOCKFILE) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_FCNTL_THAT_CAN_LOCK_FIFOS) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_ISOC_REALLOC) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_POLL) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_LINUX_POLL_BUG) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_MLOCK) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_FUNC_GETHOSTBYNAME_R_6) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_FUNC_GETHOSTBYNAME_R_5) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_FUNC_GETHOSTBYNAME_R_3) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_FUNC_GETSERVBYNAME_R_6) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_FUNC_GETSERVBYNAME_R_5) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_FUNC_GETSERVBYNAME_R_4) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_PTHREAD_PROCESS_PRIVATE) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_PTHREAD_PROCESS_SHARED) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_PTHREAD_CONDATTR_INIT) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_PTHREAD_CONDATTR_SETPSHARED) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_PTHREAD_MUTEXATTR_SETPSHARED) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_PTHREAD_RWLOCK) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_MSGHDR_MSG_CONTROL) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_IFREQ_IFR_IFINDEX) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_IFREQ_IFR_MTU) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_SOCKADDR_SA_LEN) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_IF_INDEXTONAME) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_IF_NAMETOINDEX) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (MLOCK_REQUIRES_PAGE_BOUNDARY) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_PRINTF_PTR_FMT_ALTERNATE) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_PRINTF_PTR_FMT_SIGNED) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_PRINTF_PTR_FMT_NIL) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_PRINTF_STR_FMT_NULL) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_PRINTF_FLT_FMT_G_STD) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_PRINTF_PTR_FMT_NOALT) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_PRINTF_WITH_SOLARIS_NEGATIVE_WIDTH_BEHAVIOUR) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_PRINTF_WITH_SOLARIS8_ZERO_PRECISION_ALT_OCTAL_BEHAVIOUR) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_UNIX_DOMAIN_WILDCARD) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (SVR4) \*\/$/#define $1 1/;' \
-e 's/^#define (SOCKS) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_CYGWIN) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_DEV_PTMX) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_DEV_PTS_AND_PTC) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_OPENPTY) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_PTY_H) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_UTIL_H) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_LIBUTIL_H) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_SYS_STROPTS_H) \*\/$/#define $1 1/;' \
-e 's/^#define (HAVE_VHANGUP) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE__GETPTY) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_TTYNAME_R) 1$/\/* #undef $1 *\//;' \
-e 's/^#define (HAVE_PTSNAME_R) 1$/\/* #undef $1 *\//;' \
-e 's/^\/\* #undef (HAVE_PTSNAME) \*\/$/#define $1 1/;' \
-e 's/^\/\* #undef (HAVE_POLL_THAT_ABORTS_WHEN_POLLFDS_IS_NULL) \*\/$/#define $1 1/;' \
`find . -name config.h`
perl -pi \
-e 's/^#define (HAVE_SYS_TTYDEFAULTS_H) 1$/\/\* #undef $1 \*\//;' \
config.h
# vi:set ts=4 sw=4:
|