Nexus Nexus - MATLAB Compatible Computing Platform
← Back to Plans

BRANCH-CONSOLIDATION-PLAN.md

# Branch Consolidation and GPL Replacement Build Option Plan

## Current Branch Structure

- **main**: Base release (v12.0.2)
- **gpl-replacement**: GPL replacement work (12 commits)
- **jit-compiler-implementation**: JIT compiler + recent GPL work (current branch)
- **feature branches**: matlab-compat, performance, toolboxes
- **dev, default**: Development branches

## Consolidation Strategy

1. **Merge all branches into main**
   - Merge gpl-replacement → main
   - Merge jit-compiler-implementation → main
   - Merge feature branches → main
   - Ensure all new features (dynamic props, tests, JIT) are in main

2. **Add Build-Time Option**
   - Add `--enable-gpl-replacement` configure option
   - Default: `no` (use original GPL libraries)
   - When enabled: use proprietary rewritten libraries
   - Both versions include all new features

3. **Implementation Details**

### Configure Option
```bash
./configure --enable-gpl-replacement  # Use rewritten libraries
./configure --disable-gpl-replacement # Use original libraries (default)
```

### Build System Changes
- Add `ENABLE_GPL_REPLACEMENT` autoconf variable
- Define `OCTAVE_USE_GPL_REPLACEMENT` preprocessor macro
- Use conditional compilation in source files:
  ```cpp
  #ifdef OCTAVE_USE_GPL_REPLACEMENT
    // Proprietary implementation
  #else
    // Original GPL implementation
  #endif
  ```

### File Organization
- Keep both implementations in same files with `#ifdef` guards
- Or create separate source files and conditionally compile them
- Ensure tests work for both versions

## Steps

1. ✅ Stash current uncommitted changes
2. ✅ Switch to main branch
3. ✅ Merge gpl-replacement branch
4. ✅ Merge jit-compiler-implementation branch
5. ✅ Add configure.ac option
6. ✅ Update build system (Makefile.am files)
7. ✅ Add conditional compilation guards
8. ✅ Test both build configurations
9. ✅ Document usage