veeso / termscp

🖥 A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/S3/SMB
https://termscp.veeso.dev
MIT License
1.49k stars 45 forks source link

[BUG] - Portability issue #189

Closed 0323pin closed 1 year ago

0323pin commented 1 year ago

Description

Building the latest release on NetBSD fails with the following error:

===> Creating toolchain wrappers for termscp-0.12.0
===> Configuring for termscp-0.12.0
=> Generating pkg-config file for builtin expat package.
=> Checking for portability problems in extracted files
ERROR: [check-portability.awk] => Found test ... == ...:
ERROR: [check-portability.awk] dist/build/macos.sh:84: if [ "$ARCH" == "aarch64" ]; then
ERROR: [check-portability.awk] dist/build/macos.sh:95: if [ "$ARCH" == "aarch64" ]; then

Explanation:
===========================================================================
The "test" command, as well as the "[" command, are not required to know
the "==" operator. Only a few implementations like bash and some
versions of ksh support it.

When you run "test foo == foo" on a platform that does not support the
"==" operator, the result will be "false" instead of "true". This can
lead to unexpected behavior.

There are two ways to fix this error message. If the file that contains
the "test ==" is needed for building the package, you should create a
patch for it, replacing the "==" operator with "=". If the file is not
needed, add its name to the CHECK_PORTABILITY_SKIP variable in the
package Makefile.
===========================================================================

*** Error code 1

Stop.

The following patch allows the build to start.

--- dist/build/macos.sh.orig    2023-05-16 13:52:50.000000000 +0000
+++ dist/build/macos.sh
@@ -81,7 +81,7 @@ fi
 # Build release (x86_64)
 X86_TARGET=""
 X86_TARGET_DIR=""
-if [ "$ARCH" == "aarch64" ]; then
+if [ "$ARCH" = "aarch64" ]; then
     X86_TARGET="--target x86_64-apple-darwin"
     X86_TARGET_DIR="target/x86_64-apple-darwin/release/"
 fi
@@ -92,7 +92,7 @@ RET_X86_64=$?

 ARM64_TARGET=""
 ARM64_TARGET_DIR=""
-if [ "$ARCH" == "aarch64" ]; then
+if [ "$ARCH" = "aarch64" ]; then
     ARM64_TARGET="--target aarch64-apple-darwin"
     ARM64_TARGET_DIR="target/aarch64-apple-darwin/release/"
 fi

Please consider applying this patch. I still need to fix a missing dependency to fix the package build.

Regards

veeso commented 1 year ago

I've fixed them, but I can't understand why those scripts should be considered by the netbsd pkg, since they are for building release files for macos 😅

0323pin commented 1 year ago

but I can't understand why those scripts should be considered by the netbsd pkg, since they are for building release files for macos

That's very simple, pkgsrc supports a lot of different platforms, including macos. Quite a few pkgsrc maintainers use macos as their development platform.

Hence, the checks and the failure.

Thanks for fixing it.

veeso commented 1 year ago

mhm okay, but that script should not be used to install termscp, but only to build the binaries and it's "reserved" for project maintainers. To install termscp instead, a download of the binaries from the release should be performed.

0323pin commented 1 year ago

My guess, it's just checking all included files. I could add a flag to stop the check but, right now I'm trying to fix the build by adding a dependency on samba, which I have to build, as it's not something I use.

0323pin commented 1 year ago

Still unable to build the new release :(

error[E0063]: missing fields `blksize`, `dev`, `nlink` and 1 other field in initializer of `types::stat::SmbStat`
  --> /usr/pkgsrc/wip/termscp/work/vendor/pavao-0.2.3/src/smb/types/stat.rs:47:9
   |
47 |         Self {
   |         ^^^^ missing `blksize`, `dev`, `nlink` and 1 other field

For more information about this error, try `rustc --explain E0063`.
error: could not compile `pavao` due to previous error
warning: build failed, waiting for other jobs to finish...
*** Error code 101

Stop.
make[1]: stopped in /usr/pkgsrc/wip/termscp
*** Error code 1

Stop.

pavao doesn't support NetBSD. I'll try to patch it but, it's getting painful.