Skip to content

Commit

Permalink
Update GNUStep dependencies and fix GNUStep CI
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jan 11, 2025
1 parent a1d256e commit 3829588
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 32 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ jobs:
~/extern/lib
~/extern/include
# Change this key if we start caching more things
key: extern-${{ github.job }}-${{ matrix.name }}-v2
key: extern-${{ github.job }}-${{ matrix.name }}-v3

- name: Setup environment
# These add to PATH-like variables, so they can always be set
Expand All @@ -705,10 +705,10 @@ jobs:
# Debug print these
ls -al $HOME/extern/*
- name: Install Clang + Valgrind
- name: Install Clang + Valgrind + TIFF
run: |
sudo apt-get update
sudo apt-get -y install clang valgrind
sudo apt-get -y install clang valgrind libtiff-dev
- name: Install cross compilation tools
if: matrix.target == 'i686-unknown-linux-gnu'
Expand Down Expand Up @@ -761,29 +761,29 @@ jobs:
- name: Install GNUStep make
if: steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/tools-make/archive/refs/tags/make-2_9_0.tar.gz
tar -xzf make-2_9_0.tar.gz
mkdir -p tools-make-make-2_9_0/build
cd tools-make-make-2_9_0/build
wget https://github.com/gnustep/tools-make/archive/refs/tags/make-2_9_2.tar.gz
tar -xzf make-2_9_2.tar.gz
mkdir -p tools-make-make-2_9_2/build
cd tools-make-make-2_9_2/build
../configure --prefix=$HOME/extern --with-library-combo=ng-gnu-gnu
make install
- name: Install GNUStep base library
if: steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/libs-base/archive/refs/tags/base-1_28_0.tar.gz
tar -xzf base-1_28_0.tar.gz
cd libs-base-base-1_28_0
wget https://github.com/gnustep/libs-base/archive/refs/tags/base-1_30_0.tar.gz
tar -xzf base-1_30_0.tar.gz
cd libs-base-base-1_30_0
./configure --prefix=$HOME/extern --disable-tls --disable-xslt ${{ matrix.configureflags }}
make install
ls -al $HOME/extern/*
- name: Install GNUStep GUI
if: matrix.target == 'x86_64-unknown-linux-gnu' && steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/libs-gui/archive/refs/tags/gui-0_29_0.tar.gz
tar -xzf gui-0_29_0.tar.gz
cd libs-gui-gui-0_29_0
wget https://github.com/gnustep/libs-gui/archive/refs/tags/gui-0_31_1.tar.gz
tar -xzf gui-0_31_1.tar.gz
cd libs-gui-gui-0_31_1
./configure --prefix=$HOME/extern --disable-jpeg ${{ matrix.configureflags }}
make install
ls -al $HOME/extern/*
Expand Down
14 changes: 1 addition & 13 deletions framework-crates/objc2-foundation/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,7 @@ impl NSData {
#[cfg(feature = "block2")]
#[cfg(feature = "alloc")]
pub fn from_vec(bytes: Vec<u8>) -> Retained<Self> {
// GNUStep's NSData `initWithBytesNoCopy:length:deallocator:` has a
// bug; it forgets to assign the input buffer and length to the
// instance before it swizzles to NSDataWithDeallocatorBlock.
// See https://github.com/gnustep/libs-base/pull/213
// So instead we use NSDataWithDeallocatorBlock directly.
//
// NSMutableData does not have this problem.
#[cfg(feature = "gnustep-1-7")]
let obj = unsafe { objc2::msg_send_id![objc2::class!(NSDataWithDeallocatorBlock), alloc] };
#[cfg(not(feature = "gnustep-1-7"))]
let obj = Self::alloc();

unsafe { with_vec(obj, bytes) }
unsafe { with_vec(Self::alloc(), bytes) }
}
}

Expand Down
20 changes: 19 additions & 1 deletion framework-crates/objc2-foundation/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,25 @@ impl fmt::Debug for NSError {

impl fmt::Display for NSError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let desc: Retained<NSObject> = unsafe { msg_send_id![self, localizedDescription] };
let desc: Retained<NSObject> = if cfg!(feature = "gnustep-1-7") {
// Can return NULL:
// https://github.com/gnustep/libs-base/issues/486
let desc: Option<Retained<NSObject>> =
unsafe { msg_send_id![self, localizedDescription] };
if let Some(desc) = desc {
desc
} else {
let domain: Retained<NSObject> = unsafe { msg_send_id![self, domain] };
// SAFETY: `domain` returns `NSErrorDomain`, which is `NSString`.
unsafe { util::display_string(&domain, f)? };
write!(f, " {}", self.code())?;

return Ok(());
}
} else {
unsafe { msg_send_id![self, localizedDescription] }
};

// SAFETY: `localizedDescription` returns `NSString`.
unsafe { util::display_string(&desc, f) }
}
Expand Down
5 changes: 0 additions & 5 deletions framework-crates/objc2-foundation/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ impl NSValue {
impl NSValue {
/// Retrieve the data contained in the `NSValue`.
///
/// Note that this is broken on GNUStep for some types, see
/// [gnustep/libs-base#216].
///
/// [gnustep/libs-base#216]: https://github.com/gnustep/libs-base/pull/216
///
///
/// # Safety
///
Expand Down

0 comments on commit 3829588

Please sign in to comment.