Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev-cpp/fast_obj: new package #298

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vitaly-zdanevich
Copy link
Contributor

No description provided.

@stkw0
Copy link
Contributor

stkw0 commented Mar 3, 2025

It doesnt define any install target + seems to only compile a static library.
You can define src_install and use dolib and patch CMake so it can generate a shared library (or just install the static one, but I think using a shared library would be prefered)

@vitaly-zdanevich
Copy link
Contributor Author

use dolib

I got linter error

E: 'dolib' banned in EAPI 8

Please share some example, I do not use C/C++ and do not understand :(

@stkw0
Copy link
Contributor

stkw0 commented Mar 3, 2025

Something like:

IUSE="test"
RESTRICT="!test? ( test )"

src_configure() {
	local mycmakeargs=(
		-DFAST_OBJ_BUILD_TEST=$(usex test)
	)

	cmake_src_configure
}

src_install() {
	dolib.a "${BUILD_DIR}/libfast_obj_lib.a"
}

You could patch the CMakeLists.txt fail and change the STATIC library to SHARED and use dolib.so instead. Seeing it's such a small program I don't really now if there is much to gain, though.

@vitaly-zdanevich
Copy link
Contributor Author

You could patch the CMakeLists.txt fail and change the STATIC library to SHARED

In this PR? OR in Organic Maps?

@vitaly-zdanevich
Copy link
Contributor Author

vitaly-zdanevich commented Mar 4, 2025

Something like:

Thanks, added your code to this PR. Emerging works without errors. Now its done?

@vitaly-zdanevich vitaly-zdanevich marked this pull request as ready for review March 4, 2025 07:41
@stkw0
Copy link
Contributor

stkw0 commented Mar 4, 2025

You could patch the CMakeLists.txt fail and change the STATIC library to SHARED

In this PR? OR in Organic Maps?

In this PR, I guess Organic maps will link correctly against it even if it's a shared library.

@vitaly-zdanevich
Copy link
Contributor Author

You could patch the CMakeLists.txt fail and change the STATIC library to SHARED

So, please assist - have no idea what to do.

@stkw0
Copy link
Contributor

stkw0 commented Mar 4, 2025

What I usually do, is git clone the repository, modify it as needed (in this case change the CMakeLists.txt line that creates a STATIC library to SHARED, see https://cmake.org/cmake/help/latest/command/add_library.html for more information). Then get the output of git diff and create a patch file for it and apply that patch in the ebuild using the PATCHES variable.

@gerion0
Copy link

gerion0 commented Mar 4, 2025

OM includes fast_obj currently in a way that it is expected as bundled source. I didn't find a place where the library is used (e.g. there seems to be no CMake-file that uses fast_obj in some way), is it needed at all? Probably, OM just needs the single header file.

I would suggest to first patch OM to use an unbundled version of fast_obj before investigating in improving the package. Also, upstream also likely only accept a patch for this, if it is still possible to use the bundled version.

Signed-off-by: Vitaly Zdanevich <zdanevich.vitaly@ya.ru>
@vitaly-zdanevich
Copy link
Contributor Author

vitaly-zdanevich commented Mar 5, 2025

What I usually do, is git clone the repository, modify it as needed (in this case change the CMakeLists.txt line that creates a STATIC library to SHARED, see https://cmake.org/cmake/help/latest/command/add_library.html for more information). Then get the output of git diff and create a patch file for it and apply that patch in the ebuild using the PATCHES variable.

Thanks, added patch, emerge error:

[ebuild   R   ~] dev-cpp/fast_obj-1.3 

Would you like to merge these packages? [Yes/No] 

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) dev-cpp/fast_obj-1.3::guru
 * fast_obj-1.3.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                                               [ ok ]
>>> Unpacking source...
>>> Unpacking fast_obj-1.3.tar.gz to /var/tmp/portage/dev-cpp/fast_obj-1.3/work
>>> Source unpacked in /var/tmp/portage/dev-cpp/fast_obj-1.3/work
>>> Preparing source in /var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3_build"
 * Applying static-to-shared.patch ...
patching file CMakeLists.txt
Hunk #1 succeeded at 1 with fuzz 1.                                                                                                                                                                              [ ok ]
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3_build"
cmake -C /var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DFAST_OBJ_BUILD_TEST=no -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3_build/gentoo_toolchain.cmake /var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3
loading initial cache file /var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3_build/gentoo_common_config.cmake
CMake Deprecation Warning at CMakeLists.txt:1 (CMAKE_MINIMUM_REQUIRED):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- The C compiler identification is GNU 13.3.1
-- The CXX compiler identification is GNU 13.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- <<< Gentoo configuration >>>
Build type      RelWithDebInfo
Install path    /usr
Compiler flags:
C               -O2                -march=native -pipe -frecord-gcc-switches
C++             -O2                -march=native -pipe -frecord-gcc-switches
Linker flags:
Executable      -fuse-ld=lld -Wl,-O3 -Wl,--as-needed -Wl,--gc-sections -Wl,--defsym=__gentoo_check_ldflags__=0
Module          -fuse-ld=lld -Wl,-O3 -Wl,--as-needed -Wl,--gc-sections -Wl,--defsym=__gentoo_check_ldflags__=0
Shared          -fuse-ld=lld -Wl,-O3 -Wl,--as-needed -Wl,--gc-sections -Wl,--defsym=__gentoo_check_ldflags__=0

-- Configuring done (0.3s)
-- Generating done (0.0s)
-- Build files have been written to: /var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3_build
>>> Source configured.
>>> Compiling source in /var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3_build"
ninja -v -j32 -l32
[1/2] /usr/bin/x86_64-pc-linux-gnu-gcc -Dfast_obj_lib_EXPORTS -I/var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3  -O2                -march=native -pipe -frecord-gcc-switches -fPIC -MD -MT CMakeFiles/fast_obj_lib.dir/fast_obj.c.o -MF CMakeFiles/fast_obj_lib.dir/fast_obj.c.o.d -o CMakeFiles/fast_obj_lib.dir/fast_obj.c.o -c /var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3/fast_obj.c
[2/2] : && /usr/bin/x86_64-pc-linux-gnu-gcc -fPIC -O2                -march=native -pipe -frecord-gcc-switches  -fuse-ld=lld -Wl,-O3 -Wl,--as-needed -Wl,--gc-sections -Wl,--defsym=__gentoo_check_ldflags__=0   -Wl,--dependency-file=CMakeFiles/fast_obj_lib.dir/link.d -shared -Wl,-soname,libfast_obj_lib.so -o libfast_obj_lib.so CMakeFiles/fast_obj_lib.dir/fast_obj.c.o   && :
>>> Source compiled.
 * Skipping make test/check due to ebuild restriction.
>>> Test phase [disabled because of RESTRICT=test]: dev-cpp/fast_obj-1.3

>>> Install dev-cpp/fast_obj-1.3 into /var/tmp/portage/dev-cpp/fast_obj-1.3/image
!!! dolib: /var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3_build/libfast_obj_lib.a does not exist

Here

/var/tmp/portage/dev-cpp/fast_obj-1.3/work/fast_obj-1.3_build

is what I have:

-rwxr-xr-x 1 portage portage  21K Mar  5 18:03 libfast_obj_lib.so
-rw-r--r-- 1 portage portage  19K Mar  5 18:03 build.ninja
-rw-r--r-- 1 portage portage  16K Mar  5 18:03 CMakeCache.txt
-rw-r--r-- 1 portage portage 2.2K Mar  5 18:03 cmake_install.cmake
-rw-r--r-- 1 portage portage 1.4K Mar  5 18:03 gentoo_common_config.cmake
-rw-r--r-- 1 portage portage  913 Mar  5 18:03 gentoo_rules.cmake
-rw-r--r-- 1 portage portage  484 Mar  5 18:03 gentoo_toolchain.cmake
drwxr-xr-x 6 portage portage  200 Mar  5 18:03 CMakeFiles

@vitaly-zdanevich
Copy link
Contributor Author

I would suggest to first patch OM to use an unbundled version of fast_obj

but you said that looks like Organic Maps does not use that dependency at all?

@gerion0
Copy link

gerion0 commented Mar 10, 2025

OM seems to use the header but not the library.

@vitaly-zdanevich
Copy link
Contributor Author

I do not know C++ - header is still some code? Or we can drop that header from Organic Maps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants