<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>In a recent trunk version new code was introduced in the compiler
      Makefile to make use of codesign for comparing stage compilers.</p>
    <p>Problem is that there was an algorithm implemented to detect
      codesign in the path and this code is not properly covering the
      case when for some reason codesign is visible in two places...
      (Which happens for me when I try to use fpcupdeluxe to build
      latest trunk)<br>
    </p>
    <p><br>
    </p>
    <p>Here's the magic code:<br>
    </p>
    <p>ifeq ($(OS_TARGET), darwin)<br>
      CODESIGN?=$(strip $(wildcard $(addsuffix
      /codesign,$(SEARCHPATH))))<br>
      endif</p>
    <p><br>
    </p>
    <p>I have added debug output and there can be cases where $CODESIGN
      is set to "/usr/bin/codesign /usr/bin/codesign"</p>
    <p>which results in codesign trying to sign codesign, which
      fortunately fails because of /usr/bin protection in Darwin:</p>
    <p><br>
    </p>
    <p><font face="monospace">/Library/Developer/CommandLineTools/usr/bin/make
        -C compiler distclean<br>
      </font>
    </p>
    <p><font face="monospace"> $CODESIGN is [/usr/bin/codesign
        /usr/bin/codesign]</font></p>
    <font face="monospace"> </font>
    <p><font face="monospace">.....<br>
      </font></p>
    <p><font face="monospace">error:
        /Library/Developer/CommandLineTools/usr/bin/codesign_allocate:
        can't create output file: /usr/bin/codesign.cstemp (Operation
        not permitted) </font></p>
    <p><br>
    </p>
    and finally, later the build fails:
    <p><br>
    </p>
    <p><font face="monospace">strip -no_uuid ppca64.tmp<br>
        /usr/bin/codesign /usr/bin/codesign --remove-signature ppc3.tmp</font></p>
    <p><font face="monospace"><br>
      </font></p>
    <p>there is also another issue:</p>
    <p><font face="monospace"><br>
      </font></p>
    <p><font face="monospace">ifneq ($(CODESIGN),)<br>
        DIFFRESULT:=$(shell $(COPY) $(OLDFPC) $(OLDFPC).tmp; $(COPY)
        $(FPC) $(FPC).tmp; strip -no_uuid $(OLDFPC).tmp; strip -no_uuid
        $(FPC).tmp; $(CODESIGN) --remove-signature $(OLDFPC).tmp; <b>codesign</b>
        --remove-signature $(FPC).tmp; $(DIFF) $(OLDFPC).tmp $(FPC).tmp;
        $(RMPROG) $(OLDFPC).tmp $(FPC).tmp)<br>
      </font><br>
    </p>
    <p>One instance of 'codesign' is still left in the code which has to
      get replaced with <font face="monospace">$(CODESIGN)</font></p>
    <p><font face="monospace"><br>
      </font></p>
    <p>So, question one is if it is necessary to detect codesign path at
      all, at least for my Mac's it is in /usr/bin</p>
    <p>and, if this step is needed,</p>
    <p>please make the result of the detection unique so that codesign
      stops trying to codesign itself.</p>
    <p><br>
    </p>
    <p>Thank you,</p>
    <p><br>
    </p>
    <p>Michael<br>
    </p>
  </body>
</html>