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

Applying all patches inside patches directory #79

Merged
merged 4 commits into from
Jan 8, 2019

Conversation

jubeira
Copy link

@jubeira jubeira commented Jan 2, 2019

See #76; this PR allows applying patches over the codebase without explicitly listing them in the main script, making it easier to maintain.

…m explicitly in main script.

- Moved unused patches to graveyard.
@jubeira jubeira requested a review from meyerj January 2, 2019 20:36
Copy link

@meyerj meyerj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general looks good. pluginlib probably needs some special care (see comment below).

do_everything.sh Outdated

## Demo Application specific patches

run_cmd apply_patches $my_loc/patches/source_patches $prefix
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the additional subdirectory source_patches? I would just leave them in patches and only move the unused ones to patches/graveyard/ or delete them directly (they can still be found via the Git history).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a single patch that has to be applied in a different directory: android.toolchain.cmake.patch; in principle that one has to be in a separate folder.
Perhaps we can move that one to files directory and move all the patches up one level as you propose?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

An alternative approach I took in https://github.com/Intermodalics/ros_android_private/pull/17 is to commit a wrapper android.toolchain.cmake (or a template) and apply changes as CMake code after having included the original file, instead of patching the file in the Android NDK installation folder.

Such a custom and, if necessary, generated toolchain file could also replace most of the cmake options passed in build_catkin_workspace.sh:103ff and utils.sh:21 and be exposed to the user to be used in overlay workspaces (installed to target).

apply_patch $my_loc/patches/pluginlib.patch
# apply_patch image_transport # to fix faulty export plugins
apply_patch $my_loc/patches/image_transport.patch
fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This special case is not handled anymore. In combination with do_everything.sh:120ff if use_pluginlib is disabled in config.sh:12, applying the patches would break pluginlib.

The alternative would be to ignore package pluginlib and all its dependees when building with use_pluginlib=0, because the unpatched version would not work anyway on Android if I am not mistaken.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIU the unpatched version won't work; my rationale is that if you don't want pluginlib, applying a few extra packages doesn't add too much overhead, and you won't be able to use pluginlib anyway.

I agree that for correctness we should ignore pluginlib and deps, but on second thought I'd just drop the flag and build pluginlib support always, as it really doesn't add too much build time to the overall, and the flag just adds some more complexity to the scripts. WDYT?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always building with pluginlib support enabled would be fine for me.

@jubeira jubeira changed the base branch from jubeira/wstool_libs to kinetic January 7, 2019 16:50
@jubeira
Copy link
Author

jubeira commented Jan 8, 2019

@meyerj I removed pluginlib flag and replaced the toolchain's patch with a cmake file that includes the original toolchain file as you proposed.

I'm running a build from scratch right now with these changes and so far it's going well; PTAL.

EDIT: build finished without problems.

@jubeira jubeira changed the title Applying all patches inside source_patches Applying all patches inside patches directory Jan 8, 2019
@jubeira jubeira merged commit a7d8834 into kinetic Jan 8, 2019
@jubeira jubeira deleted the jubeira/automatic_patches branch January 8, 2019 17:19
# Debug and release flags.
list(REMOVE_ITEM ANDROID_COMPILER_FLAGS -g)
list(APPEND ANDROID_COMPILER_FLAGS_DEBUG -g)
list(APPEND ANDROID_COMPILER_FLAGS_RELWITHDEBINFO -g ${ANDROID_COMPILER_FLAGS_RELEASE})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not sufficient to change ANDROID_COMPILER_FLAGS_*. The values have already been copied into CMAKE_C_FLAGS_*, CMAKE_CXX_FLAGS_*,CMAKE_ASM_FLAGS_* further down in the included toolchain file and are not applied directly. So the replacements have to be applied to all of those variables:

## Build without debug symbols in Release mode and add RelWithDebInfo mode
foreach(_var ANDROID_COMPILER_FLAGS CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_ASM_FLAGS)
  string(REPLACE "-g " "" ${_var} "${${_var}}")
  set(${_var}_DEBUG "-g ${${_var}_DEBUG}")
  set(${_var}_RELWITHDEBINFO "-g ${${_var}_RELEASE}")
endforeach()
unset(_var)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the observation; I'll open a PR with the modification.

@jubeira jubeira mentioned this pull request Jan 10, 2019
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.

2 participants