]> source.dussan.org Git - gitea.git/commitdiff
Fix build errors on BSD (in BSDMakefile) (#27594) (#27608)
authorGiteabot <teabot@gitea.io>
Sat, 14 Oct 2023 07:29:55 +0000 (15:29 +0800)
committerGitHub <noreply@github.com>
Sat, 14 Oct 2023 07:29:55 +0000 (07:29 +0000)
Backport #27594 by @sryze

1. `make build` fails because `||` and `&&` have the same precedence in
sh/bash, so the `false` command always evaluated (leading to an error).

   ```
   + which gmake /usr/local/bin/gmake
   + false

   *** Failed target:  .BEGIN
*** Failed command: which "gmake" || printf "Error: GNU Make is
required!\n\n" 1>&2 && false
   *** Error code 1
   ```

2. When `GPREFIX` is set to an empty string with quotation marks,
`gmake` mistakenly thinks that it's a file name:

   ``` gmake: *** empty string invalid as file name.  Stop. ```

Co-authored-by: Sergey Zolotarev <sryze@protonmail.com>
BSDmakefile

index 13174f8fd22b44c759dd538dadc555a2846820d8..79696eadcf7f6593a7f54f2a85f5ccf1af224287 100644 (file)
@@ -42,13 +42,13 @@ GARGS = "--no-print-directory"
 
 # The GNU convention is to use the lowercased `prefix` variable/macro to
 # specify the installation directory. Humor them.
-GPREFIX = ""
+GPREFIX =
 .if defined(PREFIX) && ! defined(prefix)
     GPREFIX = 'prefix = "$(PREFIX)"'
 .endif
 
 .BEGIN: .SILENT
-       which $(GMAKE) || printf "Error: GNU Make is required!\n\n" 1>&2 && false
+       which $(GMAKE) || (printf "Error: GNU Make is required!\n\n" 1>&2 && false)
 
 .PHONY: FRC
 $(.TARGETS): FRC