Repository: conan-io/conan-center-index

Issue:
[package] botan/2.18.1:  Merge #5995 may have broken native arm64 build
build was working before mrege [5995](https://github.com/conan-io/conan-center-index/pull/5995)
### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **botan/2.18.1**
  * Operating System+version: **Linux Ubuntu 18.04  (aarch64 docker image running through qemu-user-static)**
  * Compiler+version: **GCC 9.4.0**
  * Conan version: **conan 1.37.2**
  * Python version: **Python 3.6.9**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
Configuration for profile default:

[settings]
os=Linux
os_build=Linux
arch=armv8
arch_build=armv8
compiler=gcc
compiler.version=9
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
```

### conanfile.txt
```
[requires]
botan/2.15.0

[generators]
cmake_paths


[options]
```


### Steps to reproduce (Include if Applicable)

```
conan profile new --detect default
conan profile update settings.compiler.libcxx=libstdc++11 default
conan config set general.revisions_enabled=True
conan install --build missing ./conanfile.txt 
```
### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
botan/2.15.0: Calling build()                                                                                                                                                                                                                                                 
   INFO: ./configure.py invoked with options "--build-targets=static --distribution-info=Conan --without-documentation --cc-abi-flags=-arch arm64 --extra-cxxflags=-fPIC --cc=gcc --cpu=armv8 --prefix=/opt/shared/buildaarch64/conan/.conan/data/botan/2.15.0/_/_/package/9cd
0a7616dd408d937c7eb5ac4b59ccc3aeb29ec --os=linux --amalgamation --without-pkg-config"                                                                                                                                                                                         
   INFO: Configuring to build Botan 2.15.0 (revision git:79e52541940eb63a9758574e01c08b80dcfd660e)                                                                                                                                                                            
   INFO: Running under 2.7.18 (default, Mar  8 2021, 13:02:45) [GCC 9.3.0]                                                                                                                                                                                                    
   INFO: CXX environment variable is set which will override compiler path
   INFO: Implicit --ar-command=aarch64-linux-gnu-ar due to environment variable AR
   INFO: Implicit --cc-bin=aarch64-linux-gnu-g++ due to environment variable CXX
   INFO: Autodetected platform information: OS="Linux" machine="x86_64" proc="x86_64"
   INFO: Using /etc/ssl/certs/ca-certificates.crt as system certificate store
   INFO: Canonicalized CPU target armv8 to arm64
   INFO: Auto-detected compiler version 9.3
   INFO: Auto-detected compiler arch arm64
   INFO: Target is gcc:9.3-linux-arm64
   INFO: Assuming target arm64 is little endian
   INFO: Skipping (dependency failure): asio certstor_sqlite3 sessions_sqlite3
   INFO: Skipping (incompatible CPU): aes_ni aes_power8 chacha_avx2 clmul_ssse3 idea_sse2 processor_rng rdrand_rng rdseed serpent_avx2 sha1_sse2 sha1_x86 sha2_32_bmi2 sha2_32_x86 sha2_64_bmi2 sha3_bmi2 shacal2_avx2 shacal2_x86 simd_avx2 threefish_512_avx2
   INFO: Skipping (incompatible OS): certstor_system_macos certstor_system_windows commoncrypto getentropy win32_stats
   INFO: Skipping (no enabled compression schemes): compression
   INFO: Skipping (requires external dependency): boost bzip2 lzma openssl sqlite3 tpm zlib
   INFO: Loading modules: adler32 aead aes aes_armv8 aes_vperm aont argon2 aria asn1 auto_rng base base32 base58 base64 bcrypt bcrypt_pbkdf bigint blake2 block blowfish camellia cascade cast128 cast256 cbc cbc_mac ccm cecpq1 certstor_flatfile certstor_sql certstor_syste
m cfb chacha chacha20poly1305 chacha_rng chacha_simd32 checksum clmul_cpu cmac comb4p cpuid crc24 crc32 cryptobox ctr curve25519 des dev_random dh dl_algo dl_group dlies dsa dyn_load eax ec_group ecc_key ecdh ecdsa ecgdsa ecies eckcdsa ed25519 elgamal eme_oaep eme_pkcs1
 eme_raw emsa1 emsa_pkcs1 emsa_pssr emsa_raw emsa_x931 entropy fd_unix ffi filters fpe_fe1 gcm gmac gost_28147 gost_3410 gost_3411 hash hash_id hex hkdf hmac hmac_drbg hotp http_util idea iso9796 kasumi kdf kdf1 kdf1_iso18033 kdf2 keccak keypair lion locking_allocator m
ac mce mceies md4 md5 mdx_hash mem_pool mgf1 misty1 mode_pad modes mp newhope nist_keywrap noekeon noekeon_simd numbertheory ocb ofb par_hash passhash9 pbes2 pbkdf pbkdf1 pbkdf2 pem pgp_s2k pk_pad pkcs11 poly1305 poly_dbl prf_tls prf_x942 proc_walk psk_db pubkey rc4 rfc
3394 rfc6979 rmd160 rng roughtime rsa salsa20 scrypt seed serpent serpent_simd sessions_sql sha1 sha1_armv8 sha2_32 sha2_32_armv8 sha2_64 sha3 shacal2 shacal2_simd shake shake_cipher simd siphash siv skein sm2 sm3 sm4 sm4_armv8 socket sodium sp800_108 sp800_56a sp800_56
c srp6 stateful_rng stream streebog system_rng thread_utils threefish_512 tiger tls tls_10 tls_cbc tss twofish utils uuid whirlpool x509 x919_mac xmss xtea xts
   INFO: Using symlink to link files into build dir (use --link-method to change)
   INFO: Writing amalgamation header to botan_all.h
   INFO: Writing amalgamation source to botan_all.cpp
   INFO: Botan 2.15.0 (revision git:79e52541940eb63a9758574e01c08b80dcfd660e) (unreleased undated) build setup is complete
aarch64-linux-gnu-g++  -fstack-protector -pthread -arch arm64 -std=c++11 -D_REENTRANT  -O3 -fPIC -DBOTAN_IS_BEING_BUILT -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtu
al-dtor  -Ibuild/include -Ibuild/include/external -c botan_all.cpp -o build/obj/lib/botan_all.o
aarch64-linux-gnu-g++: error: arm64: No such file or directory
aarch64-linux-gnu-g++: error: unrecognized command line option ‘-arch’; did you mean ‘-march=’?
make: *** [Makefile:91: build/obj/lib/botan_all.o] Error 1
botan/2.15.0:
botan/2.15.0: ERROR: Package '9cd0a7616dd408d937c7eb5ac4b59ccc3aeb29ec' build failed
botan/2.15.0: WARN: Build folder /opt/shared/buildaarch64/conan/.conan/data/botan/2.15.0/_/_/build/9cd0a7616dd408d937c7eb5ac4b59ccc3aeb29ec
ERROR: botan/2.15.0: Error in build() method, line 172
        self.run(self._make_cmd)
        ConanException: Error 2 while executing  /usr/bin/make -j8
```

</details>



Discussion:
It looks like this code of #5995 should be put under the conditional `if self.settings.compiler in ("apple-clang"):`, excluding clang and gcc.
```
           elif self.settings.arch in ['armv7']:
                botan_abi_flags.append('-arch armv7')
            elif self.settings.arch in ['armv8']:
                botan_abi_flags.append('-arch arm64')
```
Please open a pr and I will gladly approve it.
yes, feel free to create a PR with the fix suggested
Unfortunately at this time I am unable to submit a PR as I have discovered my employer doesn't allow me to submit changes to open source software without approval.
That's sad to hear.

So now would be the time to ask for that approval!
> 
> 
> That's sad to hear.
> 
> So now would be the time to ask for that approval!

I am trying to get that done.

Resolving patch:
diff --git a/recipes/botan/all/conanfile.py b/recipes/botan/all/conanfile.py
--- a/recipes/botan/all/conanfile.py
+++ b/recipes/botan/all/conanfile.py
@@ -226,12 +226,14 @@ def _configure_cmd(self):
         if self._is_linux_clang_libcxx:
             botan_abi_flags.extend(['-stdlib=libc++', '-lc++abi'])
 
-        if botan_compiler in ['clang', 'apple-clang', 'gcc']:
+        if self.settings.compiler in ['clang', 'apple-clang', 'gcc']:
             if self.settings.arch == 'x86':
                 botan_abi_flags.append('-m32')
             elif self.settings.arch == 'x86_64':
                 botan_abi_flags.append('-m64')
-            elif self.settings.arch in ['armv7']:
+
+        if self.settings.compiler in ['apple-clang']:
+            if self.settings.arch in ['armv7']:
                 botan_abi_flags.append('-arch armv7')
             elif self.settings.arch in ['armv8']:
                 botan_abi_flags.append('-arch arm64')


Test patch: