Repository: conan-io/conan-center-index

Issue:
[swig]  swig/4.0.1/2  Recipe contains code to strip executables, why?
Building swig/4.0.2 on AIX with gcc I ran into a problem with strip.  Generally speaking, not all platforms will leave you with a functional binary when you run `strip <executable file>` as some platforms' strip commands will remove relocation information.   It is trivial to work around by setting:
```
swig:STRIP=:
```
in a profile, but when I found that the stripping was added to the build by the recipe, I wondered why this was done.
It seems unnecessary, adds complexity, and potentially prevents producing a debug package that has debug symbols in it.
I think there should be a policy that addresses this for all of conan-center-index.

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **swig/4.0.2**
  * Operating System+version: **AIX 7.1 PowerPC**
  * Compiler+version: **GCC 8.4**
  * Conan version: **conan 1.31.4**
  * Python version: **Python 3.8.6**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
settings]
os=AIX
os_build=AIX
os.version=7.1
compiler=gcc
compiler.version=8.4
compiler.libcxx=libstdc++
build_type=Release
arch=ppc64
arch_build=ppc64
[options]
b2:toolset=gcc
b2:use_cxx_env=True
icu:with_extras=False
[build_requires]
[env]
OBJECT_MODE=64
CFLAGS=-fexceptions -pthread -mcpu=power8 -maix64 -mvsx
CXXFLAGS=-fexceptions -pthread -mcpu=power8 -maix64 -mvsx
CONAN_CPU_COUNT=4
PATH=['/opt/cmake-3.18/bin']
CC=/opt/freeware/bin/gcc
CXX=/opt/freeware/bin/g++
icu:PATH=['/opt/freeware/bin']
jpeg-dl:PATH=['/opt/freeware/bin']
b2:NO_CXX11_CHECK=true
b2:PATH=['/opt/freeware/bin']
swig:PATH=['/opt/freeware/bin']
swig:CPPFLAGS=-D_POSIX_SOURCE=1 -D_XOPEN_SOURCE_EXTENDED=1
swig:STRIP=:
```

### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
Installing /home/robb/.conan/data/swig/4.0.2/_/_/package/b18a78d720bc5d9668ba289815d9ed083b41dfa9/bin/swiglib/std/std_wstring.i
Installing /home/robb/.conan/data/swig/4.0.2/_/_/package/b18a78d720bc5d9668ba289815d9ed083b41dfa9/bin/swiglib/std/std_carray.swg
Installation complete
strip: swig -- 0654-420 The file was already stripped as specified.
ERROR: swig/4.0.2: Error in package() method, line 121
        self.run("{} swig{}".format(strip, ext), win_bash=tools.os_info.is_windows)
        ConanException: Error 255 while executing /usr/bin/strip swig

```

</details>



Discussion:
It also appears that this is the ONLY  project in conan-center-index that attempts to strip binaries.
This was ported from the initial bincrafters recipe at https://github.com/bincrafters/conan-swig_installer/commit/87993737bea03d20bd8c0fa091d62366f556dbe0
Feel free to open a pr removing the strip.
It looks out of place indeed.

Maybe stripping deserves a conan features, like debug symbols.
@madebr should a suggestion to avoid doing this be added to documentation on new projects?
I don't think so. swig is the exception here.

Resolving patch:
diff --git a/recipes/swig/all/conanfile.py b/recipes/swig/all/conanfile.py
--- a/recipes/swig/all/conanfile.py
+++ b/recipes/swig/all/conanfile.py
@@ -113,14 +113,6 @@ def package(self):
             autotools = self._configure_autotools()
             autotools.install()
 
-        if self.settings.compiler != "Visual Studio":
-            with tools.chdir(os.path.join(self.package_folder, "bin")):
-                strip = (tools.get_env("STRIP") or tools.which("strip")).replace("\\", "/")
-                ext = ".exe" if tools.os_info.is_windows else ""
-                if strip:
-                    self.run("{} swig{}".format(strip, ext), win_bash=tools.os_info.is_windows)
-                    self.run("{} ccache-swig{}".format(strip, ext), win_bash=tools.os_info.is_windows)
-
     @property
     def _swiglibdir(self):
         return os.path.join(self.package_folder, "bin", "swiglib").replace("\\", "/")


Test patch: