Opened 4 years ago

Closed 4 years ago

#62292 closed defect (fixed)

makefile-1.0: can't use makefile.has_destdir no with makefile.override PREFIX

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.99
Keywords: haspatch Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), cooljeanius (Eric Gallager)
Port: makefile

Description

I'm working on fixing and modernizing the anacron portfile including adopting the makefile 1.0 portgroup. For this port I need to use:

makefile.has_destdir        no
makefile.override-append    PREFIX

It doesn't work:

DEBUG: Executing org.macports.destroot (anacron)
DEBUG: Environment:
CC='/usr/bin/clang'
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_sysutils_anacron/anacron/work/.CC_PRINT_OPTIONS'
CFLAGS='-Os -Werror=implicit-function-declaration -DHAVE_STDLIB_H -arch x86_64 -arch i386 -arch x86_64 -arch i386'
CPATH='/opt/local/include'
CPPFLAGS='-I/opt/local/include'
CXX='/usr/bin/clang++'
CXXFLAGS='-Os -arch x86_64 -arch i386 -arch x86_64 -arch i386 -stdlib=libc++'
DEVELOPER_DIR='/Library/Developer/CommandLineTools'
F90FLAGS='-Os'
FCFLAGS='-Os'
FFLAGS='-Os'
INSTALL='/usr/bin/install -c'
LDFLAGS='-L/opt/local/lib -Wl,-headerpad_max_install_names -arch x86_64 -arch i386 -arch x86_64 -arch i386'
LIBRARY_PATH='/opt/local/lib'
MACOSX_DEPLOYMENT_TARGET='10.13'
OBJC='/usr/bin/clang'
OBJCFLAGS='-Os -Werror=implicit-function-declaration -arch x86_64 -arch i386 -arch x86_64 -arch i386'
OBJCXX='/usr/bin/clang++'
OBJCXXFLAGS='-Os -arch x86_64 -arch i386 -arch x86_64 -arch i386 -arch x86_64 -arch i386 -stdlib=libc++'
PREFIX='$(DESTDIR)/opt/local'
Executing:  cd "/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_sysutils_anacron/anacron/work/anacron-2.3" && /usr/bin/make -w install PREFIX=$(DESTDIR)/opt/local CC="/usr/bin/clang" CXX="/usr/bin/clang++" OBJC="/usr/bin/clang" OBJCXX="/usr/bin/clang++" INSTALL="/usr/bin/install -c" DESTDIR=/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_sysutils_anacron/anacron/work/destroot
DEBUG: system:  cd "/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_sysutils_anacron/anacron/work/anacron-2.3" && /usr/bin/make -w install PREFIX=$(DESTDIR)/opt/local CC="/usr/bin/clang" CXX="/usr/bin/clang++" OBJC="/usr/bin/clang" OBJCXX="/usr/bin/clang++" INSTALL="/usr/bin/install -c" DESTDIR=/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_sysutils_anacron/anacron/work/destroot
sh: DESTDIR: command not found
make: Entering directory `/opt/local/var/macports/build/_Users_rschmidt_macports_macports-ports-svn-trunk-new_sysutils_anacron/anacron/work/anacron-2.3'
/usr/bin/install -c -d -m 0755 /opt/local/sbin /opt/local/var/spool/anacron \
		/opt/local/share/man/man5 /opt/local/share/man/man8
install: chmod 755 /opt/local/sbin: Operation not permitted
install: mkdir /opt/local/var/spool/anacron: Operation not permitted
make: *** [installdirs] Error 71

Note specifically:

PREFIX='$(DESTDIR)/opt/local'

and:

sh: DESTDIR: command not found

$(DESTDIR) is shell syntax for "run the program DESTDIR" and of course there is no such program.

Setting PREFIX this way may work when it is just an environment variable, but not when used as a command line override, unless further escaping is applied.

Change History (3)

comment:1 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: haspatch added

This works for me... any objections?

  • _resources/port1.0/group/makefile-1.0.tcl

     
    5656    default compiler.limit_flags        no
    5757}
    5858
     59# please remove when 8a088c3 has been in a released MacPorts version for at least two weeks
     60# see https://github.com/macports/macports-base/commit/8a088c30d80c7c3eca10848f28835e1c180229b1
     61if {[vercmp [macports_version] 2.6.99] < 0} {
     62    proc shellescape {arg} {
     63        return [regsub -all -- {[^A-Za-z0-9.:@%/+=_-]} $arg {\\&}]
     64    }
     65}
     66
    5967namespace eval makefile_pg {
    6068}
    6169
     
    120128            set makefile_prefix         \$(DESTDIR)${prefix}
    121129        }
    122130        if {[lsearch -exact ${makefile.override} PREFIX] != -1} {
    123             ${phase}.args-append        [option makefile.prefix_name]=${makefile_prefix}
     131            ${phase}.args-append        [option makefile.prefix_name]=[shellescape ${makefile_prefix}]
    124132        }
    125133        ${phase}.env-append             [option makefile.prefix_name]=${makefile_prefix}
    126134

comment:2 Changed 4 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:3 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to ryandesign
Resolution: fixed
Status: newclosed

In 8bf3aabac92c82cb18a4519dba4432740bbd3617/macports-ports (master):

makefile-1.0.tcl: Escape prefix arg

Closes: #62292

Note: See TracTickets for help on using tickets.