HELP! nvidia-driver patch: Weird REPLACE_CMD and command-line-sed behaviour. HELP!

John Hein jhein at symmetricom.com
Tue Sep 10 14:16:47 UTC 2013


O. Hartmann wrote at 01:51 +0200 on Sep 10, 2013:
 > sed -i -e 's/\(\&virtual_address, size,\) \(VMFS_ANY_SPACE,\)$/ \
 > \1 0, \2/' work/NVIDIA-FreeBSD-x86_64-325.15/src/nvidia_subr.c

In a makefile shell command, you have to escape $ signs
if you want them to be used as $ signs in the shell context.

   .
   .
 >                                 But putting the very same
 > sed-expression into the port's Makefile 
 > 
 > # Changes in vm_map_find() due to r255426 
 > ..if ${OSVERSION} > 1000053 
 > 	${REINPLACE_CMD} -e 's/\(\&virtual_address, size,\) \
 > 	\(VMFS_ANY_SPACE,\)$/\1 0, \2/' \
 > 	\ ${WRKSRC}/src/nvidia_subr.c
 > ..endif
 > 
 > (patch attached) gives this weird error:
 > 
 > ===>  Cleaning for nvidia-driver-325.15
 > ===>  License NVIDIA accepted by the user
 > ===>  Found saved configuration for nvidia-driver-325.08_1
 > ===>   nvidia-driver-325.15 depends on file: /usr/local/sbin/pkg - found
 > ===> Fetching all distfiles required by nvidia-driver-325.15 for
 > building ===>  Extracting for nvidia-driver-325.15
 > => SHA256 Checksum OK for NVIDIA-FreeBSD-x86_64-325.15.tar.gz.
 > ===>  Patching for nvidia-driver-325.15
 > sed: 1: "s/\(\&virtual_address,  ...": unescaped newline inside
 > substitute pattern *** Error code 1


make(1) evaluates $/ - which is likely empty which is why sed doesn't
see the end of the expression before the newline.  Hence the
weird error (not so weird once it's understood).

You want to use $$/ instead of $/ :

.if ${OSVERSION} > 1000053 
	${REINPLACE_CMD} -e 's/\(\&virtual_address, size,\) \
		\(VMFS_ANY_SPACE,\)$$/\1 0, \2/' \
		\ ${WRKSRC}/src/nvidia_subr.c
.endif


More information about the freebsd-ports mailing list